pyfa-org / Pyfa

Python fitting assistant, cross-platform fitting tool for EVE Online
GNU General Public License v3.0
1.62k stars 410 forks source link

Ability to export ship loadout to clipboard with calculated stats #1624

Open molbal opened 6 years ago

molbal commented 6 years ago

Hello,

I would like to request a feature, if possible, please. I would like to add an export function (based on the XML or JSON exporter) that exports the fit and the calculated stats as well (tank/dps/etc)

Thank you, Veetor

blitzmann commented 6 years ago

This would be pretty difficult to do, I think. Well, not difficult, but time consuming, and a bit of thought to get right. The stats are from various different places and all aggregated into one location (usually). Then there's the fact that maintaining this mapping - if we ever add a stat, we would need remember to add it to the export as well.. I wonder if there's a python decorator we can use to mark a property as an exportable property... Hrm...

You basically want the information from the Stats Panels, correct? Or are you thinking something much deeper, such as the specific damage of a charge?

molbal commented 6 years ago

Hey, thanks for the answer!

I was thinking of just first glance stats, like EHP and DPS and speed, no need for all the stats. (at least for me) Unfortunately I can't comment on the decorator, because my python knowledge is nonexistent :(

Cheers

blitzmann commented 6 years ago

I'll give this some thought, but I can't promise anything, especially soon : )

molbal commented 6 years ago

Thank you if you can squeeze it in, no worries if you can't!

blitzmann commented 6 years ago

So, haven't reaally started with getting an actual system down to export calculated stats... however, I did use jsonpickle which converts python objects to json. This produces some interesting output.

https://gist.github.com/blitzmann/f690773185dd00b0f4cd4d10d5ca642e

This is definitely not the right way to do this. But might be useful? It basically gives you everything about the fit, internal information and all

image

Could be interesting to use this as a "debug" export

blitzmann commented 6 years ago

lol just realized this might not actually work lol. A lot of the thigns we display are using getter functions, which this obv won't access.

Still interesting to see the object laid out. It waas a very simple fit, not very complicated, and most online json viewer / formatter had difficulty loading it lol

molbal commented 6 years ago

Thanks for checking it. It's a good idea and certainly good enough to work, but I doubt it the 5+ megabyte JSON files will be quick to parse so I'll stick with the standard EFT export and ask the others to copy the fields manually. (Or maybe experiment with an RPA based solution like uipath community edition)

blitzmann commented 6 years ago

@molbal meet @MaruMaruOO. He's currently got a PR out for a new export format that was developed separately, but may actually address most, if not all, of the export data you desire. Could you guys discuss the proposed format and see if there's anything else we may want to include with it? Even though this export is specifically designed for a new and upcoming service, I want to know if this would at least be a good place to start, as I can see it being very useful for other applications that may want to make use of fitting calculation results, not just fitting definition. :)

MaruMaruOO commented 6 years ago

Hey @molbal, so I guess just tell me what you think and what you'd like to see changed.

