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

Method getWeaponSystemData

service/port/efs.py:370–473  ·  view source on GitHub ↗
(fit)

Source from the content-addressed store, hash-verified

368
369 @staticmethod
370 def getWeaponSystemData(fit):
371 weaponSystems = []
372 groups = {}
373 # Export at maximum spool for consistency, spoolup data is exported anyway.
374 defaultSpoolValue = 1
375 spoolOptions = SpoolOptions(SpoolType.SPOOL_SCALE, defaultSpoolValue, True)
376 for mod in fit.modules:
377 if mod.getDps(spoolOptions=spoolOptions).total > 0:
378 # Group weapon + ammo combinations that occur more than once
379 keystr = str(mod.itemID) + "-" + str(mod.chargeID)
380 if keystr in groups:
381 groups[keystr][1] += 1
382 else:
383 groups[keystr] = [mod, 1]
384 for wepGroup in groups.values():
385 stats = wepGroup[0]
386 n = wepGroup[1]
387 tracking = 0
388 optimalSigRadius = 0
389 maxVelocity = 0
390 explosionDelay = 0
391 damageReductionFactor = 0
392 explosionRadius = 0
393 explosionVelocity = 0
394 aoeFieldRange = 0
395 typeing = 'None'
396 if stats.charge:
397 name = stats.item.typeName + ", " + stats.charge.typeName
398 else:
399 name = stats.item.typeName
400 if stats.hardpoint == FittingHardpoint.TURRET:
401 tracking = stats.getModifiedItemAttr("trackingSpeed")
402 optimalSigRadius = stats.getModifiedItemAttr('optimalSigRadius')
403 typeing = "Turret"
404 # Bombs share most attributes with missiles despite not needing the hardpoint
405 elif stats.hardpoint == FittingHardpoint.MISSILE or "Bomb Launcher" in stats.item.typeName:
406 maxVelocity = stats.getModifiedChargeAttr("maxVelocity")
407 explosionDelay = stats.getModifiedChargeAttr("explosionDelay")
408 damageReductionFactor = stats.getModifiedChargeAttr("aoeDamageReductionFactor")
409 explosionRadius = stats.getModifiedChargeAttr("aoeCloudSize")
410 explosionVelocity = stats.getModifiedChargeAttr("aoeVelocity")
411 typeing = "Missile"
412 # AoE DDs can be treated like missiles with a damageReductionFactor of 0
413 elif stats.item.group.name == 'Super Weapon' and stats.maxRange:
414 explosionRadius = stats.getModifiedItemAttr("signatureRadius")
415 typeing = "Missile"
416 elif stats.hardpoint == FittingHardpoint.NONE:
417 aoeFieldRange = stats.getModifiedItemAttr("empFieldRange")
418 # This also covers non-bomb weapons with dps values and no hardpoints, most notably targeted doomsdays.
419 typeing = "SmartBomb"
420 # Targeted DDs are the only non drone/fighter weapon without an explicit max range
421 if stats.item.group.name == 'Super Weapon' and stats.maxRange is None:
422 maxRange = 300000
423 else:
424 maxRange = stats.maxRange
425
426 dps = stats.getDps(spoolOptions=spoolOptions)
427 dps_spread_dict = {'em': dps.em, 'therm': dps.thermal, 'kin': dps.kinetic, 'exp': dps.explosive, 'pure': dps.pure}

Callers 1

exportEfsMethod · 0.80

Calls 11

valuesMethod · 0.80
getModifiedChargeAttrMethod · 0.80
itemsMethod · 0.80
getFighterAbilityDataMethod · 0.80
getDpsMethod · 0.45
getModifiedItemAttrMethod · 0.45
updateMethod · 0.45
getCycleParametersMethod · 0.45
getVolleyMethod · 0.45
appendMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected