|
@@ -0,0 +1,1076 @@
|
|
|
|
|
+"""
|
|
|
|
|
+This file is part of RuneOptimizer.
|
|
|
|
|
+
|
|
|
|
|
+RuneOptimizer 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.
|
|
|
|
|
+
|
|
|
|
|
+RuneOptimizer 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
|
|
|
|
|
+RuneOptimizer. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
+
|
|
|
|
|
+"""
|
|
|
|
|
+
|
|
|
|
|
+class PanelResults(wx.Panel):
|
|
|
|
|
+ """
|
|
|
|
|
+ The panel that shows results.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ unitId : str
|
|
|
|
|
+ ID of the unit being optimized (default "").
|
|
|
|
|
+ unitName : str
|
|
|
|
|
+ Name of the unit being optimized (default "").
|
|
|
|
|
+ data : Python Object
|
|
|
|
|
+ Results from RuneOptimizer (default None).
|
|
|
|
|
+ currentStats : int[10]
|
|
|
|
|
+ The current stats of the unit being optimized. (default is
|
|
|
|
|
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).
|
|
|
|
|
+ page : int
|
|
|
|
|
+ Currently displayed page, 0-index (default 0).
|
|
|
|
|
+ totalPages : int
|
|
|
|
|
+ Number of pages of results (default 0).
|
|
|
|
|
+ linesPerPage : int
|
|
|
|
|
+ Number of results to show per page (default 10).
|
|
|
|
|
+ pgPrevBt : wx.Button
|
|
|
|
|
+ Button to go to the previous page.
|
|
|
|
|
+ pgPrevBt : wx.Button
|
|
|
|
|
+ Button to go to the previous page.
|
|
|
|
|
+ resultsPageIndicator : wx.StaticText
|
|
|
|
|
+ Label to indicate the current and maximum pages.
|
|
|
|
|
+ resultGrid : wx.Grid.grid
|
|
|
|
|
+ Table of results.
|
|
|
|
|
+ resultContent : wx.BoxSizer
|
|
|
|
|
+ Holds every widget that is hidden until a result is selected.
|
|
|
|
|
+ statGrid : wx.Grid.grid
|
|
|
|
|
+ Table to show the new stats with the selected result.
|
|
|
|
|
+ runeIds : wx.StaticText[6]
|
|
|
|
|
+ Labels with the IDs of the runes in the current result.
|
|
|
|
|
+ runeLocations : wx.StaticText[6]
|
|
|
|
|
+ Labels with the locations of the runes in the current result.
|
|
|
|
|
+ runeSets : wx.StaticText[6]
|
|
|
|
|
+ Labels with the set names of the runes in the current result.
|
|
|
|
|
+ runeMains : wx.StaticText[6]
|
|
|
|
|
+ Labels with the main stats of the runes in the current result.
|
|
|
|
|
+ runeInnates : wx.StaticText[6]
|
|
|
|
|
+ Labels with the innates of the runes in the current result.
|
|
|
|
|
+ runeStats : wx.StaticText[6][4]
|
|
|
|
|
+ Labels with the stats of the runes in the current result.
|
|
|
|
|
+ selectedResultndex : int
|
|
|
|
|
+ Selected result index (default -1).
|
|
|
|
|
+
|
|
|
|
|
+ Methods
|
|
|
|
|
+ -------
|
|
|
|
|
+ processResults(jsonData)
|
|
|
|
|
+ Processes data obtained from RuneOptimizer.
|
|
|
|
|
+ pgPrev(event)
|
|
|
|
|
+ Goes to the previous result page.
|
|
|
|
|
+ pgNext(event)
|
|
|
|
|
+ Goes to the next result page.
|
|
|
|
|
+ closeWindow(event)
|
|
|
|
|
+ Closes the frame.
|
|
|
|
|
+ applyRunes(event)
|
|
|
|
|
+ Applies the runes in the currently selected result.
|
|
|
|
|
+ printResults()
|
|
|
|
|
+ Populates the results table with the results in the currently
|
|
|
|
|
+ selected page.
|
|
|
|
|
+ resultSelected(event)
|
|
|
|
|
+ Populates and shows the runes and effective stats with the
|
|
|
|
|
+ currently seleced result.
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ unitId = ""
|
|
|
|
|
+ unitName = ""
|
|
|
|
|
+ data = None
|
|
|
|
|
+ currentStats = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
|
|
|
+ page = 0
|
|
|
|
|
+ totalPages = 0
|
|
|
|
|
+ linesPerPage = 10
|
|
|
|
|
+ pgPrevBt = None
|
|
|
|
|
+ pgNextBt = None
|
|
|
|
|
+ resultsPageIndicator = None
|
|
|
|
|
+ resultGrid = None
|
|
|
|
|
+ resultContent = None
|
|
|
|
|
+ statGrid = None
|
|
|
|
|
+ runeIds = None
|
|
|
|
|
+ runeLocations = None
|
|
|
|
|
+ runeSets = None
|
|
|
|
|
+ runeMains = None
|
|
|
|
|
+ runeInnates = None
|
|
|
|
|
+ runeStats = None
|
|
|
|
|
+ selectedResultIndex = -1
|
|
|
|
|
+
|
|
|
|
|
+ def __init__(self, parent, id=wx.ID_ANY):
|
|
|
|
|
+ """Initializes the panel.
|
|
|
|
|
+
|
|
|
|
|
+ Sets upt all the widgets.
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ # Parent constructor
|
|
|
|
|
+ wx.Panel.__init__(self, parent=parent, id=id)
|
|
|
|
|
+
|
|
|
|
|
+ # Prepare some fonts
|
|
|
|
|
+ monospaceFont = wx.Font(
|
|
|
|
|
+ pointSize=10, family=wx.FONTFAMILY_TELETYPE,
|
|
|
|
|
+ style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
|
|
|
|
|
+ )
|
|
|
|
|
+ monospaceFontBold = wx.Font(
|
|
|
|
|
+ pointSize=8, family=wx.FONTFAMILY_TELETYPE,
|
|
|
|
|
+ style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
|
|
|
|
|
+ )
|
|
|
|
|
+ monospaceFontItalic = wx.Font(
|
|
|
|
|
+ pointSize=8, family=wx.FONTFAMILY_TELETYPE,
|
|
|
|
|
+ style=wx.FONTSTYLE_ITALIC, weight=wx.FONTWEIGHT_NORMAL
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # The result list table
|
|
|
|
|
+ self.resultGrid = wx.grid.Grid(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, pos=(50, 30), size=(544, 220)
|
|
|
|
|
+ )
|
|
|
|
|
+ self.resultGrid.CreateGrid(
|
|
|
|
|
+ numRows=10, numCols=11,
|
|
|
|
|
+ selmode=wx.grid.Grid.GridSelectionModes.SelectRows
|
|
|
|
|
+ )
|
|
|
|
|
+ self.resultGrid.EnableEditing(False)
|
|
|
|
|
+ self.resultGrid.SetDefaultCellAlignment(
|
|
|
|
|
+ horiz=wx.ALIGN_RIGHT, vert=wx.ALIGN_CENTRE
|
|
|
|
|
+ )
|
|
|
|
|
+ self.resultGrid.SetDefaultCellFont(monospaceFont)
|
|
|
|
|
+ self.resultGrid.SetRowLabelSize(width=35)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=0, value="Rating")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=0, width=50)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=1, value="HP")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=1, width=50)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=2, value="ATK")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=2, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=3, value="DEF")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=3, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=4, value="SPD")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=4, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=5, value="CRR")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=5, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=6, value="CRD")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=6, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=7, value="RES")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=7, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=8, value="ACC")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=8, width=40)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=9, value="EHP")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=9, width=60)
|
|
|
|
|
+ self.resultGrid.SetColLabelValue(col=10, value="DMG")
|
|
|
|
|
+ self.resultGrid.SetColSize(col=10, width=50)
|
|
|
|
|
+ self.resultGrid.SetColLabelSize(height=20)
|
|
|
|
|
+ self.resultGrid.SetDefaultRowSize(height=20)
|
|
|
|
|
+ self.Bind(
|
|
|
|
|
+ wx.grid.EVT_GRID_SELECT_CELL, self.resultSelected, self.resultGrid
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # Paginator
|
|
|
|
|
+ self.pgPrevBt = wx.Button(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, pos=(580, 30), size=(40, 50),
|
|
|
|
|
+ style=wx.LC_REPORT, label="Prev\npage"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.resultsPageIndicator = wx.StaticText(
|
|
|
|
|
+ parent=self,id=wx.ID_ANY, pos=(580, 80), size=(40, 15),
|
|
|
|
|
+ style=wx.ALIGN_CENTRE_HORIZONTAL, label="1/1"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.pgNextBt = wx.Button(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, pos=(580, 100), size=(40, 50),
|
|
|
|
|
+ style=wx.LC_REPORT, label="Next\npage"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.Bind(wx.EVT_BUTTON, self.pgPrev, self.pgPrevBt)
|
|
|
|
|
+ self.Bind(wx.EVT_BUTTON, self.pgNext, self.pgNextBt)
|
|
|
|
|
+
|
|
|
|
|
+ # Contains all thigs to be shown once a result is selected
|
|
|
|
|
+ self.resultContent = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
+
|
|
|
|
|
+ # Stats table
|
|
|
|
|
+ self.statGrid = wx.grid.Grid(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, pos=(650, 30),
|
|
|
|
|
+ size=(205, 220), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.CreateGrid(
|
|
|
|
|
+ numRows=10, numCols=2,
|
|
|
|
|
+ selmode=wx.grid.Grid.GridSelectionModes.SelectRowsOrColumns
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.EnableEditing(False)
|
|
|
|
|
+ self.statGrid.SetDefaultCellAlignment(
|
|
|
|
|
+ horiz=wx.ALIGN_RIGHT, vert=wx.ALIGN_CENTRE
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetDefaultCellFont(monospaceFont)
|
|
|
|
|
+ self.statGrid.SetColSize(col=0, width=70)
|
|
|
|
|
+ self.statGrid.SetColLabelValue(col=0, value="Value")
|
|
|
|
|
+ self.statGrid.SetColLabelValue(col=1, value="Diff")
|
|
|
|
|
+ self.statGrid.SetRowLabelSize(width=35)
|
|
|
|
|
+ self.statGrid.SetColLabelSize(height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=0, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=1, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=2, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=3, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=4, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=5, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=6, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=7, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=8, height=20)
|
|
|
|
|
+ self.statGrid.SetRowSize(row=9, height=20)
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=0, value=" HP")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=1, value="ATK")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=2, value="DEF")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=3, value="SPD")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=4, value="CRR")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=5, value="CRD")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=6, value="RES")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=7, value="ACC")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=8, value="EHP")
|
|
|
|
|
+ self.statGrid.SetRowLabelValue(row=9, value="DMG")
|
|
|
|
|
+ self.resultContent.Add(self.statGrid)
|
|
|
|
|
+
|
|
|
|
|
+ #Rune set list
|
|
|
|
|
+ monospaceFont.PointSize -= 2
|
|
|
|
|
+ runeListBox = [
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot1:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(200, 255), size=(140, 160)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot2:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(350, 255), size=(140, 160)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot3:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(350, 420), size=(140, 160)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot4:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(200, 420), size=(140, 160)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot5:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(50, 420), size=(140, 160)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticBox(
|
|
|
|
|
+ parent=self, label="Slot6:",id=wx.ID_ANY,
|
|
|
|
|
+ pos=(50, 255), size=(140, 160)
|
|
|
|
|
+ )
|
|
|
|
|
+ ]
|
|
|
|
|
+ for i in range(0, 6):
|
|
|
|
|
+ runeListBox[i].SetFont(monospaceFont)
|
|
|
|
|
+ self.resultContent.Add(runeListBox[i])
|
|
|
|
|
+
|
|
|
|
|
+ self.runeIds = [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[0], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[1], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[2], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[3], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[4], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[5], id=wx.ID_ANY, label="", pos=(5, 0), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ self.runeLocations = [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[0], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[1], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[2], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[3], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[4], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[5], id=wx.ID_ANY, label="", pos=(5, 15), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ self.runeSets = [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[0], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[1], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[2], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[3], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[4], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ runeListBox[5], id=wx.ID_ANY, label="", pos=(5, 30), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+ wx.StaticLine(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY,
|
|
|
|
|
+ pos=(5, 45), size=(130, 1), style=wx.LC_REPORT
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ self.runeMains = [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 50), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]
|
|
|
|
|
+ for i in range(0, 6):
|
|
|
|
|
+ self.runeMains[i].SetFont(monospaceFontBold)
|
|
|
|
|
+
|
|
|
|
|
+ self.runeInnates = [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 65), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ]
|
|
|
|
|
+ for i in range(0, 6):
|
|
|
|
|
+ self.runeInnates[i].SetFont(monospaceFontItalic)
|
|
|
|
|
+
|
|
|
|
|
+ self.runeStats = [
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[0], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[1], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[2], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[3], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[4], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ [
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 80), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 95), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 110), size=(120, 10)
|
|
|
|
|
+ ),
|
|
|
|
|
+ wx.StaticText(
|
|
|
|
|
+ parent=runeListBox[5], id=wx.ID_ANY, label="",
|
|
|
|
|
+ pos=(5, 125), size=(120, 10)
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ # Action buttons
|
|
|
|
|
+ applyBt = wx.Button(
|
|
|
|
|
+ parent=self, id=wx.ID_ANY, pos=(650, 330), size=(165, 60),
|
|
|
|
|
+ style=wx.LC_REPORT, label="Apply runes"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.Bind(wx.EVT_BUTTON, self.applyRunes, applyBt)
|
|
|
|
|
+ self.resultContent.Add(applyBt)
|
|
|
|
|
+
|
|
|
|
|
+ # By default, hide everything
|
|
|
|
|
+ self.resultContent.ShowItems(False)
|
|
|
|
|
+
|
|
|
|
|
+ def processResults(self, jsonData):
|
|
|
|
|
+ """Processes data obtained from RuneOptimizer.
|
|
|
|
|
+
|
|
|
|
|
+ Reads the JSON data and initializes the property data.
|
|
|
|
|
+ Automatically calls printResults();
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ jsonData : str
|
|
|
|
|
+ The data, as received from RuneOptimizer.
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ self.data = json.loads(
|
|
|
|
|
+ jsonData,
|
|
|
|
|
+ object_hook=lambda d: SimpleNamespace(**d)
|
|
|
|
|
+ )
|
|
|
|
|
+ self.totalPages = math.ceil(len(self.data.results) / self.linesPerPage)
|
|
|
|
|
+ self.printResults()
|
|
|
|
|
+
|
|
|
|
|
+ def pgPrev(self, event):
|
|
|
|
|
+ """Goes to the previous page of results.
|
|
|
|
|
+
|
|
|
|
|
+ Checks if there is a previous page to go to. If so, it
|
|
|
|
|
+ automatically calls printResults();
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ if self.page > 0:
|
|
|
|
|
+ self.page -= 1
|
|
|
|
|
+ self.printResults()
|
|
|
|
|
+
|
|
|
|
|
+ def pgNext(self, event):
|
|
|
|
|
+ """Goes to the next page of results.
|
|
|
|
|
+
|
|
|
|
|
+ Checks if there is a next page to go to. If so, it
|
|
|
|
|
+ automatically calls printResults();
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ if self.page < self.totalPages:
|
|
|
|
|
+ self.page += 1
|
|
|
|
|
+ self.printResults()
|
|
|
|
|
+
|
|
|
|
|
+ def closeWindow(self, event):
|
|
|
|
|
+ """Closes the window.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ self.Close(True)
|
|
|
|
|
+
|
|
|
|
|
+ def applyRunes(self, event):
|
|
|
|
|
+ """Applies the selected results and saves data to the database.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ global conn
|
|
|
|
|
+
|
|
|
|
|
+ if (self.selectedResultIndex < 0):
|
|
|
|
|
+ # TODO: Show error
|
|
|
|
|
+ return;
|
|
|
|
|
+ print("self.selectedResultIndex: " + str(self.selectedResultIndex))
|
|
|
|
|
+ for i in range(0, 6):
|
|
|
|
|
+ print(self.data.results[self.selectedResultIndex].runes[i])
|
|
|
|
|
+ # First, unassign all runes currently assigned to the unit
|
|
|
|
|
+ cursor = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ UPDATE runes SET unit = null
|
|
|
|
|
+ WHERE unit = ?
|
|
|
|
|
+ """,
|
|
|
|
|
+ (
|
|
|
|
|
+ self.unitId,
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # Next, mark units as modified
|
|
|
|
|
+ cursor = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ UPDATE units SET modified = 1
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ id = ? OR
|
|
|
|
|
+ id IN (SELECT unit FROM runes WHERE id IN (?, ?, ?, ?, ?, ?))
|
|
|
|
|
+ """,
|
|
|
|
|
+ (
|
|
|
|
|
+ self.unitId,
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[0],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[1],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[2],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[3],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[4],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[5]
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # Lastly, assign the runes
|
|
|
|
|
+ cursor = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ UPDATE runes SET unit = ?
|
|
|
|
|
+ WHERE id IN (?, ?, ?, ?, ?, ?)
|
|
|
|
|
+ """,
|
|
|
|
|
+ (
|
|
|
|
|
+ self.unitId,
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[0],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[1],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[2],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[3],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[4],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[5]
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ conn.commit()
|
|
|
|
|
+ # TODO: Recalculate all modified units stats from the database
|
|
|
|
|
+ print("Applied!")
|
|
|
|
|
+ recalculteStatsOfModifiedUnits()
|
|
|
|
|
+ print("All recalculated!")
|
|
|
|
|
+
|
|
|
|
|
+ # Fetch the new values for self.currentStats
|
|
|
|
|
+ cursor = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ current_hp,
|
|
|
|
|
+ current_atk,
|
|
|
|
|
+ current_def,
|
|
|
|
|
+ current_spd,
|
|
|
|
|
+ current_crr,
|
|
|
|
|
+ current_crd,
|
|
|
|
|
+ current_res,
|
|
|
|
|
+ current_acc
|
|
|
|
|
+ FROM units
|
|
|
|
|
+ WHERE id = ?
|
|
|
|
|
+ """,
|
|
|
|
|
+ (
|
|
|
|
|
+ self.unitId,
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ row = cursor.fetchone()
|
|
|
|
|
+ for i in range(0, 8):
|
|
|
|
|
+ self.currentStats[i] = int(row[i])
|
|
|
|
|
+ self.currentStats[9] = math.ceil(
|
|
|
|
|
+ (((self.currentStats[2] * 3.5) + 1140) * self.currentStats[0]) / 1000
|
|
|
|
|
+ )
|
|
|
|
|
+ self.currentStats[10] = math.ceil(
|
|
|
|
|
+ (self.currentStats[1] * (100 - self.currentStats[4]) / 100) +
|
|
|
|
|
+ (
|
|
|
|
|
+ (
|
|
|
|
|
+ self.currentStats[1] +
|
|
|
|
|
+ (self.currentStats[1] * self.currentStats[5] / 100)
|
|
|
|
|
+ ) *
|
|
|
|
|
+ self.currentStats[4] / 100
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ self.resultSelected(None)
|
|
|
|
|
+
|
|
|
|
|
+ def printResults(self):
|
|
|
|
|
+ """Populates the results table with the results in the
|
|
|
|
|
+ currently selected page.
|
|
|
|
|
+
|
|
|
|
|
+ It doesn't change the selcted result. Automaticcaly called
|
|
|
|
|
+ after changing pages or processing data.
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ self.pgPrevBt.Enable(True)
|
|
|
|
|
+ self.pgNextBt.Enable(True)
|
|
|
|
|
+ if self.totalPages == 1:
|
|
|
|
|
+ self.pgPrevBt.Enable(False)
|
|
|
|
|
+ self.pgNextBt.Enable(False)
|
|
|
|
|
+ elif self.page == 0:
|
|
|
|
|
+ self.pgPrevBt.Enable(False)
|
|
|
|
|
+ elif self.page + 1 == self.totalPages:
|
|
|
|
|
+ self.pgNextBt.Enable(False)
|
|
|
|
|
+ self.resultsPageIndicator.SetLabel(
|
|
|
|
|
+ str(self.page + 1) + "/" + str(self.totalPages)
|
|
|
|
|
+ )
|
|
|
|
|
+ for i in range(0, 10):
|
|
|
|
|
+ rindex = i + (self.linesPerPage * self.page)
|
|
|
|
|
+ if (len(self.data.results) > rindex):
|
|
|
|
|
+ self.resultGrid.SetRowLabelValue(row=i, value=str(rindex + 1))
|
|
|
|
|
+ result = self.data.results[rindex]
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=0, s=str(result.rating))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=1, s=str(result.hp))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=2, s=str(result.atk))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=3, s=str(result.dfc))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=4, s=str(result.spd))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=5, s=str(result.crr))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=6, s=str(result.crd))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=7, s=str(result.res))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=8, s=str(result.acc))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=9, s=str(result.ehp))
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=10, s=str(result.dmg))
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.resultGrid.SetRowLabelValue(row=i, value="")
|
|
|
|
|
+ for j in range(0, 11):
|
|
|
|
|
+ self.resultGrid.SetCellValue(row=i, col=j, s="")
|
|
|
|
|
+
|
|
|
|
|
+ def resultSelected(self, event):
|
|
|
|
|
+ """Populates and shows the runes and effective stats with the
|
|
|
|
|
+ currently seleced result.
|
|
|
|
|
+
|
|
|
|
|
+ It also enables the apply button.
|
|
|
|
|
+
|
|
|
|
|
+ Parameters
|
|
|
|
|
+ ----------
|
|
|
|
|
+ event : wxEvent, optional
|
|
|
|
|
+ The event that triggered the call (default is None).
|
|
|
|
|
+
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ selectedLine = self.resultGrid.GetSelectedRows()[0]
|
|
|
|
|
+ self.selectedResultIndex = selectedLine + (self.linesPerPage * self.page)
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=0, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].hp) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].hp - self.currentStats[0]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=0, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=0, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=0, col=1, s="+ " + str(diff) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=0, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=0, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=1, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].atk) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].atk - self.currentStats[1]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=1, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=1, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(row=1, col=1, s="+ " + str(diff) + " ")
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=1, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=1, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=2, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].dfc) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].atk - self.currentStats[2]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=2, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=1, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=2, col=1, s="+ " + str(diff) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=2, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=2, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=3, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].spd) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].spd - self.currentStats[3]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=3, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=3, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=3, col=1, s="+ " + str(diff) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=3, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=3, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=4, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].crr) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].crr - self.currentStats[4]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=4, col=1, s="- " + str(abs(diff)) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=4, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(row=4, col=1, s="+ " + str(diff) + "%")
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=4, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=4, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=5, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].crd) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].crd - self.currentStats[5]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=5, col=1, s="- " + str(abs(diff)) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=5, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=5, col=1, s="+ " + str(diff) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=5, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=5, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=6, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].res) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].res - self.currentStats[6]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=6, col=1, s="- " + str(abs(diff)) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=6, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(row=6, col=1, s="+ " + str(diff) + "%")
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=6, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=6, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=7, col=0, s=str(self.data.results[self.selectedResultIndex].acc) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].acc - self.currentStats[7]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=7, col=1, s="- " + str(abs(diff)) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=7, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=7, col=1, s="+ " + str(diff) + "%"
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=7, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=7, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=8, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].ehp) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = \
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].ehp - self.currentStats[8]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=8, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=8, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=8, col=1, s="+ " + str(diff) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=8, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=8, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=9, col=0,
|
|
|
|
|
+ s=str(self.data.results[self.selectedResultIndex].dmg) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ diff = self.data.results[self.selectedResultIndex].dmg - self.currentStats[9]
|
|
|
|
|
+ if (diff < 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(
|
|
|
|
|
+ row=9, col=1, s="- " + str(abs(diff)) + " "
|
|
|
|
|
+ )
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=9, col=1, colour=wx.Colour(red=255, green=0, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ elif (diff > 0):
|
|
|
|
|
+ self.statGrid.SetCellValue(row=9, col=1, s="+ " + str(diff) + " ")
|
|
|
|
|
+ self.statGrid.SetCellTextColour(
|
|
|
|
|
+ row=9, col=1, colour=wx.Colour(red=0, green=255, blue=0)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.statGrid.SetCellValue(row=9, col=1, s="")
|
|
|
|
|
+
|
|
|
|
|
+ self.resultContent.ShowItems(True)
|
|
|
|
|
+
|
|
|
|
|
+ # Clean the runes
|
|
|
|
|
+ for i in range(0, 5):
|
|
|
|
|
+ self.runeIds[i].SetLabel("")
|
|
|
|
|
+ self.runeLocations[i].SetLabel("")
|
|
|
|
|
+ self.runeSets[i].SetLabel("")
|
|
|
|
|
+ self.runeMains[i].SetLabel("")
|
|
|
|
|
+ self.runeInnates[i].SetLabel("")
|
|
|
|
|
+ for j in range(0, 3):
|
|
|
|
|
+ self.runeStats[i][j].SetLabel("")
|
|
|
|
|
+
|
|
|
|
|
+ # Display the runes
|
|
|
|
|
+ cursor = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ runes.id,
|
|
|
|
|
+ runes.slot,
|
|
|
|
|
+ runes.type,
|
|
|
|
|
+ runes.level,
|
|
|
|
|
+ units.id,
|
|
|
|
|
+ units.name
|
|
|
|
|
+ FROM runes LEFT JOIN units ON runes.unit = units.id
|
|
|
|
|
+ WHERE runes.id IN (?, ?, ?, ?, ?, ?)
|
|
|
|
|
+ ORDER BY runes.slot;
|
|
|
|
|
+ """,
|
|
|
|
|
+ (
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[0],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[1],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[2],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[3],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[4],
|
|
|
|
|
+ self.data.results[self.selectedResultIndex].runes[5]
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ i = 0
|
|
|
|
|
+ for row in cursor:
|
|
|
|
|
+ # Rows are 21 charactes width
|
|
|
|
|
+ self.runeIds[i].SetLabel(("#" + str(row[0])).rjust(21, " "))
|
|
|
|
|
+ if row[4] == None:
|
|
|
|
|
+ self.runeLocations[i].SetLabel("Storage")
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.runeLocations[i].SetLabel(
|
|
|
|
|
+ str(row[5])[0:9].ljust(9, " ") + " #" + str(row[4]) + ""
|
|
|
|
|
+ )
|
|
|
|
|
+ self.runeSets[i].SetLabel(
|
|
|
|
|
+ set_names[row[2]].ljust(18, " ") + "+" + str(row[3])
|
|
|
|
|
+ )
|
|
|
|
|
+ #print(self.data.results[self.selectedResultIndex].runes[i])
|
|
|
|
|
+ cursorStats = conn.execute(
|
|
|
|
|
+ """
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ slot, stat, value, grind, enchant
|
|
|
|
|
+ FROM rune_stats
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ rune = ?
|
|
|
|
|
+ ORDER BY slot;
|
|
|
|
|
+ """,
|
|
|
|
|
+ (self.data.results[self.selectedResultIndex].runes[i],)
|
|
|
|
|
+ )
|
|
|
|
|
+ for rowStats in cursorStats:
|
|
|
|
|
+ slot = rowStats[0]
|
|
|
|
|
+ if rowStats[4] == 1: # if enchanted
|
|
|
|
|
+ name = (
|
|
|
|
|
+ stat_names[rowStats[1]]
|
|
|
|
|
+ .replace("%", "")
|
|
|
|
|
+ .replace(" ", "") + " * "
|
|
|
|
|
+ ).rjust(8, " ")
|
|
|
|
|
+ else:
|
|
|
|
|
+ name = (
|
|
|
|
|
+ stat_names[rowStats[1]]
|
|
|
|
|
+ .replace("%", "")
|
|
|
|
|
+ .replace(" ", "") + " "
|
|
|
|
|
+ ).rjust(8, " ")
|
|
|
|
|
+ value = str(rowStats[2])
|
|
|
|
|
+ if rowStats[1] in [2, 4, 6, 9, 10, 11, 23]:
|
|
|
|
|
+ value = value + "%"
|
|
|
|
|
+ else:
|
|
|
|
|
+ value = value + " "
|
|
|
|
|
+ value = value.rjust(5)
|
|
|
|
|
+ if rowStats[3] > 0: # if grinded
|
|
|
|
|
+ value = value + " + " + str(rowStats[3])
|
|
|
|
|
+ if rowStats[1] in [2, 4, 6, 9, 10, 11, 23]:
|
|
|
|
|
+ value = value + "%"
|
|
|
|
|
+ line = name + value
|
|
|
|
|
+ if slot == -1: # main
|
|
|
|
|
+ self.runeMains[i].SetLabel(line)
|
|
|
|
|
+ elif slot == 0: # innate
|
|
|
|
|
+ self.runeInnates[i].SetLabel(line)
|
|
|
|
|
+ else: # normal stats
|
|
|
|
|
+ self.runeStats[i][slot - 1].SetLabel(line)
|
|
|
|
|
+ i += 1
|