Here's another example in text format so you can easily copy/paste it: {"name": "Legion: LR 10MN beam", "ehp": {"shield": 4114.285714285715, "armor": 206895.65958708728, "hull": 5597.014925373134}, "droneDPS": 0, "droneVolley": 0, "hp": {"shield": 2250.0, "armor": 28555.031249999993, "hull": 2250.0}, "maxTargets": 6.0, "maxSpeed": 710.3681270138028, "weaponVolley": 1024.65, "totalVolley": 1024.65, "maxTargetRange": 199032.258695927, "scanStrength": 30.297187499999996, "weaponDPS": 237.18749999999997, "alignTime": 9.101239833837706, "signatureRadius": 128.25703125, "weapons": [{"dps": 237.18749999999994, "capUse": 11.286458333333332, "falloff": 13000.0, "type": "Turret", "name": "Heavy Beam Laser II, Aurora M", "optimal": 93150.0, "numCharges": 1, "numShots": 1000, "reloadTime": 0.01, "cycleTime": 4320.000000000001, "volley": 1024.65, "tracking": 2.9699999999999998, "maxVelocity": 0, "explosionDelay": 0, "damageReductionFactor": 0, "explosionRadius": 0, "explosionVelocity": 0, "aoeFieldRange": 0}], "scanRes": 357.2412109375, "capUsed": 20.986458333333335, "capRecharge": 22.569444444444446, "rigSlots": 3.0, "lowSlots": 7.0, "midSlots": 3.0, "highSlots": 7.0, "turretSlots": 6.0, "launcherSlots": 0.0, "powerOutput": 1650.0, "cpuOutput": 387.5, "rigSize": 2.0, "effectiveTurrets": 9.0, "effectiveLaunchers": 0.0, "effectiveDroneBandwidth": 0.0, "resonance": {"hull": {"exp": 0.402, "kin": 0.402, "therm": 0.402, "em": 0.402}, "armor": {"exp": 0.16192335254045878, "kin": 0.12814914924103638, "therm": 0.1480834613451976, "em": 0.11391035488092123}, "shield": {"exp": 0.21875, "kin": 0.39375, "therm": 0.7000000000000001, "em": 0.875}}, "typeID": 29986, "groupID": 0, "shipSize": "Cruiser", "droneControlRange": 60000.0, "mass": 22312500.0, "moduleNames": ["High Slots:", "Heavy Beam Laser II: Aurora M", "Heavy Beam Laser II: Aurora M", "Heavy Beam Laser II: Aurora M", "Heavy Beam Laser II: Aurora M", "Heavy Beam Laser II: Aurora M", "Heavy Beam Laser II: Aurora M", "Empty Slot", "", "Med Slots:", "10MN Afterburner II", "Tracking Computer II: Optimal Range Script", "Sensor Booster II: Targeting Range Script", "", "Low Slots:", "Damage Control II", "True Sansha Armor Kinetic Hardener", "True Sansha Armor Thermal Hardener", "Imperial Navy Energized Adaptive Nano Membrane", "True Sansha Armor EM Hardener", "Imperial Navy Energized Adaptive Nano Membrane", "1600mm Steel Plates II", "", "Rig Slots:", "Medium Trimark Armor Pump II", "Medium Trimark Armor Pump II", "Medium Trimark Armor Pump II", "", "Subsystems:", "Legion Propulsion - Wake Limiter", "Legion Core - Augmented Antimatter Reactor", "Legion Defensive - Augmented Plating", "Legion Offensive - Liquid Crystal Magnifiers", "", "Boosters:", "Agency Overclocker SB7 Dose III", "Strong X-Instinct Booster", "", "Command Fits:", "Damnation: armor links", "Damnation: information links", "Claymore: skirmish links"], "projections": [], "unpropedSpeed": 710.3681270138028, "unpropedSig": 128.25703125, "usingMWD": false, "mwdPropSpeed": 710.3681270138028}

edited for formatting by blitzmann:

{
   "name":"Legion: LR 10MN beam",
   "ehp":{
      "shield":4114.285714285715,
      "armor":206895.65958708728,
      "hull":5597.014925373134
   },
   "droneDPS":0,
   "droneVolley":0,
   "hp":{
      "shield":2250.0,
      "armor":28555.031249999993,
      "hull":2250.0
   },
   "maxTargets":6.0,
   "maxSpeed":710.3681270138028,
   "weaponVolley":1024.65,
   "totalVolley":1024.65,
   "maxTargetRange":199032.258695927,
   "scanStrength":30.297187499999996,
   "weaponDPS":237.18749999999997,
   "alignTime":9.101239833837706,
   "signatureRadius":128.25703125,
   "weapons":[
      {
         "dps":237.18749999999994,
         "capUse":11.286458333333332,
         "falloff":13000.0,
         "type":"Turret",
         "name":"Heavy Beam Laser II, Aurora M",
         "optimal":93150.0,
         "numCharges":1,
         "numShots":1000,
         "reloadTime":0.01,
         "cycleTime":4320.000000000001,
         "volley":1024.65,
         "tracking":2.9699999999999998,
         "maxVelocity":0,
         "explosionDelay":0,
         "damageReductionFactor":0,
         "explosionRadius":0,
         "explosionVelocity":0,
         "aoeFieldRange":0
      }
   ],
   "scanRes":357.2412109375,
   "capUsed":20.986458333333335,
   "capRecharge":22.569444444444446,
   "rigSlots":3.0,
   "lowSlots":7.0,
   "midSlots":3.0,
   "highSlots":7.0,
   "turretSlots":6.0,
   "launcherSlots":0.0,
   "powerOutput":1650.0,
   "cpuOutput":387.5,
   "rigSize":2.0,
   "effectiveTurrets":9.0,
   "effectiveLaunchers":0.0,
   "effectiveDroneBandwidth":0.0,
   "resonance":{
      "hull":{
         "exp":0.402,
         "kin":0.402,
         "therm":0.402,
         "em":0.402
      },
      "armor":{
         "exp":0.16192335254045878,
         "kin":0.12814914924103638,
         "therm":0.1480834613451976,
         "em":0.11391035488092123
      },
      "shield":{
         "exp":0.21875,
         "kin":0.39375,
         "therm":0.7000000000000001,
         "em":0.875
      }
   },
   "typeID":29986,
   "groupID":0,
   "shipSize":"Cruiser",
   "droneControlRange":60000.0,
   "mass":22312500.0,
   "moduleNames":[
      "High Slots:",
      "Heavy Beam Laser II: Aurora M",
      "Heavy Beam Laser II: Aurora M",
      "Heavy Beam Laser II: Aurora M",
      "Heavy Beam Laser II: Aurora M",
      "Heavy Beam Laser II: Aurora M",
      "Heavy Beam Laser II: Aurora M",
      "Empty Slot",
      "",
      "Med Slots:",
      "10MN Afterburner II",
      "Tracking Computer II: Optimal Range Script",
      "Sensor Booster II: Targeting Range Script",
      "",
      "Low Slots:",
      "Damage Control II",
      "True Sansha Armor Kinetic Hardener",
      "True Sansha Armor Thermal Hardener",
      "Imperial Navy Energized Adaptive Nano Membrane",
      "True Sansha Armor EM Hardener",
      "Imperial Navy Energized Adaptive Nano Membrane",
      "1600mm Steel Plates II",
      "",
      "Rig Slots:",
      "Medium Trimark Armor Pump II",
      "Medium Trimark Armor Pump II",
      "Medium Trimark Armor Pump II",
      "",
      "Subsystems:",
      "Legion Propulsion - Wake Limiter",
      "Legion Core - Augmented Antimatter Reactor",
      "Legion Defensive - Augmented Plating",
      "Legion Offensive - Liquid Crystal Magnifiers",
      "",
      "Boosters:",
      "Agency Overclocker SB7 Dose III",
      "Strong X-Instinct Booster",
      "",
      "Command Fits:",
      "Damnation: armor links",
      "Damnation: information links",
      "Claymore: skirmish links"
   ],
   "projections":[

   ],
   "unpropedSpeed":710.3681270138028,
   "unpropedSig":128.25703125,
   "usingMWD":false,
   "mwdPropSpeed":710.3681270138028
}
molbal commented 6 years ago

