Merge branch 'master' into dep_facelift

This commit is contained in:
DarkPhoenix
2022-08-29 02:32:12 +04:00
15 changed files with 238 additions and 10 deletions

View File

@@ -66,6 +66,8 @@ class DroneView(Display):
"Max Range",
"Miscellanea",
"attr:maxVelocity",
"Drone HP",
"Drone Regen",
"Price",
]

View File

@@ -151,6 +151,8 @@ class FighterDisplay(d.Display):
# "Max Range",
# "Miscellanea",
"attr:maxVelocity",
"Drone HP",
"Drone Regen",
"Fighter Abilities",
"Price",
]

View File

@@ -0,0 +1,87 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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.
#
# pyfa 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 pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
# noinspection PyPackageRequirements
import wx
import gui.mainFrame
from eos.saveddata.drone import Drone
from eos.saveddata.fighter import Fighter
from service.attribute import Attribute
from gui.viewColumn import ViewColumn
from gui.bitmap_loader import BitmapLoader
from gui.utils.numberFormatter import formatAmount
_t = wx.GetTranslation
class DroneEhpColumn(ViewColumn):
name = "Drone HP"
def __init__(self, fittingView, params=None):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
if params is None:
params = {"showIcon": True, "displayName": False}
ViewColumn.__init__(self, fittingView)
sAttr = Attribute.getInstance()
info = sAttr.getAttributeInfo("shieldCapacity")
self.info = info
if params["showIcon"]:
iconFile = info.iconID
if iconFile:
self.imageId = fittingView.imageList.GetImageIndex(iconFile, "icons")
self.bitmap = BitmapLoader.getBitmap(iconFile, "icons")
else:
self.imageId = -1
self.mask = wx.LIST_MASK_IMAGE
else:
self.imageId = -1
if params["displayName"] or self.imageId == -1:
self.columnText = info.displayName if info.displayName != "" else info.name
self.mask |= wx.LIST_MASK_TEXT
def getText(self, stuff):
if not isinstance(stuff, (Drone, Fighter)):
return ""
if self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective:
ehp = sum(stuff.ehp.values())
else:
ehp = sum(stuff.hp.values())
return formatAmount(ehp, 3, 0, 9)
def getImageId(self, mod):
return -1
def getParameters(self):
return ("displayName", bool, False), ("showIcon", bool, True)
def getToolTip(self, stuff):
if not isinstance(stuff, (Drone, Fighter)):
return ""
if self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective:
return _t("Effective HP")
else:
return _t("HP")
DroneEhpColumn.register()

View File

@@ -0,0 +1,81 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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.
#
# pyfa 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 pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
# noinspection PyPackageRequirements
import wx
import gui.mainFrame
from eos.saveddata.drone import Drone
from eos.saveddata.fighter import Fighter
from gui.viewColumn import ViewColumn
from gui.bitmap_loader import BitmapLoader
from gui.utils.numberFormatter import formatAmount
_t = wx.GetTranslation
class DroneRegenColumn(ViewColumn):
name = "Drone Regen"
def __init__(self, fittingView, params=None):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
if params is None:
params = {"showIcon": True, "displayName": False}
ViewColumn.__init__(self, fittingView)
if params["showIcon"]:
self.imageId = fittingView.imageList.GetImageIndex("shieldPassive_small", "gui")
self.bitmap = BitmapLoader.getBitmap("shieldPassive_small", "gui")
self.mask = wx.LIST_MASK_IMAGE
else:
self.imageId = -1
if params["displayName"] or self.imageId == -1:
self.columnText = _("Misc data")
self.mask |= wx.LIST_MASK_TEXT
def getText(self, stuff):
if not isinstance(stuff, (Drone, Fighter)):
return ""
regen = stuff.calculateShieldRecharge()
if (
self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective
and stuff.owner and stuff.owner.damagePattern is not None
):
regen = stuff.owner.damagePattern.effectivify(stuff, regen, 'shield')
return '{}/s'.format(formatAmount(regen, 3, 0, 9))
def getImageId(self, mod):
return -1
def getParameters(self):
return ("displayName", bool, False), ("showIcon", bool, True)
def getToolTip(self, stuff):
if not isinstance(stuff, (Drone, Fighter)):
return ""
if self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective:
return _t("Effective Shield Regeneration")
else:
return _t("Shield Regeneration")
DroneRegenColumn.register()

View File

@@ -78,6 +78,8 @@ from gui.builtinViewColumns import ( # noqa: E402, F401
baseName,
capacitorUse,
dampScanRes,
droneEhp,
droneRegen,
graphColor,
graphLightness,
graphLineStyle,