| 29 | |
| 30 | |
| 31 | class ProjectedDataCache(FitDataCache): |
| 32 | |
| 33 | def getProjModData(self, src): |
| 34 | try: |
| 35 | projectedData = self._data[src.item.ID]['modules'] |
| 36 | except KeyError: |
| 37 | # Format of items for both: (boost strength, optimal, falloff, stacking group, resistance attr ID) |
| 38 | webMods = [] |
| 39 | tpMods = [] |
| 40 | projectedData = self._data.setdefault(src.item.ID, {})['modules'] = (webMods, tpMods) |
| 41 | for mod in src.item.activeModulesIter(): |
| 42 | for webEffectName in ('remoteWebifierFalloff', 'structureModuleEffectStasisWebifier'): |
| 43 | if webEffectName in mod.item.effects: |
| 44 | webMods.append(ModProjData( |
| 45 | mod.getModifiedItemAttr('speedFactor'), |
| 46 | mod.maxRange or 0, |
| 47 | mod.falloff or 0, |
| 48 | 'default', |
| 49 | getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects[webEffectName]))) |
| 50 | if 'doomsdayAOEWeb' in mod.item.effects: |
| 51 | webMods.append(ModProjData( |
| 52 | mod.getModifiedItemAttr('speedFactor'), |
| 53 | max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange')), |
| 54 | mod.falloff or 0, |
| 55 | 'default', |
| 56 | getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects['doomsdayAOEWeb']))) |
| 57 | for tpEffectName in ('remoteTargetPaintFalloff', 'structureModuleEffectTargetPainter'): |
| 58 | if tpEffectName in mod.item.effects: |
| 59 | tpMods.append(ModProjData( |
| 60 | mod.getModifiedItemAttr('signatureRadiusBonus'), |
| 61 | mod.maxRange or 0, |
| 62 | mod.falloff or 0, |
| 63 | 'default', |
| 64 | getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects[tpEffectName]))) |
| 65 | if 'doomsdayAOEPaint' in mod.item.effects: |
| 66 | tpMods.append(ModProjData( |
| 67 | mod.getModifiedItemAttr('signatureRadiusBonus'), |
| 68 | max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange')), |
| 69 | mod.falloff or 0, |
| 70 | 'default', |
| 71 | getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects['doomsdayAOEPaint']))) |
| 72 | return projectedData |
| 73 | |
| 74 | def getProjDroneData(self, src): |
| 75 | try: |
| 76 | projectedData = self._data[src.item.ID]['drones'] |
| 77 | except KeyError: |
| 78 | # Format of items for both: (boost strength, optimal, falloff, stacking group, resistance attr ID, drone speed, drone radius) |
| 79 | webDrones = [] |
| 80 | tpDrones = [] |
| 81 | projectedData = self._data.setdefault(src.item.ID, {})['drones'] = (webDrones, tpDrones) |
| 82 | for drone in src.item.activeDronesIter(): |
| 83 | if 'remoteWebifierEntity' in drone.item.effects: |
| 84 | webDrones.extend(drone.amountActive * (MobileProjData( |
| 85 | drone.getModifiedItemAttr('speedFactor'), |
| 86 | drone.maxRange or 0, |
| 87 | drone.falloff or 0, |
| 88 | 'default', |