Hey @MaruMaruOO,

Yes, thank you! This is exactly what I am looking for. Since then we made progressed with the tool so that we copy some stats manually so no need to hurry at all now.

I see the moduleNames attribute resembles an EFT fit format but if you could change it a bit so that the list includes item item IDs then we could get everything from this export, no need to look up the item ids from the names

Thanks again!

blitzmann commented 6 years ago

Agreed, would be nice to have modules be a list of json object that give type name. Id, slot, and maybe a few more stats, No need for blank names and slot identifiers there in that case. Boosters maybe go to their own toplevel array, etc. I'm aware that's all depenant on whatever maru's service is expecting and if it's easy to change, that would obviously be your call maru.

Also, a top level format version may be very helpful, I can see this format changing and mutating as things progress, both with pyfa and EFS.

MaruMaruOO commented 6 years ago

First up a clarification. The top level "projections" array covers outgoing projections not incoming ones like the pyfa component of the same name. For example a fit with a tracking disruptor would look like this:

"projections": [
    {
        "type": "Weapon Disruptor",
        "optimal": 72000,
        "falloff": 36000,
        "trackingSpeedBonus": 0,
        "maxRangeBonus": -42.975,
        "falloffBonus": -42.975,
        "aoeCloudSizeBonus": 0,
        "aoeVelocityBonus": 0,
        "missileVelocityBonus": 0,
        "explosionDelayBonus": 0,
        "duration": 10000,
        "capacitorNeed": 13.5
     }
 ]

I assume it's a good idea to rename it and I plan to.

Hey @molbal, nice to hear it has a slightly wider use case. How would you feel about a separate array with a matching order like this?

'modTypeIDs': [
    3025, 3025, 3025, 3025, 3025, 3025, 12058, 1978, 1952, 2048, 13978, 
    13982, 15729, 13970, 15729, 20353, 31059, 31059, 31059, 45612,
     45623, 45587, 45598, 46006, 15459,  22474, 22474, 22468
]

It prevents having 50+ identical keys for every fit. It's also kinda handy to have moduleNames in that format: literallyatooltip Either way would you like the typeIDs for charges included? Out of curiosity is this for icons or something else?

@blitzmann With regards to modules as json objects. First I should make it clear that moduleNames are in no way used for simulations. It's actually there to remind people what went into the fit and none of the strings have any specific meaning to EFS. A quick trial of your suggestion with power, cpu and typeID also increased the total output length for our Legion by 57%. Overall I don't see much upside but if you have any use cases in mind I'd certainly like to hear them.

That's a really good point on the versioning. I'll add one in for the format itself along with one for pyfa.

molbal commented 6 years ago

Hi @MaruMaruOO Yeah a separate array with matching order is also perfect.

Thanks

MaruMaruOO commented 6 years ago

@molbal Excellent, I'll patch that in with the other changes before this is merged.