Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Accidentally) Importing a number will translate to a new ship... #87

Closed
blitzmann opened this issue Apr 30, 2014 · 1 comment
Closed

Comments

@blitzmann
Copy link
Collaborator

Copy the number 42 to your clipboard

Paste into Pyfa

New fit created: Spiced Wine - DNA Imported

This is because Pyfa defaults to DNA when no other importation method matches the incoming clipboard data. And when you do a DNA import, you split with : and then take the first number and get the item for that number. Item 42 is Spiced Wine, and that is fed into Pyfa's Ship class, which blindly accepts whatever Item it receives.

A cursory glance tell me that there is no current isShip or equivalent attribute or function to determine if an item is a ship or not. Modules don't have this problem, because as part of their __init__ they try to calculate slot, and if slot cannot be found it raises an error. This isn't much of a problem when Pyfa is the only one initializing Ship with data, but here we take user input and don't double check.

A quick fix would be make sure that DNA, when split, contains at least 3 elements (because DNA, as an EVE client standard, always ends with ::). Although many programs out there accept it without the trailing :: (including the eve client), I haven't seen one that exports without it, so it should be an easy and sane commit.

A proper fix would be to check at time of Ship.__init__ that it is indeed a ship. I'll poke around with it and see if there's an easy way to figure this out (via rig count? ship-specific attribute?).

@blitzmann
Copy link
Collaborator Author

Actually, it was very easy to enforce ships only in Ship.__init__.

Because of this, I think I'll forgo enforcing requirement of :: in DNA just in case there's a third part tool out there that exports it incorrectly. I'm going to keep DNA import the same for now.

Ebag333 added a commit to Ebag333/Pyfa that referenced this issue May 14, 2017
Enhancement: Revert last skill change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant