MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / __getData

Method __getData

gui/builtinViewColumns/misc.py:68–938  ·  view source on GitHub ↗
(self, stuff)

Source from the content-addressed store, hash-verified

66 return ("displayName", bool, False), ("showIcon", bool, True)
67
68 def __getData(self, stuff):
69 item = stuff.item
70 if item is None:
71 return "", None
72 itemGroup = item.group.name
73 itemCategory = item.category.name
74
75 if itemGroup == "Ship Modifiers":
76 return "", None
77 elif itemGroup == "Booster":
78 stuff.getModifiedItemAttr("boosterDuration")
79 text = "{0} min".format(formatAmount(stuff.getModifiedItemAttr("boosterDuration") / 1000 / 60, 3, 0, 3))
80 return text, "Booster Duration"
81 elif itemGroup in ("Super Weapon", "Structure Doomsday Weapon"):
82 volleyParams = stuff.getVolleyParameters(ignoreState=True)
83 dmg = sum(dt.total for dt in volleyParams.values())
84 duration = (max(volleyParams) - min(volleyParams)) / 1000
85 if dmg <= 0:
86 text = ""
87 tooltip = ""
88 elif duration > 0:
89 text = "{} over {}s".format(
90 formatAmount(dmg, 3, 0, 6),
91 formatAmount((duration), 0, 0, 0))
92 tooltip = "Raw damage done over time"
93 else:
94 text = "{} dmg".format(formatAmount(dmg, 3, 0, 6))
95 tooltip = "Raw damage done"
96 return text, tooltip
97 elif itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Fighter Drone"):
98 trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed")
99 optimalSig = stuff.getModifiedItemAttr("optimalSigRadius")
100 if not trackingSpeed or not optimalSig:
101 return "", None
102 normalizedTracking = trackingSpeed * 40000 / optimalSig
103 text = "{0}".format(formatAmount(normalizedTracking, 3, 0, 3))
104 tooltip = "Tracking speed"
105 return text, tooltip
106 elif itemGroup == "Combat Drone":
107 text_parts = []
108 tooltip_parts = []
109 trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed")
110 optimalSig = stuff.getModifiedItemAttr("optimalSigRadius")
111 if trackingSpeed and optimalSig:
112 normalizedTracking = trackingSpeed * 40000 / optimalSig
113 text_parts.append("{0}".format(formatAmount(normalizedTracking, 3, 0, 3)))
114 tooltip_parts.append("Tracking speed")
115 if 'entityEnergyNeutralizerFalloff' in item.effects:
116 neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount")
117 cycleTime = stuff.getModifiedItemAttr("energyNeutralizerDuration")
118 if neutAmount and cycleTime:
119 capPerSec = float(-neutAmount) * 1000 / cycleTime
120 text_parts.append("{0}/s".format(formatAmount(capPerSec, 3, 0, 3)))
121 tooltip_parts.append("Energy neutralization per second")
122 if 'npcEntityWeaponDisruptor' in item.effects:
123 falloffRangeBonus = stuff.getModifiedItemAttr("falloffBonus")
124 optimalRangeBonus = stuff.getModifiedItemAttr("maxRangeBonus")
125 trackingSpeedBonus = stuff.getModifiedItemAttr("trackingSpeedBonus")

Callers 2

getTextMethod · 0.95
getToolTipMethod · 0.95

Calls 15

formatAmountFunction · 0.90
formatListFunction · 0.90
floatUnerrFunction · 0.90
valuesMethod · 0.80
getSpoolDataMethod · 0.80
itemsMethod · 0.80
getItemMethod · 0.80
getModifiedChargeAttrMethod · 0.80
getFitMethod · 0.80
getModifiedItemAttrMethod · 0.45
getVolleyParametersMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected