| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748 |
- """
- 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 PanelUnits(wx.Panel):
- """
- The unit list and details Panel.
- Methods
- -------
- populate_unit_list(event)
- Populates the unit list.
- """
- _selected_unit = None
- _unit_list = None
- _filter_name_text = None
- _filter_torage_check = None
- _filter_no_runes_check = None
- _filterNoTeamsCheck = None
- _details_sizer = None
- _name_label = None
- _stat_grid = None
- _set_label_list = None
- _id_label_list = None
- _main_label_list = None
- _innate_label_list = None
- _stat_label_list = None
- _eff_label_List = None
- def __init__(self, parent, id=wx.ID_ANY):
- """Initializes the panel.
- Sets upt all the widgets.
- Parameters
- ----------
- parent : wx.*
- Panel parent.
- id : int, optional
- ID for the panel (default wx.ID_ANY).
- """
- # Parent constructor
- wx.Panel.__init__(self, parent=parent, id=id)
- # Prepare some fonts
- title_font = wx.Font(
- pointSize=16, family=wx.FONTFAMILY_DEFAULT,
- style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
- )
- subtitle_font = wx.Font(
- pointSize=14, family=wx.FONTFAMILY_DEFAULT,
- style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
- )
- bold_font = wx.Font(
- pointSize=10, family=wx.FONTFAMILY_DEFAULT,
- style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
- )
- monospace_font = wx.Font(
- pointSize=10, family=wx.FONTFAMILY_TELETYPE,
- style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL
- )
- monospace_font_bold = wx.Font(
- pointSize=10, family=wx.FONTFAMILY_TELETYPE,
- style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD
- )
- monospace_font_italic = wx.Font(
- pointSize=10, family=wx.FONTFAMILY_TELETYPE,
- style=wx.FONTSTYLE_ITALIC, weight=wx.FONTWEIGHT_NORMAL
- )
- # Unit selectable list
- unit_list_box = wx.StaticBox(
- self, label="Select unit:", id=wx.ID_ANY, pos=(0, 0), size=(210, 590)
- )
- wx.StaticText(
- parent=unit_list_box, id=wx.ID_ANY,
- label="Name Prio. Sto.",
- pos=(10, 10), size=(190, 20)
- ).SetFont(bold_font)
- self._unit_list = wx.ListCtrl(
- parent=unit_list_box, id=wx.ID_ANY, pos=(10, 30), size=(190, 380),
- style=wx.LC_REPORT|wx.LC_NO_HEADER
- )
- self._unit_list.InsertColumn(0, "Name", width=120)
- self._unit_list.InsertColumn(1, "Prio.", width=40)
- self._unit_list.InsertColumn(2, "Sto.", width=30)
- self._unit_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self._unit_selected)
- # List filters
- filterBox = wx.StaticBox(
- parent=self, label="Filters:", id=wx.ID_ANY,
- pos=(10, 430), size=(190, 150)
- )
- wx.StaticText(
- parent=filterBox, label="Monster name", pos=(5, 5), size=(180, 20)
- )
- self._filter_name_text = wx.TextCtrl(
- parent=filterBox, id=wx.ID_ANY, value="", pos=(5, 25),
- size=(177, 20), style=wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB
- )
- self._filter_name_text.Bind(wx.EVT_TEXT, self.populate_unit_list)
- self._filter_storage_check = wx.CheckBox(
- parent=filterBox, id=wx.ID_ANY,
- label="Monsters in storage", pos=(5, 55), size=(180, 20)
- )
- self._filter_storage_check.SetValue(True)
- self._filter_storage_check.Bind(
- wx.EVT_CHECKBOX, self.populate_unit_list
- )
- self.filterNoRunesCheck = wx.CheckBox(
- parent=filterBox, id=wx.ID_ANY,
- label="Monsters without runes", pos=(5, 75), size=(180, 20)
- )
- self.filterNoRunesCheck.SetValue(True)
- self.filterNoRunesCheck.Bind(
- wx.EVT_CHECKBOX, self.populate_unit_list
- )
- self._filter_no_teams_check = wx.CheckBox(
- parent=filterBox, id=wx.ID_ANY,
- label="Monsters not in teams", pos=(5, 95), size=(180, 20)
- )
- self._filter_no_teams_check.SetValue(True)
- self._filter_no_teams_check.Bind(
- wx.EVT_CHECKBOX, self.populate_unit_list
- )
- self.populate_unit_list(None)
- # Sizer for all the unit details. It will be hidden until a unit is
- # selected.
- self._details_sizer = wx.BoxSizer(wx.VERTICAL)
- # Unit name
- self._name_label = wx.StaticText(
- parent=self, label="", pos=(240, 0), size=(120, 30)
- )
- self._details_sizer.Add(self._name_label)
- self._name_label.SetFont(title_font)
-
- #Unit details
- self._stars_label = wx.StaticText(
- parent=self, label="", pos=(250, 30), size=(120, 100)
- )
- self._stars_label.SetFont(title_font)
- self._details_sizer.Add(self._stars_label)
- self._level_label = wx.StaticText(
- parent=self, label="", pos=(250, 60), size=(120, 100)
- )
- self._details_sizer.Add(self._level_label)
- self._level_label.SetFont(subtitle_font)
- self._priority_label = wx.StaticText(
- parent=self, label="", pos=(250, 90), size=(120, 100)
- )
- self._priority_label.SetFont(subtitle_font)
- self._details_sizer.Add(self._priority_label)
- self._id_label = wx.StaticText(
- parent=self, label="", pos=(250, 120), size=(120, 100)
- )
- self._id_label.SetFont(subtitle_font)
- self._details_sizer.Add(self._id_label)
-
- # Button to go to the ptimizer
- optimize_button = wx.Button(
- parent=self, id=wx.ID_ANY, pos=(700, 520), size=(120, 50),
- style=wx.LC_REPORT, label="Optimize"
- )
- self._details_sizer.Add(optimize_button)
- optimize_button.Bind(wx.EVT_BUTTON, self._go_to_optimizer)
- # Stats table
- self._stat_grid = wx.grid.Grid(
- parent=self, id=wx.ID_ANY, pos=(520, 00), size=(195, 220)
- )
- self._details_sizer.Add(self._stat_grid)
- self._stat_grid.CreateGrid(
- numRows=10, numCols=2
- )
- self._stat_grid.EnableEditing(False)
- self._stat_grid.SetDefaultCellAlignment(
- horiz=wx.ALIGN_RIGHT, vert=wx.ALIGN_CENTRE
- )
- self._stat_grid.SetDefaultCellFont(monospace_font)
- self._stat_grid.SetColSize(col=0, width=80)
- self._stat_grid.SetColLabelValue(col=0, value="Base")
- self._stat_grid.SetColSize(col=1, width=80)
- self._stat_grid.SetColLabelValue(col=1, value="Current")
- self._stat_grid.SetRowLabelSize(width=35)
- self._stat_grid.SetColLabelSize(height=20)
- self._stat_grid.SetRowSize(row=0, height=20)
- self._stat_grid.SetRowSize(row=1, height=20)
- self._stat_grid.SetRowSize(row=2, height=20)
- self._stat_grid.SetRowSize(row=3, height=20)
- self._stat_grid.SetRowSize(row=4, height=20)
- self._stat_grid.SetRowSize(row=5, height=20)
- self._stat_grid.SetRowSize(row=6, height=20)
- self._stat_grid.SetRowSize(row=7, height=20)
- self._stat_grid.SetRowSize(row=8, height=20)
- self._stat_grid.SetRowSize(row=9, height=20)
- self._stat_grid.SetRowLabelValue(row=0, value=" HP")
- self._stat_grid.SetRowLabelValue(row=1, value="ATK")
- self._stat_grid.SetRowLabelValue(row=2, value="DEF")
- self._stat_grid.SetRowLabelValue(row=3, value="SPD")
- self._stat_grid.SetRowLabelValue(row=4, value="CRR")
- self._stat_grid.SetRowLabelValue(row=5, value="CRD")
- self._stat_grid.SetRowLabelValue(row=6, value="RES")
- self._stat_grid.SetRowLabelValue(row=7, value="ACC")
- self._stat_grid.SetRowLabelValue(row=8, value="EHP")
- self._stat_grid.SetRowLabelValue(row=9, value="DMG")
- # Team list
- team_box = wx.StaticBox(
- parent=self, label="Teams:",id=wx.ID_ANY,
- pos=(730, 0), size=(160, 220)
- )
- self._details_sizer.Add(team_box)
- self._teams_label = wx.StaticText(
- parent=team_box, label="", pos=(5, 5), size=(135, 190)
- )
- monospace_font.PointSize -= 2
- self._teams_label.SetFont(monospace_font)
- monospace_font.PointSize += 2
- # Rune list
- rune_box_list = [
- wx.StaticBox(
- parent=self, label="Slot1:",id=wx.ID_ANY,
- pos=(365, 225), size=(130, 170)
- ),
- wx.StaticBox(
- parent=self, label="Slot2:",id=wx.ID_ANY,
- pos=(510, 225), size=(130, 170)
- ),
- wx.StaticBox(
- parent=self, label="Slot3:",id=wx.ID_ANY,
- pos=(510, 400), size=(130, 170)
- ),
- wx.StaticBox(
- parent=self, label="Slot4:",id=wx.ID_ANY,
- pos=(365, 400), size=(130, 170)
- ),
- wx.StaticBox(
- parent=self, label="Slot5:",id=wx.ID_ANY,
- pos=(220, 400), size=(130, 170)
- ),
- wx.StaticBox(
- parent=self, label="Slot6:",id=wx.ID_ANY,
- pos=(220, 225), size=(130, 170)
- )
- ]
- self._set_label_list = [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 0), size=(130, 10)
- ),
- ]
- self._id_label_list = [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 15), size=(130, 10)
- )
- ]
-
- self._main_label_list = [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 35), size=(130, 10)
- )
- ]
- self._innate_label_list = [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 50), size=(130, 10)
- )
- ]
-
- self._stat_label_list = [
- [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ],
- [
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ],
- [
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ],
- [
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ],
- [
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ],
- [
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 70), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 85), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 100), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 115), size=(130, 10)
- )
- ]
- ]
- self._eff_label_list = [
- wx.StaticText(
- parent=rune_box_list[0], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[1], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[2], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[3], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[4], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- wx.StaticText(
- parent=rune_box_list[5], id=wx.ID_ANY, label="",
- pos=(5, 135), size=(130, 10)
- ),
- ]
- for i in range(0, 6):
- # Separators
- wx.StaticLine(
- parent=rune_box_list[i], id=wx.ID_ANY,
- pos=(0, 30), size=(130, 1), style=wx.LC_REPORT
- )
- wx.StaticLine(
- parent=rune_box_list[i], id=wx.ID_ANY,
- pos=(0, 135), size=(130, 1), style=wx.LC_REPORT
- )
- # Set fonts
- rune_box_list[i].SetFont(monospace_font)
- self._eff_label_list[i].SetFont(monospace_font_italic)
- self._main_label_list[i].SetFont(monospace_font_bold)
- self._innate_label_list[i].SetFont(monospace_font_italic)
- # Add boxes to sizer
- self._details_sizer.Add(rune_box_list[i])
- # By default, hide all optimization options
- self._details_sizer.ShowItems(False)
- def populate_unit_list(self, event=None):
- """Populates the unit list.
- Uses the filters.
- Parameters
- ----------
- event : wx.Event, optional
- The event that triggered the call (default is None).
- """
- # Loop all units
- i = 0
- filter_name = self._filter_name_text.GetValue()
- opt_storage = self._filter_storage_check.GetValue()
- opt_no_runes = self._filter_storage_check.GetValue()
- opt_no_teams = self._filter_no_teams_check.GetValue()
- self._unit_list.DeleteAllItems()
- for unit in units.values():
- if opt_storage == False and unit.in_storage == True:
- continue
- if opt_no_runes == False and unit.has_runes == False:
- continue
- if opt_no_teams == False and unit.in_teams == False:
- continue
- if len(filter_name) > 0:
- if filter_name.upper() not in unit.name.upper():
- continue
- self._unit_list.InsertItem(i, unit.name)
- self._unit_list.SetItem(i, 1, str(unit.priority))
- if (unit.in_storage):
- self._unit_list.SetItem(i, 2, "X")
- else:
- self._unit_list.SetItem(i, 2, " ")
- # TODO Items can't hold too much data in Windows, store the first
- # nine digits and rerieve it from database with LIKE
- self._unit_list.SetItemData(i, int(unit.id))
- i = i + 1
- def _go_to_optimizer(self, event = None):
- """Prepares the optimizer panel with the selected unit and redirects.
- Parameters
- ----------
- event : wx.Event, optional
- The event that triggered the call (default is None).
- """
- self.GetParent().panel_optimizer.select_unit(
- event=None, unit_id=self._selected_unit.id
- )
- self.GetParent().ChangeSelection(2)
- def _unit_selected(self, event):
- """Loads a unit info and enables optimizaton options.
- Called when a unit is selected from the list.
- Parameters
- ----------
- event : wx.Event, optional
- The event that triggered the call (default is None).
- """
- unit_id = \
- str(self._unit_list.GetItemData(self._unit_list.GetFirstSelected()))
- self._selected_unit = units[unit_id]
- # Set label
- self._name_label.SetLabel(self._selected_unit.name)
- stars_label_text = ""
- for i in range(0, self._selected_unit.stars):
- stars_label_text += "\u272D"
- self._stars_label.SetLabel(stars_label_text)
- self._level_label.SetLabel("Lv. " + str(self._selected_unit.level))
- self._priority_label.SetLabel(
- "Priority: " + str(self._selected_unit.priority)
- )
- self._id_label.SetLabel("#" + self._selected_unit.id)
- self._details_sizer.ShowItems(True)
-
- # Populate stats
- self._stat_grid.SetCellValue(
- row=0, col=0, s=str(self._selected_unit.base_stats.hp)
- )
- self._stat_grid.SetCellValue(
- row=0, col=1, s=str(self._selected_unit.stats.hp)
- )
- self._stat_grid.SetCellValue(
- row=1, col=0, s=str(self._selected_unit.base_stats.atk)
- )
- self._stat_grid.SetCellValue(
- row=1, col=1, s=str(self._selected_unit.stats.atk)
- )
- self._stat_grid.SetCellValue(
- row=2, col=0, s=str(self._selected_unit.base_stats.dfc)
- )
- self._stat_grid.SetCellValue(
- row=2, col=1, s=str(self._selected_unit.stats.dfc)
- )
- self._stat_grid.SetCellValue(
- row=3, col=0, s=str(self._selected_unit.base_stats.spd)
- )
- self._stat_grid.SetCellValue(
- row=3, col=1, s=str(self._selected_unit.stats.spd)
- )
- self._stat_grid.SetCellValue(
- row=4, col=0, s=str(self._selected_unit.base_stats.crr)
- )
- self._stat_grid.SetCellValue(
- row=4, col=1, s=str(self._selected_unit.stats.crr)
- )
- self._stat_grid.SetCellValue(
- row=5, col=0, s=str(self._selected_unit.base_stats.crd)
- )
- self._stat_grid.SetCellValue(
- row=5, col=1, s=str(self._selected_unit.stats.crd)
- )
- self._stat_grid.SetCellValue(
- row=6, col=0, s=str(self._selected_unit.base_stats.res)
- )
- self._stat_grid.SetCellValue(
- row=6, col=1, s=str(self._selected_unit.stats.res)
- )
- self._stat_grid.SetCellValue(
- row=7, col=0, s=str(self._selected_unit.base_stats.acc)
- )
- self._stat_grid.SetCellValue(
- row=7, col=1, s=str(self._selected_unit.stats.acc)
- )
- self._stat_grid.SetCellValue(
- row=8, col=0, s=str(self._selected_unit.base_stats.ehp)
- )
- self._stat_grid.SetCellValue(
- row=8, col=1, s=str(self._selected_unit.stats.ehp)
- )
- self._stat_grid.SetCellValue(
- row=9, col=0, s=str(self._selected_unit.base_stats.dmg)
- )
- self._stat_grid.SetCellValue(
- row=9, col=1, s=str(self._selected_unit.stats.dmg)
- )
- # Write the team list
- team_label_text = ""
- for team in self._selected_unit.teams:
- team_label_text += "-" + team.name[0:16].ljust(16, " ")
- team_label_text += ("(#" + team.id + ")").rjust(6) + "\n"
- self._teams_label.SetLabel(team_label_text)
- # Populate the runes
- i = 0
- for rune in self._selected_unit.runes:
- # Rows are 18 charactes width
- # First line: Set name, level
- self._set_label_list[rune.slot - 1].SetLabel(
- rune.type_name[0:9].ljust(12, " ") + \
- "+" + str(rune.level).ljust(3, " ")
- )
- # Second line: ID
- lvl_set_eff = rune.type_name[0:6].ljust(6, " ")
- effv = str(("{:.2f}".format(rune.efficiency)).rjust(5, " "))
- eff = (" Eff:" + str(effv) + "%")
- lvl_set_eff += eff
- self._id_label_list[i].SetLabel(("#" + rune.id).rjust(15, " "))
-
- # Efficiency
- label_eff_text = \
- "Eff.: " + ("{:.1f}".format(rune.efficiency)).rjust(4, " ") + \
- "/" + ("{:.1f}".format(rune.max_efficiency)).rjust(4, " ")
- self._eff_label_list[rune.slot - 1].SetLabel(label_eff_text)
- # Write all stats
- innate_label = " "
- for stat in rune.stats:
- if stat == None:
- continue
- slot = stat.slot
- if stat.is_enchanted:
- name = (
- stat.name
- .replace("%", "").
- replace(" ", "") + "* "
- ).rjust(5, " ")
- else:
- name = (
- stat.name
- .replace("%", "")
- .replace(" ", "") + " "
- ).rjust(5, " ")
- value = str(stat.value)
- if stat.stat in [2, 4, 6, 9, 10, 11, 23]:
- value = value + "%"
- else:
- value = value + " "
- value = value.rjust(5)
- if stat.grind > 0: # if grinded
- value = value + " +" + str(stat.grind).rjust(2)
- if stat.stat in [2, 4, 6, 9, 10, 11, 23]:
- value = value + "%"
- line = name + value
- if slot == -1: # main
- self._main_label_list[i].SetLabel(line)
- elif slot == 0: # innate
- innate_label = line
- else: # normal stats
- self._stat_label_list[i][slot - 1].SetLabel(line)
- self._innate_label_list[i].SetLabel(innate_label)
- i = i + 1
|