|
@@ -24,49 +24,62 @@ class PanelOptimizer(wx.Panel):
|
|
|
----------
|
|
----------
|
|
|
unitId : string
|
|
unitId : string
|
|
|
Currently selected unit ID (default None)
|
|
Currently selected unit ID (default None)
|
|
|
- optimizationOptions : wx.BoxSizer
|
|
|
|
|
- Holds every widget that is hidden until a unit is selected.
|
|
|
|
|
- unitInfo : wx.StaticBox
|
|
|
|
|
- Box containig the non-editable elements with a unit info.
|
|
|
|
|
|
|
+ unitStats : int[10]
|
|
|
|
|
+ The current stats of the selected unit (HP, ATK, DEF, SPD, CRR, CRD,
|
|
|
|
|
+ RES, ACC). (default is [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).
|
|
|
|
|
+ teamIds : string[]
|
|
|
|
|
+ IDs of all teams, indexed by the order they appear in the team selector.
|
|
|
unitIdSelectorIndex : int[]
|
|
unitIdSelectorIndex : int[]
|
|
|
Array with the IDs of all units, in the same order as displayed in
|
|
Array with the IDs of all units, in the same order as displayed in
|
|
|
- unitSelector, so an ID can be retrived knowing the choice
|
|
|
|
|
|
|
+ unitChoice, so an ID can be retrived knowing the choice
|
|
|
selected index.
|
|
selected index.
|
|
|
- unitSelector : wx.Choice
|
|
|
|
|
|
|
+ optionsSizer : wx.BoxSizer
|
|
|
|
|
+ Holds every widget that is hidden until a unit is selected.
|
|
|
|
|
+ unitInfoBox : wx.StaticBox
|
|
|
|
|
+ Box containig the non-editable elements with a unit info.
|
|
|
|
|
+ unitChoice : wx.Choice
|
|
|
Unit selecctor. Choosing a unit triggers selectUnit.
|
|
Unit selecctor. Choosing a unit triggers selectUnit.
|
|
|
statGrid : wx.Grid.grid
|
|
statGrid : wx.Grid.grid
|
|
|
Table with the unit base and current stats.
|
|
Table with the unit base and current stats.
|
|
|
- runeList : wx.StaticText[6]
|
|
|
|
|
|
|
+ runeLabelList : wx.StaticText[6]
|
|
|
Labels with all the info about the currently equipped runes.
|
|
Labels with all the info about the currently equipped runes.
|
|
|
- minStatSlid : wx.Slider[6]
|
|
|
|
|
|
|
+ minStatSlidList : wx.Slider[6]
|
|
|
List of sliders for the minimum selectors for each stat.
|
|
List of sliders for the minimum selectors for each stat.
|
|
|
- minStatText : wx.StaticText[6]
|
|
|
|
|
|
|
+ minStatTextList : wx.StaticText[6]
|
|
|
List of text inputs for the minimum selectors for each stat.
|
|
List of text inputs for the minimum selectors for each stat.
|
|
|
- stats : wx.CheckListBox[2]
|
|
|
|
|
|
|
+ statCheckListList : wx.CheckListBox[2]
|
|
|
Tho selctors to choose stats allowed in optimization.
|
|
Tho selctors to choose stats allowed in optimization.
|
|
|
- runeSets : wx.Choice[3]
|
|
|
|
|
|
|
+ setChoiceList : wx.Choice[3]
|
|
|
List of selector to pik rune sets.
|
|
List of selector to pik rune sets.
|
|
|
- level : wx.Choice
|
|
|
|
|
|
|
+ levelChoice : wx.Choice
|
|
|
Selector to pick the level for the rune optimization.
|
|
Selector to pick the level for the rune optimization.
|
|
|
- inventory : wx.Checkbox
|
|
|
|
|
|
|
+ inventoryCheck : wx.Checkbox
|
|
|
Checkbox to use only runes in the inventory
|
|
Checkbox to use only runes in the inventory
|
|
|
- teams : wx.CheckboxList :
|
|
|
|
|
|
|
+ teamCheckList : wx.CheckboxList :
|
|
|
List of selectable teams to exclude from the optimization.
|
|
List of selectable teams to exclude from the optimization.
|
|
|
- unitStats : int[10]
|
|
|
|
|
- The current stats of the selected unit. (default is
|
|
|
|
|
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).
|
|
|
|
|
- teamIds : string[]
|
|
|
|
|
- IDs of all teams, indexed by the order they appear in the team selector.
|
|
|
|
|
|
|
+ progressGauge : wx.Gauge
|
|
|
|
|
+ A progress bar
|
|
|
|
|
+ timer : wx.Timer
|
|
|
|
|
+ Timer to check the update process for new output to display.
|
|
|
|
|
+ process : wx.Process
|
|
|
|
|
+ The update process.
|
|
|
|
|
|
|
|
Methods
|
|
Methods
|
|
|
-------
|
|
-------
|
|
|
|
|
+ selectAllTeams(event)
|
|
|
|
|
+ Selects all teams in the list.
|
|
|
|
|
+ deselectAllTeams(event)
|
|
|
|
|
+ Deselects all teams in the list.
|
|
|
selectUnit(event)
|
|
selectUnit(event)
|
|
|
Loads a unit info and enables optimizaton options.
|
|
Loads a unit info and enables optimizaton options.
|
|
|
processResults(jsonData)
|
|
processResults(jsonData)
|
|
|
Processes data obtained from RuneOptimizer.
|
|
Processes data obtained from RuneOptimizer.
|
|
|
-
|
|
|
|
|
startOptimization(event)
|
|
startOptimization(event)
|
|
|
Prepares and runs a command optimization.
|
|
Prepares and runs a command optimization.
|
|
|
|
|
+ checkProcess(event)
|
|
|
|
|
+ Checks the process and update the progress bar.
|
|
|
|
|
+ updateComplete(event)
|
|
|
|
|
+ Called at process end, rediresct to the result view.
|
|
|
minStatChangeBySlider(event)
|
|
minStatChangeBySlider(event)
|
|
|
Changes text when a slider is changed.
|
|
Changes text when a slider is changed.
|
|
|
minStatChangeByTExt(event)
|
|
minStatChangeByTExt(event)
|
|
@@ -75,21 +88,24 @@ class PanelOptimizer(wx.Panel):
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
unitId = None
|
|
unitId = None
|
|
|
- optimizationOptions = None
|
|
|
|
|
- unitInfo = None
|
|
|
|
|
- unidIdSelectorIndex = []
|
|
|
|
|
- unitSelector = None
|
|
|
|
|
- statGrid = None
|
|
|
|
|
- runeList = None
|
|
|
|
|
- minStatSlid = None
|
|
|
|
|
- minStatText = None
|
|
|
|
|
- stats = None
|
|
|
|
|
- runeSets = None
|
|
|
|
|
- level = None
|
|
|
|
|
- inventory = None
|
|
|
|
|
- teams = None
|
|
|
|
|
unitStats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
unitStats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
teamIds = []
|
|
teamIds = []
|
|
|
|
|
+ unidIdSelectorIndex = []
|
|
|
|
|
+ optionsSizer = None
|
|
|
|
|
+ unitInfoBox = None
|
|
|
|
|
+ unitChoice = None
|
|
|
|
|
+ statGrid = None
|
|
|
|
|
+ runeLabelList = None
|
|
|
|
|
+ minStatSlidList = None
|
|
|
|
|
+ minStatTextList = None
|
|
|
|
|
+ statCheckListList = None
|
|
|
|
|
+ setChoiceList = None
|
|
|
|
|
+ levelChoice = None
|
|
|
|
|
+ inventoryCheck = None
|
|
|
|
|
+ teamCheckList = None
|
|
|
|
|
+ progressGauge = None
|
|
|
|
|
+ timer = None
|
|
|
|
|
+ process = None
|
|
|
|
|
|
|
|
def __init__(self, parent, id=wx.ID_ANY):
|
|
def __init__(self, parent, id=wx.ID_ANY):
|
|
|
"""Initializes the panel.
|
|
"""Initializes the panel.
|
|
@@ -109,10 +125,10 @@ class PanelOptimizer(wx.Panel):
|
|
|
|
|
|
|
|
# Sizer for all optimization options. Will be hidden until a unit is
|
|
# Sizer for all optimization options. Will be hidden until a unit is
|
|
|
# selected.
|
|
# selected.
|
|
|
- self.optimizationOptions = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
|
+ self.optionsSizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
|
|
# Unit info box
|
|
# Unit info box
|
|
|
- self.unitInfo = wx.StaticBox(
|
|
|
|
|
|
|
+ self.unitInfoBox = wx.StaticBox(
|
|
|
self, label="Select unit:", id=wx.ID_ANY, pos=(10, 0), size=(450, 300)
|
|
self, label="Select unit:", id=wx.ID_ANY, pos=(10, 0), size=(450, 300)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -122,15 +138,15 @@ class PanelOptimizer(wx.Panel):
|
|
|
for row in cursor:
|
|
for row in cursor:
|
|
|
names.append(row[1])
|
|
names.append(row[1])
|
|
|
self.unidIdSelectorIndex.append(row[0])
|
|
self.unidIdSelectorIndex.append(row[0])
|
|
|
- self.unitSelector =wx.Choice(
|
|
|
|
|
- parent=self.unitInfo, id=wx.ID_ANY, pos=(10, 0),
|
|
|
|
|
|
|
+ self.unitChoice =wx.Choice(
|
|
|
|
|
+ parent=self.unitInfoBox, id=wx.ID_ANY, pos=(10, 0),
|
|
|
size=(200, 30), choices=names
|
|
size=(200, 30), choices=names
|
|
|
)
|
|
)
|
|
|
- self.Bind(wx.EVT_CHOICE, self.selectUnit, self.unitSelector)
|
|
|
|
|
|
|
+ self.Bind(wx.EVT_CHOICE, self.selectUnit, self.unitChoice)
|
|
|
|
|
|
|
|
# Stats table
|
|
# Stats table
|
|
|
self.statGrid = wx.grid.Grid(
|
|
self.statGrid = wx.grid.Grid(
|
|
|
- parent=self.unitInfo, id=wx.ID_ANY, pos=(0, 30), size=(165, 220)
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, id=wx.ID_ANY, pos=(0, 30), size=(165, 220)
|
|
|
)
|
|
)
|
|
|
self.statGrid.CreateGrid(
|
|
self.statGrid.CreateGrid(
|
|
|
numRows=10, numCols=2,
|
|
numRows=10, numCols=2,
|
|
@@ -170,61 +186,61 @@ class PanelOptimizer(wx.Panel):
|
|
|
#self.unitContent.Add(self.statGrid)
|
|
#self.unitContent.Add(self.statGrid)
|
|
|
|
|
|
|
|
#Rune set list
|
|
#Rune set list
|
|
|
- runeListBox = [
|
|
|
|
|
|
|
+ runeBoxList = [
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot1:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot1:", id=wx.ID_ANY,
|
|
|
pos=(265, 30), size=(80, 115)
|
|
pos=(265, 30), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot2:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot2:", id=wx.ID_ANY,
|
|
|
pos=(350, 30), size=(80, 115)
|
|
pos=(350, 30), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot3:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot3:", id=wx.ID_ANY,
|
|
|
pos=(350, 150), size=(80, 115)
|
|
pos=(350, 150), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot4:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot4:", id=wx.ID_ANY,
|
|
|
pos=(265, 150), size=(80, 115)
|
|
pos=(265, 150), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot5:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot5:", id=wx.ID_ANY,
|
|
|
pos=(180, 150), size=(80, 115)
|
|
pos=(180, 150), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticBox(
|
|
wx.StaticBox(
|
|
|
- parent=self.unitInfo, label="Slot6:", id=wx.ID_ANY,
|
|
|
|
|
|
|
+ parent=self.unitInfoBox, label="Slot6:", id=wx.ID_ANY,
|
|
|
pos=(180, 30), size=(80, 115)
|
|
pos=(180, 30), size=(80, 115)
|
|
|
)
|
|
)
|
|
|
]
|
|
]
|
|
|
- self.runeList = [
|
|
|
|
|
|
|
+ self.runeLabelList = [
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[0], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[1], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[2], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[3], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[4], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
),
|
|
),
|
|
|
wx.StaticText(
|
|
wx.StaticText(
|
|
|
- parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
|
|
+ parent=runeBoxList[5], id=wx.ID_ANY, label="",
|
|
|
pos=(0, 0), size=(80, 115)
|
|
pos=(0, 0), size=(80, 115)
|
|
|
)
|
|
)
|
|
|
]
|
|
]
|
|
|
monospaceFont.PointSize -= 2
|
|
monospaceFont.PointSize -= 2
|
|
|
for i in range(0, 6):
|
|
for i in range(0, 6):
|
|
|
- runeListBox[i].SetFont(monospaceFont)
|
|
|
|
|
|
|
+ runeBoxList[i].SetFont(monospaceFont)
|
|
|
monospaceFont.PointSize += 2
|
|
monospaceFont.PointSize += 2
|
|
|
|
|
|
|
|
# Min stats
|
|
# Min stats
|
|
@@ -271,7 +287,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
parent=minStatBox, label="DMG", id=wx.ID_ANY,
|
|
parent=minStatBox, label="DMG", id=wx.ID_ANY,
|
|
|
pos=(0, 225), size=(30, 25)
|
|
pos=(0, 225), size=(30, 25)
|
|
|
)
|
|
)
|
|
|
- self.minStatSlid = [
|
|
|
|
|
|
|
+ self.minStatSlidList = [
|
|
|
wx.Slider(
|
|
wx.Slider(
|
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(30, 0),
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(30, 0),
|
|
|
size=(120, 25), name="slid0"
|
|
size=(120, 25), name="slid0"
|
|
@@ -314,13 +330,13 @@ class PanelOptimizer(wx.Panel):
|
|
|
)
|
|
)
|
|
|
]
|
|
]
|
|
|
for i in range(0, 10):
|
|
for i in range(0, 10):
|
|
|
- self.minStatSlid[i].SetMin(0)
|
|
|
|
|
- self.minStatSlid[i].SetMax(0)
|
|
|
|
|
- self.minStatSlid[i].SetValue(0)
|
|
|
|
|
|
|
+ self.minStatSlidList[i].SetMin(0)
|
|
|
|
|
+ self.minStatSlidList[i].SetMax(0)
|
|
|
|
|
+ self.minStatSlidList[i].SetValue(0)
|
|
|
self.Bind(
|
|
self.Bind(
|
|
|
- wx.EVT_SCROLL, self.minStatChangeBySlider, self.minStatSlid[i]
|
|
|
|
|
|
|
+ wx.EVT_SCROLL, self.minStatChangeBySlider, self.minStatSlidList[i]
|
|
|
)
|
|
)
|
|
|
- self.minStatText = [
|
|
|
|
|
|
|
+ self.minStatTextList = [
|
|
|
wx.TextCtrl(
|
|
wx.TextCtrl(
|
|
|
minStatBox, id=wx.ID_ANY, value="", pos=(155, 0), size=(65, 25),
|
|
minStatBox, id=wx.ID_ANY, value="", pos=(155, 0), size=(65, 25),
|
|
|
style=wx.TE_RIGHT|wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB
|
|
style=wx.TE_RIGHT|wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB
|
|
@@ -364,7 +380,8 @@ class PanelOptimizer(wx.Panel):
|
|
|
]
|
|
]
|
|
|
for i in range(0, 9):
|
|
for i in range(0, 9):
|
|
|
self.Bind(
|
|
self.Bind(
|
|
|
- wx.EVT_TEXT_ENTER, self.minStatChangeByText, self.minStatText[i]
|
|
|
|
|
|
|
+ wx.EVT_TEXT_ENTER,
|
|
|
|
|
+ self.minStatChangeByText, self.minStatTextList[i]
|
|
|
)
|
|
)
|
|
|
minStatsReset = wx.Button(
|
|
minStatsReset = wx.Button(
|
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(10, 250),
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(10, 250),
|
|
@@ -374,7 +391,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(120, 250),
|
|
parent=minStatBox, id=wx.ID_ANY, pos=(120, 250),
|
|
|
size=(100, 20), style=wx.LC_REPORT, label="Adapt all")
|
|
size=(100, 20), style=wx.LC_REPORT, label="Adapt all")
|
|
|
# TODO: Add binds
|
|
# TODO: Add binds
|
|
|
- self.optimizationOptions.Add(minStatBox)
|
|
|
|
|
|
|
+ self.optionsSizer.Add(minStatBox)
|
|
|
|
|
|
|
|
# Allowed main stats for even slots
|
|
# Allowed main stats for even slots
|
|
|
names = [
|
|
names = [
|
|
@@ -385,7 +402,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
self, id=wx.ID_ANY, label="Main stats (2, 4, 6):",
|
|
self, id=wx.ID_ANY, label="Main stats (2, 4, 6):",
|
|
|
pos=(10, 300), size=(150, 190)
|
|
pos=(10, 300), size=(150, 190)
|
|
|
)
|
|
)
|
|
|
- self.stats = [
|
|
|
|
|
|
|
+ self.statCheckListList = [
|
|
|
wx.CheckListBox(
|
|
wx.CheckListBox(
|
|
|
parent=statBox, id=wx.ID_ANY, pos=(5, 5),
|
|
parent=statBox, id=wx.ID_ANY, pos=(5, 5),
|
|
|
size=(70, 155), choices=names[0]
|
|
size=(70, 155), choices=names[0]
|
|
@@ -395,20 +412,20 @@ class PanelOptimizer(wx.Panel):
|
|
|
size=(70, 155), choices=names[1]
|
|
size=(70, 155), choices=names[1]
|
|
|
)
|
|
)
|
|
|
]
|
|
]
|
|
|
- self.optimizationOptions.Add(statBox)
|
|
|
|
|
|
|
+ self.optionsSizer.Add(statBox)
|
|
|
|
|
|
|
|
# Rune sets
|
|
# Rune sets
|
|
|
names = [
|
|
names = [
|
|
|
"", "ENERGY ", "GUARD ", "SWIFT ", "BLADE ", "RAGE ",
|
|
"", "ENERGY ", "GUARD ", "SWIFT ", "BLADE ", "RAGE ",
|
|
|
- "FOCUS ", "ENDURE ", "FATAL ", "DESPAIR", "VAMPIRE", "VIOLENT",
|
|
|
|
|
- "NEMESIS", "WILL ", "SHIELD ", "REVENGE", "DESTROY", "FIGHT ",
|
|
|
|
|
- "DETERMI", "ENHANCE", "ACCURAC", "TOLERAN"
|
|
|
|
|
|
|
+ "FOCUS ", "ENDURE ", "FATAL ", "DESPAIR", "VAMPIRE",
|
|
|
|
|
+ "VIOLENT", "NEMESIS", "WILL ", "SHIELD ", "REVENGE", "DESTROY",
|
|
|
|
|
+ "FIGHT ", "DETERMI", "ENHANCE", "ACCURAC", "TOLERAN"
|
|
|
]
|
|
]
|
|
|
setBox = wx.StaticBox(
|
|
setBox = wx.StaticBox(
|
|
|
self, label="Rune Sets:", id=wx.ID_ANY,
|
|
self, label="Rune Sets:", id=wx.ID_ANY,
|
|
|
pos=(170, 300), size=(115, 120)
|
|
pos=(170, 300), size=(115, 120)
|
|
|
)
|
|
)
|
|
|
- self.runeSets = [
|
|
|
|
|
|
|
+ self.setChoiceList = [
|
|
|
wx.Choice(
|
|
wx.Choice(
|
|
|
parent=setBox, id=wx.ID_ANY, pos=(5, 0),
|
|
parent=setBox, id=wx.ID_ANY, pos=(5, 0),
|
|
|
size=(100, 30), choices=names
|
|
size=(100, 30), choices=names
|
|
@@ -422,18 +439,18 @@ class PanelOptimizer(wx.Panel):
|
|
|
size=(100, 30), choices=names
|
|
size=(100, 30), choices=names
|
|
|
)
|
|
)
|
|
|
]
|
|
]
|
|
|
- self.optimizationOptions.Add(setBox)
|
|
|
|
|
|
|
+ self.optionsSizer.Add(setBox)
|
|
|
|
|
|
|
|
# Rune level selector
|
|
# Rune level selector
|
|
|
levelBox = wx.StaticBox(
|
|
levelBox = wx.StaticBox(
|
|
|
self, label="Rune Level:", id=wx.ID_ANY,
|
|
self, label="Rune Level:", id=wx.ID_ANY,
|
|
|
pos=(170, 420), size=(115, 70)
|
|
pos=(170, 420), size=(115, 70)
|
|
|
)
|
|
)
|
|
|
- self.level = wx.Choice(
|
|
|
|
|
|
|
+ self.levelChoice = wx.Choice(
|
|
|
parent=levelBox, id=wx.ID_ANY, pos=(5, 0),
|
|
parent=levelBox, id=wx.ID_ANY, pos=(5, 0),
|
|
|
choices=["Current", "+ 12", " + 15"]
|
|
choices=["Current", "+ 12", " + 15"]
|
|
|
)
|
|
)
|
|
|
- self.optimizationOptions.Add(levelBox)
|
|
|
|
|
|
|
+ self.optionsSizer.Add(levelBox)
|
|
|
|
|
|
|
|
# Team list
|
|
# Team list
|
|
|
teams = []
|
|
teams = []
|
|
@@ -452,33 +469,73 @@ class PanelOptimizer(wx.Panel):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# Inventory only option
|
|
# Inventory only option
|
|
|
- self.optimizationOptions.Add(teamsBox)
|
|
|
|
|
- self.inventory = wx.CheckBox(
|
|
|
|
|
|
|
+ self.optionsSizer.Add(teamsBox)
|
|
|
|
|
+ self.inventoryCheck = wx.CheckBox(
|
|
|
parent=self, id=wx.ID_ANY, label="Only runes in storage",
|
|
parent=self, id=wx.ID_ANY, label="Only runes in storage",
|
|
|
pos=(560, 310), size=(180, 20)
|
|
pos=(560, 310), size=(180, 20)
|
|
|
)
|
|
)
|
|
|
- self.optimizationOptions.Add(self.inventory)
|
|
|
|
|
- self.teams = wx.CheckListBox(
|
|
|
|
|
|
|
+ self.optionsSizer.Add(self.inventoryCheck)
|
|
|
|
|
+ self.teamCheckList = wx.CheckListBox(
|
|
|
|
|
+ parent=teamsBox, id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 5), size=(250, 130), choices=teams
|
|
|
|
|
+ )
|
|
|
|
|
+ btAllTeams = wx.Button(
|
|
|
|
|
+ parent=teamsBox, id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 135), size=(120, 20), label="Select all"
|
|
|
|
|
+ )
|
|
|
|
|
+ btNoTeams = wx.Button(
|
|
|
parent=teamsBox, id=wx.ID_ANY,
|
|
parent=teamsBox, id=wx.ID_ANY,
|
|
|
- pos=(5, 5), size=(250, 160), choices=teams
|
|
|
|
|
|
|
+ pos=(130, 135), size=(120, 20), label="Deselect all"
|
|
|
)
|
|
)
|
|
|
|
|
+ self.Bind(wx.EVT_BUTTON, self.selectAllTeams, btAllTeams)
|
|
|
|
|
+ self.Bind(wx.EVT_BUTTON, self.deselectAllTeams, btNoTeams)
|
|
|
|
|
|
|
|
# Button to start
|
|
# Button to start
|
|
|
btOptimize = wx.Button(
|
|
btOptimize = wx.Button(
|
|
|
parent=self, id=wx.ID_ANY, pos=(600, 500),
|
|
parent=self, id=wx.ID_ANY, pos=(600, 500),
|
|
|
size=(100, 40), style=wx.LC_REPORT, label="OPTIMIZE"
|
|
size=(100, 40), style=wx.LC_REPORT, label="OPTIMIZE"
|
|
|
)
|
|
)
|
|
|
- self.optimizationOptions.Add(btOptimize)
|
|
|
|
|
|
|
+ self.optionsSizer.Add(btOptimize)
|
|
|
self.Bind(wx.EVT_BUTTON, self.startOptimization, btOptimize)
|
|
self.Bind(wx.EVT_BUTTON, self.startOptimization, btOptimize)
|
|
|
|
|
|
|
|
|
|
+ # Progress bar
|
|
|
|
|
+ self.progressGauge = wx.Gauge(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, range=20,
|
|
|
|
|
+ pos=(50, 485), size=(500, 40), style=wx.GA_HORIZONTAL
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
# By default, hide all optimization options
|
|
# By default, hide all optimization options
|
|
|
- self.optimizationOptions.ShowItems(False)
|
|
|
|
|
|
|
+ self.optionsSizer.ShowItems(False)
|
|
|
|
|
+
|
|
|
|
|
+ def selectAllTeams(self, event = None):
|
|
|
|
|
+ """Selects all teams in the list.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+ for i in range(0, len(self.teamIds)):
|
|
|
|
|
+ self.teamCheckList.Check(i, True)
|
|
|
|
|
+
|
|
|
|
|
+ def deselectAllTeams(self, event = None):
|
|
|
|
|
+ """Deselects all teams in the list.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+ for i in range(0, len(self.teamIds)):
|
|
|
|
|
+ self.teamCheckList.Check(i, False)
|
|
|
|
|
|
|
|
def selectUnit(self, event = None):
|
|
def selectUnit(self, event = None):
|
|
|
"""Loads a unit info and enables optimizaton options.
|
|
"""Loads a unit info and enables optimizaton options.
|
|
|
|
|
|
|
|
- Called when a unit is selected in unitSelector. If called from an
|
|
|
|
|
- an event, the unit selected in unitSelector gets priority. When
|
|
|
|
|
|
|
+ Called when a unit is selected in unitChoice. If called from an
|
|
|
|
|
+ an event, the unit selected in unitChoice gets priority. When
|
|
|
manually called, it uses unitId, so it must be set beforehand.
|
|
manually called, it uses unitId, so it must be set beforehand.
|
|
|
|
|
|
|
|
Parameters
|
|
Parameters
|
|
@@ -488,10 +545,21 @@ class PanelOptimizer(wx.Panel):
|
|
|
|
|
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
|
|
+ # If its called from an event, it means a unit has been selected in this
|
|
|
|
|
+ # panel selector.
|
|
|
if event != None:
|
|
if event != None:
|
|
|
self.unitId = \
|
|
self.unitId = \
|
|
|
- self.unidIdSelectorIndex[self.unitSelector.GetSelection()]
|
|
|
|
|
- # TODO: Else mark selected in selector
|
|
|
|
|
|
|
+ self.unidIdSelectorIndex[self.unitChoice.GetSelection()]
|
|
|
|
|
+
|
|
|
|
|
+ # It it was not called from an event, it uses self.unitId and sets the
|
|
|
|
|
+ # selected unit in the unit selector automatically.
|
|
|
|
|
+ else:
|
|
|
|
|
+ for i in range(0, len(self.unidIdSelectorIndex)):
|
|
|
|
|
+ if self.unidIdSelectorIndex[i] == self.unitId:
|
|
|
|
|
+ self.unitChoice.SetSelection(i)
|
|
|
|
|
+ break
|
|
|
|
|
+
|
|
|
|
|
+ # Get the unit details
|
|
|
cursor = conn.execute("""
|
|
cursor = conn.execute("""
|
|
|
SELECT
|
|
SELECT
|
|
|
base_hp,
|
|
base_hp,
|
|
@@ -518,20 +586,20 @@ class PanelOptimizer(wx.Panel):
|
|
|
""")
|
|
""")
|
|
|
row = cursor.fetchone()
|
|
row = cursor.fetchone()
|
|
|
# First, set sliders max values
|
|
# First, set sliders max values
|
|
|
- self.minStatSlid[0].SetMax(50000) #HP
|
|
|
|
|
- self.minStatSlid[1].SetMax(5000) #ATK
|
|
|
|
|
- self.minStatSlid[2].SetMax(5000) #DEF
|
|
|
|
|
- self.minStatSlid[3].SetMax(500) #SPD
|
|
|
|
|
- self.minStatSlid[4].SetMax(100) #CRR
|
|
|
|
|
- self.minStatSlid[5].SetMax(500) #CRD
|
|
|
|
|
- self.minStatSlid[6].SetMax(100) #RES
|
|
|
|
|
- self.minStatSlid[7].SetMax(85) #ACC
|
|
|
|
|
- self.minStatSlid[8].SetMax(250000) #EHP
|
|
|
|
|
- self.minStatSlid[9].SetMax(8000) #DMG
|
|
|
|
|
- self.unitInfo.SetLabel(row[17] + " #" + row[16])
|
|
|
|
|
|
|
+ self.minStatSlidList[0].SetMax(50000) #HP
|
|
|
|
|
+ self.minStatSlidList[1].SetMax(5000) #ATK
|
|
|
|
|
+ self.minStatSlidList[2].SetMax(5000) #DEF
|
|
|
|
|
+ self.minStatSlidList[3].SetMax(500) #SPD
|
|
|
|
|
+ self.minStatSlidList[4].SetMax(100) #CRR
|
|
|
|
|
+ self.minStatSlidList[5].SetMax(500) #CRD
|
|
|
|
|
+ self.minStatSlidList[6].SetMax(100) #RES
|
|
|
|
|
+ self.minStatSlidList[7].SetMax(85) #ACC
|
|
|
|
|
+ self.minStatSlidList[8].SetMax(250000) #EHP
|
|
|
|
|
+ self.minStatSlidList[9].SetMax(8000) #DMG
|
|
|
|
|
+ self.unitInfoBox.SetLabel(row[17] + " #" + row[16])
|
|
|
for i in range(0, 8):
|
|
for i in range(0, 8):
|
|
|
value = str(row[i])
|
|
value = str(row[i])
|
|
|
- self.minStatSlid[i].SetMin(int(value))
|
|
|
|
|
|
|
+ self.minStatSlidList[i].SetMin(int(value))
|
|
|
if i > 3:
|
|
if i > 3:
|
|
|
value = value + "%"
|
|
value = value + "%"
|
|
|
else:
|
|
else:
|
|
@@ -539,8 +607,8 @@ class PanelOptimizer(wx.Panel):
|
|
|
self.statGrid.SetCellValue(row=i, col=0, s=value)
|
|
self.statGrid.SetCellValue(row=i, col=0, s=value)
|
|
|
for i in range(0, 8):
|
|
for i in range(0, 8):
|
|
|
value = str(row[8 + i])
|
|
value = str(row[8 + i])
|
|
|
- self.minStatSlid[i].SetValue(int(value))
|
|
|
|
|
- self.minStatText[i].SetValue(value)
|
|
|
|
|
|
|
+ self.minStatSlidList[i].SetValue(int(value))
|
|
|
|
|
+ self.minStatTextList[i].SetValue(value)
|
|
|
self.unitStats[i] = int(value)
|
|
self.unitStats[i] = int(value)
|
|
|
if i > 3:
|
|
if i > 3:
|
|
|
value = value + "%"
|
|
value = value + "%"
|
|
@@ -552,14 +620,14 @@ class PanelOptimizer(wx.Panel):
|
|
|
baseDef = int(self.statGrid.GetCellValue(row=2, col=0).replace("%", ""))
|
|
baseDef = int(self.statGrid.GetCellValue(row=2, col=0).replace("%", ""))
|
|
|
baseEhp = math.ceil((((baseDef * 3.5) + 1140) * baseHp) / 1000)
|
|
baseEhp = math.ceil((((baseDef * 3.5) + 1140) * baseHp) / 1000)
|
|
|
self.statGrid.SetCellValue(row=8, col=0, s=str(baseEhp))
|
|
self.statGrid.SetCellValue(row=8, col=0, s=str(baseEhp))
|
|
|
- self.minStatSlid[8].SetMin(baseEhp)
|
|
|
|
|
|
|
+ self.minStatSlidList[8].SetMin(baseEhp)
|
|
|
currentHp = int(self.statGrid.GetCellValue(row=0, col=1))
|
|
currentHp = int(self.statGrid.GetCellValue(row=0, col=1))
|
|
|
currentDef = \
|
|
currentDef = \
|
|
|
int(self.statGrid.GetCellValue(row=2, col=1).replace("%", ""))
|
|
int(self.statGrid.GetCellValue(row=2, col=1).replace("%", ""))
|
|
|
currentEhp = math.ceil((((currentDef * 3.5) + 1140) * currentHp) / 1000)
|
|
currentEhp = math.ceil((((currentDef * 3.5) + 1140) * currentHp) / 1000)
|
|
|
self.statGrid.SetCellValue(row=8, col=1, s=str(currentEhp))
|
|
self.statGrid.SetCellValue(row=8, col=1, s=str(currentEhp))
|
|
|
- self.minStatSlid[8].SetValue(currentEhp)
|
|
|
|
|
- self.minStatText[8].SetValue(str(currentEhp))
|
|
|
|
|
|
|
+ self.minStatSlidList[8].SetValue(currentEhp)
|
|
|
|
|
+ self.minStatTextList[8].SetValue(str(currentEhp))
|
|
|
baseAtk = int(self.statGrid.GetCellValue(row=1, col=0))
|
|
baseAtk = int(self.statGrid.GetCellValue(row=1, col=0))
|
|
|
baseCrr = int(self.statGrid.GetCellValue(row=4, col=0).replace("%", ""))
|
|
baseCrr = int(self.statGrid.GetCellValue(row=4, col=0).replace("%", ""))
|
|
|
baseCrd = int(self.statGrid.GetCellValue(row=5, col=0).replace("%", ""))
|
|
baseCrd = int(self.statGrid.GetCellValue(row=5, col=0).replace("%", ""))
|
|
@@ -571,7 +639,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
((baseAtk + (baseAtk * baseCrd / 100)) * baseCrr / 100)
|
|
((baseAtk + (baseAtk * baseCrd / 100)) * baseCrr / 100)
|
|
|
)
|
|
)
|
|
|
self.statGrid.SetCellValue(row=9, col=0, s=str(baseDmg))
|
|
self.statGrid.SetCellValue(row=9, col=0, s=str(baseDmg))
|
|
|
- self.minStatSlid[9].SetMin(baseDmg)
|
|
|
|
|
|
|
+ self.minStatSlidList[9].SetMin(baseDmg)
|
|
|
currentAtk = int(self.statGrid.GetCellValue(row=1, col=1))
|
|
currentAtk = int(self.statGrid.GetCellValue(row=1, col=1))
|
|
|
currentCrr = \
|
|
currentCrr = \
|
|
|
int(self.statGrid.GetCellValue(row=4, col=0).replace("%", ""))
|
|
int(self.statGrid.GetCellValue(row=4, col=0).replace("%", ""))
|
|
@@ -585,12 +653,12 @@ class PanelOptimizer(wx.Panel):
|
|
|
((currentAtk + (currentAtk * currentCrd / 100)) * currentCrr / 100)
|
|
((currentAtk + (currentAtk * currentCrd / 100)) * currentCrr / 100)
|
|
|
)
|
|
)
|
|
|
self.statGrid.SetCellValue(row=9, col=1, s=str(currentDmg))
|
|
self.statGrid.SetCellValue(row=9, col=1, s=str(currentDmg))
|
|
|
- self.minStatSlid[9].SetValue(currentDmg)
|
|
|
|
|
- self.minStatText[9].SetValue(str(currentDmg))
|
|
|
|
|
|
|
+ self.minStatSlidList[9].SetValue(currentDmg)
|
|
|
|
|
+ self.minStatTextList[9].SetValue(str(currentDmg))
|
|
|
|
|
|
|
|
# Populate the runes
|
|
# Populate the runes
|
|
|
for i in range(0, 6):
|
|
for i in range(0, 6):
|
|
|
- self.runeList[i].SetLabel("")
|
|
|
|
|
|
|
+ self.runeLabelList[i].SetLabel("")
|
|
|
cursor = conn.execute("""
|
|
cursor = conn.execute("""
|
|
|
SELECT
|
|
SELECT
|
|
|
id, slot, type
|
|
id, slot, type
|
|
@@ -633,35 +701,35 @@ class PanelOptimizer(wx.Panel):
|
|
|
stat_names[rowStats[1]] + str(rowStats[2]).rjust(4) + ""
|
|
stat_names[rowStats[1]] + str(rowStats[2]).rjust(4) + ""
|
|
|
if rowStats[3] > 0:
|
|
if rowStats[3] > 0:
|
|
|
label = label + " +" + str(rowStats[3])
|
|
label = label + " +" + str(rowStats[3])
|
|
|
- self.runeList[i].SetLabel(label)
|
|
|
|
|
|
|
+ self.runeLabelList[i].SetLabel(label)
|
|
|
i = i + 1
|
|
i = i + 1
|
|
|
|
|
|
|
|
# Try to infer data to set the default options, reset the rest
|
|
# Try to infer data to set the default options, reset the rest
|
|
|
# Except the team list, rune level and storage: never reset those.
|
|
# Except the team list, rune level and storage: never reset those.
|
|
|
- self.stats[0].SetCheckedItems(())
|
|
|
|
|
|
|
+ self.statCheckListList[0].SetCheckedItems(())
|
|
|
for i in range(0, 3):
|
|
for i in range(0, 3):
|
|
|
if currEvenStats[i] == 1: # HP
|
|
if currEvenStats[i] == 1: # HP
|
|
|
- self.stats[0].Check(0, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(0, True)
|
|
|
elif currEvenStats[i] == 2: # HP%
|
|
elif currEvenStats[i] == 2: # HP%
|
|
|
- self.stats[0].Check(1, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(1, True)
|
|
|
elif currEvenStats[i] == 3: # ATK
|
|
elif currEvenStats[i] == 3: # ATK
|
|
|
- self.stats[0].Check(2, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(2, True)
|
|
|
elif currEvenStats[i] == 4: # ATK%
|
|
elif currEvenStats[i] == 4: # ATK%
|
|
|
- self.stats[0].Check(3, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(3, True)
|
|
|
elif currEvenStats[i] == 5: # DEF
|
|
elif currEvenStats[i] == 5: # DEF
|
|
|
- self.stats[0].Check(4, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(4, True)
|
|
|
elif currEvenStats[i] == 6: # DEF%
|
|
elif currEvenStats[i] == 6: # DEF%
|
|
|
- self.stats[0].Check(5, True)
|
|
|
|
|
|
|
+ self.statCheckListList[0].Check(5, True)
|
|
|
elif currEvenStats[i] == 8: # SPD
|
|
elif currEvenStats[i] == 8: # SPD
|
|
|
- self.stats[1].Check(0, True)
|
|
|
|
|
|
|
+ self.statCheckListList[1].Check(0, True)
|
|
|
elif currEvenStats[i] == 9: # CRR
|
|
elif currEvenStats[i] == 9: # CRR
|
|
|
- self.stats[1].Check(1, True)
|
|
|
|
|
|
|
+ self.statCheckListList[1].Check(1, True)
|
|
|
elif currEvenStats[i] == 10: # CRD
|
|
elif currEvenStats[i] == 10: # CRD
|
|
|
- self.stats[1].Check(2, True)
|
|
|
|
|
|
|
+ self.statCheckListList[1].Check(2, True)
|
|
|
elif currEvenStats[i] == 11: # RES
|
|
elif currEvenStats[i] == 11: # RES
|
|
|
- self.stats[1].Check(3, True)
|
|
|
|
|
|
|
+ self.statCheckListList[1].Check(3, True)
|
|
|
elif currEvenStats[i] == 12: # ACC
|
|
elif currEvenStats[i] == 12: # ACC
|
|
|
- self.stats[1].Check(4, True)
|
|
|
|
|
|
|
+ self.statCheckListList[1].Check(4, True)
|
|
|
currSetList = [-1, -1, -1]
|
|
currSetList = [-1, -1, -1]
|
|
|
j = 0
|
|
j = 0
|
|
|
for i in range(0, 23):
|
|
for i in range(0, 23):
|
|
@@ -679,16 +747,23 @@ class PanelOptimizer(wx.Panel):
|
|
|
currSetList[j] = i - 1
|
|
currSetList[j] = i - 1
|
|
|
j += 1
|
|
j += 1
|
|
|
# If a set of 4 has 4
|
|
# If a set of 4 has 4
|
|
|
- else:
|
|
|
|
|
|
|
+ elif i in [3, 5, 8, 10, 11, 13]:
|
|
|
if currSets[i] >= 4:
|
|
if currSets[i] >= 4:
|
|
|
currSetList[j] = i - 1
|
|
currSetList[j] = i - 1
|
|
|
j += 1
|
|
j += 1
|
|
|
|
|
+ # Rune set IDs 9 and 12 dont exist, so do a little trick with indexes.
|
|
|
for i in range(0, 3):
|
|
for i in range(0, 3):
|
|
|
- if currSetList[i] != -1:
|
|
|
|
|
- self.runeSets[i].SetSelection(currSetList[i])
|
|
|
|
|
|
|
+ #if currSetList[i] != 0:
|
|
|
|
|
+ actualId = currSetList[i] + 1
|
|
|
|
|
+ if (actualId > 8):
|
|
|
|
|
+ actualId -= 1
|
|
|
|
|
+ if (actualId > 11):
|
|
|
|
|
+ actualId -= 1
|
|
|
|
|
+ self.setChoiceList[i].SetSelection(actualId)
|
|
|
|
|
|
|
|
|
|
|
|
|
- self.optimizationOptions.ShowItems(True)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ self.optionsSizer.ShowItems(True)
|
|
|
|
|
|
|
|
def startOptimization(self, event):
|
|
def startOptimization(self, event):
|
|
|
"""Prepares and runs a command optimization.
|
|
"""Prepares and runs a command optimization.
|
|
@@ -708,7 +783,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
command = "RuneOptimizer optimize "
|
|
command = "RuneOptimizer optimize "
|
|
|
unitId = self.unitId
|
|
unitId = self.unitId
|
|
|
command += unitId
|
|
command += unitId
|
|
|
- level = self.level.GetSelection()
|
|
|
|
|
|
|
+ level = self.levelChoice.GetSelection()
|
|
|
if level == 1:
|
|
if level == 1:
|
|
|
level = "12"
|
|
level = "12"
|
|
|
elif level == 2:
|
|
elif level == 2:
|
|
@@ -719,8 +794,8 @@ class PanelOptimizer(wx.Panel):
|
|
|
#print(" Rune level: " + level)
|
|
#print(" Rune level: " + level)
|
|
|
sets = ""
|
|
sets = ""
|
|
|
for i in range (0, 2):
|
|
for i in range (0, 2):
|
|
|
- selected = self.runeSets[i].GetString(
|
|
|
|
|
- self.runeSets[i].GetSelection()
|
|
|
|
|
|
|
+ selected = self.setChoiceList[i].GetString(
|
|
|
|
|
+ self.setChoiceList[i].GetSelection()
|
|
|
).upper().replace(" ", "");
|
|
).upper().replace(" ", "");
|
|
|
for j in range(0, 22):
|
|
for j in range(0, 22):
|
|
|
name = set_names[j].upper()
|
|
name = set_names[j].upper()
|
|
@@ -734,8 +809,9 @@ class PanelOptimizer(wx.Panel):
|
|
|
command += (" --sets " + sets)
|
|
command += (" --sets " + sets)
|
|
|
stats = ""
|
|
stats = ""
|
|
|
selected_stats = \
|
|
selected_stats = \
|
|
|
- self.stats[0].GetCheckedItems() + self.stats[1].GetCheckedItems()
|
|
|
|
|
- for s in self.stats[0].GetCheckedItems():
|
|
|
|
|
|
|
+ self.statCheckListList[0].GetCheckedItems() + \
|
|
|
|
|
+ self.statCheckListList[1].GetCheckedItems()
|
|
|
|
|
+ for s in self.statCheckListList[0].GetCheckedItems():
|
|
|
if s == 0:
|
|
if s == 0:
|
|
|
stats += "hpflat,"
|
|
stats += "hpflat,"
|
|
|
elif s == 1:
|
|
elif s == 1:
|
|
@@ -748,7 +824,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
stats += "defflat,"
|
|
stats += "defflat,"
|
|
|
elif s == 5:
|
|
elif s == 5:
|
|
|
stats += "def,"
|
|
stats += "def,"
|
|
|
- for s in self.stats[1].GetCheckedItems():
|
|
|
|
|
|
|
+ for s in self.statCheckListList[1].GetCheckedItems():
|
|
|
if s == 0:
|
|
if s == 0:
|
|
|
stats += "spd,"
|
|
stats += "spd,"
|
|
|
elif s == 1:
|
|
elif s == 1:
|
|
@@ -765,35 +841,106 @@ class PanelOptimizer(wx.Panel):
|
|
|
command += (" --stats " + stats)
|
|
command += (" --stats " + stats)
|
|
|
#print(" Main stats: " + stats)
|
|
#print(" Main stats: " + stats)
|
|
|
|
|
|
|
|
- command += (" --min-hp " + str(self.minStatSlid[0].GetValue()))
|
|
|
|
|
- command += (" --min-atk " + str(self.minStatSlid[1].GetValue()))
|
|
|
|
|
- command += (" --min-def " + str(self.minStatSlid[2].GetValue()))
|
|
|
|
|
- command += (" --min-spd " + str(self.minStatSlid[3].GetValue()))
|
|
|
|
|
- command += (" --min-crr " + str(self.minStatSlid[4].GetValue()))
|
|
|
|
|
- command += (" --min-crd " + str(self.minStatSlid[5].GetValue()))
|
|
|
|
|
- command += (" --min-res " + str(self.minStatSlid[6].GetValue()))
|
|
|
|
|
- command += (" --min-acc " + str(self.minStatSlid[7].GetValue()))
|
|
|
|
|
- command += (" --min-ehp " + str(self.minStatSlid[8].GetValue()))
|
|
|
|
|
- command += (" --min-dmg " + str(self.minStatSlid[9].GetValue()))
|
|
|
|
|
-
|
|
|
|
|
- if self.inventory.GetValue():
|
|
|
|
|
|
|
+ command += (" --min-hp " + str(self.minStatSlidList[0].GetValue()))
|
|
|
|
|
+ command += (" --min-atk " + str(self.minStatSlidList[1].GetValue()))
|
|
|
|
|
+ command += (" --min-def " + str(self.minStatSlidList[2].GetValue()))
|
|
|
|
|
+ command += (" --min-spd " + str(self.minStatSlidList[3].GetValue()))
|
|
|
|
|
+ command += (" --min-crr " + str(self.minStatSlidList[4].GetValue()))
|
|
|
|
|
+ command += (" --min-crd " + str(self.minStatSlidList[5].GetValue()))
|
|
|
|
|
+ command += (" --min-res " + str(self.minStatSlidList[6].GetValue()))
|
|
|
|
|
+ command += (" --min-acc " + str(self.minStatSlidList[7].GetValue()))
|
|
|
|
|
+ command += (" --min-ehp " + str(self.minStatSlidList[8].GetValue()))
|
|
|
|
|
+ command += (" --min-dmg " + str(self.minStatSlidList[9].GetValue()))
|
|
|
|
|
+
|
|
|
|
|
+ if self.inventoryCheck.GetValue():
|
|
|
command += " --storage"
|
|
command += " --storage"
|
|
|
- if len(self.teams.GetCheckedItems()) > 0:
|
|
|
|
|
|
|
+ if len(self.teamCheckList.GetCheckedItems()) > 0:
|
|
|
command += " --no-teams "
|
|
command += " --no-teams "
|
|
|
- for team in self.teams.GetCheckedItems():
|
|
|
|
|
|
|
+ for team in self.teamCheckList.GetCheckedItems():
|
|
|
command += str(self.teamIds[team]) + ","
|
|
command += str(self.teamIds[team]) + ","
|
|
|
command = command[:-1]
|
|
command = command[:-1]
|
|
|
|
|
|
|
|
|
|
|
|
|
command += (" --gui ")
|
|
command += (" --gui ")
|
|
|
- command = os.path.dirname(os.path.realpath(__file__)) + "/../../" + command
|
|
|
|
|
|
|
+ command = \
|
|
|
|
|
+ os.path.dirname(os.path.realpath(__file__)) + "/../../" + command
|
|
|
print("Command: " + command)
|
|
print("Command: " + command)
|
|
|
|
|
|
|
|
- out = subprocess.check_output(command.split())
|
|
|
|
|
- json = bytes.decode(out)
|
|
|
|
|
|
|
+ self.progressGauge.SetValue(0)
|
|
|
|
|
+
|
|
|
|
|
+ # Timer ot periodically check on the process
|
|
|
|
|
+ self.timer = wx.Timer(self)
|
|
|
|
|
+ self.timer.Start(1000)
|
|
|
|
|
+ self.Bind(wx.EVT_TIMER, self.checkProcess)
|
|
|
|
|
+
|
|
|
|
|
+ # Create and execute the process
|
|
|
|
|
+ self.Bind(wx.EVT_END_PROCESS, self.optimizationComplete)
|
|
|
|
|
+ #print("Command: " + command)
|
|
|
|
|
+ self.process = wx.Process(self)
|
|
|
|
|
+ self.process.Redirect()
|
|
|
|
|
+ wx.Execute(command, wx.EXEC_ASYNC, self.process)
|
|
|
|
|
+
|
|
|
|
|
+ def checkProcess(self, event):
|
|
|
|
|
+ """Checks the process output and updates progress bar.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call.
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+ if self.process is not None:
|
|
|
|
|
+ stream = self.process.GetInputStream()
|
|
|
|
|
+ if stream.CanRead():
|
|
|
|
|
+ text = bytes.decode(stream.read())
|
|
|
|
|
+ text = text[:-1] # Remove the last newline
|
|
|
|
|
+
|
|
|
|
|
+ # Get only the last line
|
|
|
|
|
+ if text.rfind("\n") != -1:
|
|
|
|
|
+ text = text[text.rfind("\n") + 1:]
|
|
|
|
|
+
|
|
|
|
|
+ # If the line is just a number, it's a progress indicator (1-20)
|
|
|
|
|
+ if text.isnumeric() and int(text) <= 20:
|
|
|
|
|
+ self.progressGauge.SetValue(int(text))
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.timer.Stop()
|
|
|
|
|
+
|
|
|
|
|
+ def optimizationComplete(self, event):
|
|
|
|
|
+ """Called when the update process is complete.
|
|
|
|
|
+
|
|
|
|
|
+ Hiddes the progress image, checks for errors in the output, prints a
|
|
|
|
|
+ message annd sets self.updateDone and self.updateError.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call.
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ self.timer.Stop()
|
|
|
|
|
+ self.progressGauge.SetValue(20)
|
|
|
|
|
+
|
|
|
|
|
+ stream = self.process.GetInputStream()
|
|
|
|
|
+ jsonText = ""
|
|
|
|
|
+
|
|
|
|
|
+ if stream.CanRead():
|
|
|
|
|
+ text = bytes.decode(stream.read())
|
|
|
|
|
+ text = text[:-1] # Remove the last newline
|
|
|
|
|
+
|
|
|
|
|
+ # Get only the last line
|
|
|
|
|
+ if text.rfind("\n") != -1:
|
|
|
|
|
+ text = text[text.rfind("\n") + 1:]
|
|
|
|
|
+
|
|
|
|
|
+ jsonText = text
|
|
|
|
|
+
|
|
|
|
|
+ print('Finished. Result:\n' + text)
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
# DEBUG: Sample data.
|
|
# DEBUG: Sample data.
|
|
|
#self.unitId = "7223811472"
|
|
#self.unitId = "7223811472"
|
|
|
- #json = """{"result_count":5000,"results":[
|
|
|
|
|
|
|
+ #json = ""{"result_count":5000,"results":[
|
|
|
# {"id":0,"rating":215,"hp":20461,"atk":2521,"dfc":845,"spd":137,"crr":63,"crd":167,"res":29,"acc":15,"ehp":83839,"dmg":5174,"runes":["22677809846","22920616295","21755980400","25633344349","26207902579","28512560500"]},
|
|
# {"id":0,"rating":215,"hp":20461,"atk":2521,"dfc":845,"spd":137,"crr":63,"crd":167,"res":29,"acc":15,"ehp":83839,"dmg":5174,"runes":["22677809846","22920616295","21755980400","25633344349","26207902579","28512560500"]},
|
|
|
# {"id":1,"rating":195,"hp":18876,"atk":2521,"dfc":853,"spd":137,"crr":60,"crd":174,"res":37,"acc":8,"ehp":77873,"dmg":5153,"runes":["22677809846","22920616295","27654723287","25633344349","26207902579","28512560500"]},
|
|
# {"id":1,"rating":195,"hp":18876,"atk":2521,"dfc":853,"spd":137,"crr":60,"crd":174,"res":37,"acc":8,"ehp":77873,"dmg":5153,"runes":["22677809846","22920616295","27654723287","25633344349","26207902579","28512560500"]},
|
|
|
# {"id":2,"rating":185,"hp":17730,"atk":2521,"dfc":862,"spd":147,"crr":60,"crd":164,"res":28,"acc":15,"ehp":73704,"dmg":5002,"runes":["21564691276","22920616295","27654723287","25633344349","26207902579","22348038576"]},
|
|
# {"id":2,"rating":185,"hp":17730,"atk":2521,"dfc":862,"spd":147,"crr":60,"crd":164,"res":28,"acc":15,"ehp":73704,"dmg":5002,"runes":["21564691276","22920616295","27654723287","25633344349","26207902579","22348038576"]},
|
|
@@ -801,13 +948,32 @@ class PanelOptimizer(wx.Panel):
|
|
|
# {"id":4,"rating":176,"hp":15319,"atk":2530,"dfc":909,"spd":142,"crr":60,"crd":165,"res":28,"acc":15,"ehp":66202,"dmg":5035,"runes":["21564691276","16759622995","27654723287","22750814840","26207902579","22348038576"]}]}
|
|
# {"id":4,"rating":176,"hp":15319,"atk":2530,"dfc":909,"spd":142,"crr":60,"crd":165,"res":28,"acc":15,"ehp":66202,"dmg":5035,"runes":["21564691276","16759622995","27654723287","22750814840","26207902579","22348038576"]}]}
|
|
|
#"""
|
|
#"""
|
|
|
|
|
|
|
|
|
|
+ print ("---- RESULT OUTPUT -------------------------------------------")
|
|
|
|
|
+ print(jsonText)
|
|
|
|
|
+ print ("--------------------------------------------------------------")
|
|
|
|
|
|
|
|
- print ("---- OUTPUT ------------------------------------------------------------------------------------------")
|
|
|
|
|
- print(json)
|
|
|
|
|
- print ("------------------------------------------------------------------------------------------------------")
|
|
|
|
|
-
|
|
|
|
|
- self.GetParent().frameResults.processResults(self.unitId, json)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if jsonText != "":
|
|
|
|
|
+ data = json.loads(
|
|
|
|
|
+ jsonText,
|
|
|
|
|
+ object_hook=lambda d: SimpleNamespace(**d)
|
|
|
|
|
+ )
|
|
|
|
|
+ if data.result_count == 0:
|
|
|
|
|
+ wx.MessageBox(
|
|
|
|
|
+ parent=self,
|
|
|
|
|
+ message="No results found for the current settings.",
|
|
|
|
|
+ caption="No results found"
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.GetParent().frameResults.processResults(
|
|
|
|
|
+ self.unitId, jsonText
|
|
|
|
|
+ )
|
|
|
|
|
+ self.GetParent().ChangeSelection(3)
|
|
|
|
|
+ else:
|
|
|
|
|
+ wx.MessageBox(
|
|
|
|
|
+ parent=self,
|
|
|
|
|
+ message="No data received from RuneOptimizer.",
|
|
|
|
|
+ caption="Error"
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def minStatChangeBySlider(self, event):
|
|
def minStatChangeBySlider(self, event):
|
|
|
"""Changes text when a slider is changed.
|
|
"""Changes text when a slider is changed.
|
|
@@ -822,7 +988,7 @@ class PanelOptimizer(wx.Panel):
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
slidId = int(event.GetEventObject().GetName().replace("slid", ""))
|
|
slidId = int(event.GetEventObject().GetName().replace("slid", ""))
|
|
|
- self.minStatText[slidId].SetValue(
|
|
|
|
|
|
|
+ self.minStatTextList[slidId].SetValue(
|
|
|
str(event.GetEventObject().GetValue())
|
|
str(event.GetEventObject().GetValue())
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -840,15 +1006,15 @@ class PanelOptimizer(wx.Panel):
|
|
|
textId = int(event.GetEventObject().GetName().replace("tx", ""))
|
|
textId = int(event.GetEventObject().GetName().replace("tx", ""))
|
|
|
if event.GetEventObject().GetValue().isdigit() == False:
|
|
if event.GetEventObject().GetValue().isdigit() == False:
|
|
|
event.GetEventObject().SetValue(
|
|
event.GetEventObject().SetValue(
|
|
|
- str(self.minStatSlid[textId].GetValue())
|
|
|
|
|
|
|
+ str(self.minStatSlidList[textId].GetValue())
|
|
|
)
|
|
)
|
|
|
value = int(event.GetEventObject().GetValue())
|
|
value = int(event.GetEventObject().GetValue())
|
|
|
- minValue = self.minStatSlid[textId].GetMin()
|
|
|
|
|
- maxValue = self.minStatSlid[textId].GetMax()
|
|
|
|
|
|
|
+ minValue = self.minStatSlidList[textId].GetMin()
|
|
|
|
|
+ maxValue = self.minStatSlidList[textId].GetMax()
|
|
|
if value < minValue:
|
|
if value < minValue:
|
|
|
value = minValue
|
|
value = minValue
|
|
|
event.GetEventObject().SetValue(str(value))
|
|
event.GetEventObject().SetValue(str(value))
|
|
|
elif value > maxValue:
|
|
elif value > maxValue:
|
|
|
value = maxValue
|
|
value = maxValue
|
|
|
event.GetEventObject().SetValue(str(value))
|
|
event.GetEventObject().SetValue(str(value))
|
|
|
- self.minStatSlid[textId].SetValue(value)
|
|
|
|
|
|
|
+ self.minStatSlidList[textId].SetValue(value)
|