Compare commits

...

1144 Commits

Author SHA1 Message Date
DarkPhoenix
31cae0e54b Bump version 2020-06-18 17:28:02 +03:00
DarkPhoenix
b2cc3ae600 Update static data to 1751741 2020-06-18 13:52:46 +03:00
DarkPhoenix
62d1d6a06d Avoid crash when nothing is selected 2020-06-18 06:04:23 +03:00
DarkPhoenix
83fa567321 Pass primitives around instead of SQL Alchemy objects 2020-06-18 05:33:12 +03:00
DarkPhoenix
9b315b5870 Fix a few mistypes 2020-06-17 21:53:24 +03:00
DarkPhoenix
3094fd32fc Add destructible beacons to projected effects 2020-06-17 17:07:34 +03:00
DarkPhoenix
c3f1824a84 Rename charge export button 2020-06-16 21:06:42 +03:00
DarkPhoenix
b558ae3810 Add an option not to export charges to ESI 2020-06-15 23:38:07 +03:00
DarkPhoenix
c38f05902a Add alternate redo shortcut 2020-06-15 17:20:20 +03:00
DarkPhoenix
181e1e1e30 Make scanners active and expose data to misc column 2020-06-15 16:37:52 +03:00
DarkPhoenix
3fc26254ae bump version 2020-06-15 16:14:53 +03:00
DarkPhoenix
ca8822c455 Fix upwell ships' race 2020-06-15 16:14:20 +03:00
DarkPhoenix
4c55d32086 Update icons 2020-06-15 15:54:28 +03:00
DarkPhoenix
c13817708e Add vorton damage booster effect 2020-06-15 15:20:59 +03:00
DarkPhoenix
39cab4be72 Remove DB TDs from seen items 2020-06-15 15:00:36 +03:00
DarkPhoenix
f80473d073 Update static data to 1748920 2020-06-15 14:50:58 +03:00
DarkPhoenix
0d9be1b174 Merge branch 'singularity' 2020-06-15 14:42:13 +03:00
DarkPhoenix
83b0b3ff0e Fix jargon definitions for missile damage types 2020-06-13 12:33:06 +03:00
DarkPhoenix
c4b490907d Add alternate DNA format import 2020-06-12 02:20:32 +03:00
DarkPhoenix
f89fe4d5d7 Fix merge issue 2020-06-09 19:11:11 +03:00
DarkPhoenix
81dced03bf Disable ammo graph 2020-06-09 19:07:23 +03:00
DarkPhoenix
27d3bea8d8 Merge branch 'ammo_graph' into singularity
# Conflicts:
#	gui/targetProfileEditor.py
2020-06-09 19:04:20 +03:00
DarkPhoenix
7eaeea325d Bump version 2020-06-09 10:54:21 +03:00
DarkPhoenix
9695526352 Update staticdata to 1744483 2020-06-09 10:51:28 +03:00
DarkPhoenix
4f35bc38db Fix structure module drag'n'drop 2020-06-09 01:56:31 +03:00
DarkPhoenix
d9c7c1a0fd Fix burst projectors' misc column 2020-06-06 19:22:55 +03:00
DarkPhoenix
a94e66e5ed Invuln - alias for old invulns 2020-06-06 02:25:08 +03:00
DarkPhoenix
e9c41c6439 Add renders of 2/3 of new ships 2020-06-06 01:42:57 +03:00
DarkPhoenix
b24ceb95f5 Add missing icons 2020-06-05 22:22:03 +03:00
DarkPhoenix
6ba6e0f69b Implement skill and booster effects, and bump version 2020-06-06 01:09:55 +03:00
DarkPhoenix
9aca49e539 Add damage mod effect and gun application readout 2020-06-06 00:25:19 +03:00
DarkPhoenix
01f1cdb175 Implement gun effect and its support in graphs 2020-06-06 00:11:36 +03:00
DarkPhoenix
c1356906bb Add ship effects 2020-06-05 23:36:39 +03:00
DarkPhoenix
8229537e5f Run effect used by script 2020-06-05 22:50:34 +03:00
DarkPhoenix
6cfa2161ec Add conversions for amplifier tiericide 2020-06-05 22:47:13 +03:00
DarkPhoenix
fa3cf46786 Update static data to 1742848 2020-06-05 22:28:25 +03:00
DarkPhoenix
ac40dfd018 Update version again 2020-05-26 16:07:01 +03:00
DarkPhoenix
4c32d559bb Bump version 2020-05-26 16:04:51 +03:00
DarkPhoenix
02ee12586f Adjust jargon definitions to new realities 2020-05-26 16:03:48 +03:00
DarkPhoenix
496f15a83e Add conversions/migrations 2020-05-26 15:50:52 +03:00
DarkPhoenix
acf6af8f95 Update effect definitions and headers to all the renamed items 2020-05-26 15:30:50 +03:00
DarkPhoenix
225b00b9ff Update staticdata to 1733182 and update DB generation script 2020-05-26 15:22:08 +03:00
DarkPhoenix
7f2b7415ea Disable evemarketdata price source 2020-05-14 15:10:04 +03:00
DarkPhoenix
d1d9ae4dac Add fuzzwork as price data source 2020-05-14 15:09:38 +03:00
DarkPhoenix
ac7ccfb6a3 Change how double-clicking ammo behaves 2020-05-04 19:18:14 +03:00
DarkPhoenix
05c2c41762 Destroy effective label when switching from firepower to mining view, and add it back to correct position when needed 2020-05-04 13:46:52 +03:00
DarkPhoenix
10f5133282 Revert "Disable system theme for listctrls on windows"
This reverts commit 42658a8167.
2020-04-27 13:55:30 +03:00
DarkPhoenix
42658a8167 Disable system theme for listctrls on windows 2020-04-26 23:27:28 +03:00
DarkPhoenix
6dbf38dbb4 Revert "Switch to wxpython 4.1.0". Refer to #2179 for more info on
reasons

This reverts commit 15fe8f6261.
2020-04-25 17:37:29 +03:00
DarkPhoenix
64306e2366 Align attribute icons the same way as input boxes in target profile
editor
2020-04-25 17:29:29 +03:00
DarkPhoenix
f259df85cd Fix editors 2020-04-25 17:27:29 +03:00
DarkPhoenix
1090589cb2 Fix preferences for wx 4.1.0 2020-04-25 17:19:05 +03:00
DarkPhoenix
29e09fcdda Fix abyssal item slider on windows 2020-04-25 12:36:45 +03:00
DarkPhoenix
36fd4aeaff Redo fix for 2176 2020-04-25 15:14:27 +03:00
DarkPhoenix
c46a59e3b1 Fix gauge bars 2020-04-25 09:57:49 +03:00
DarkPhoenix
8a3a21972a Fix error dialog layout 2020-04-25 09:40:50 +03:00
DarkPhoenix
6839669e04 Remove a few flags the new wx complains about 2020-04-25 09:36:40 +03:00
DarkPhoenix
5645e20505 Do not float auxiliary windows on parent if there is no parent 2020-04-25 09:29:14 +03:00
DarkPhoenix
15fe8f6261 Switch to wxpython 4.1.0 2020-04-25 09:26:47 +03:00
DarkPhoenix
855fafa94d Bump version 2020-04-24 15:35:52 +03:00
DarkPhoenix
4e10335ae7 Revert "Try resetting locale on wx 4.0.6 as an attempt to work around #2174"
This reverts commit ea07bbf4f9.
2020-04-24 15:10:33 +03:00
DarkPhoenix
21ea9ce579 "Move" attributes at DB generation time 2020-04-24 15:10:00 +03:00
DarkPhoenix
ea07bbf4f9 Try resetting locale on wx 4.0.6 as an attempt to work around #2174 2020-04-24 11:37:27 +03:00
DarkPhoenix
8eed6fbe21 Ignore mutations with 0 base value 2020-04-23 19:47:57 +03:00
DarkPhoenix
0859f2fbe9 Hide limited synth boosters 2020-04-22 02:27:20 +03:00
DarkPhoenix
71ba33edeb Fix tail clear method 2020-04-21 19:00:44 +03:00
DarkPhoenix
ce80d92b35 Limit amount of fits returned by search by 100 2020-04-21 11:16:06 +03:00
DarkPhoenix
f17cf9b736 Fix undo for fill with module (which was caused by module add command not being undone properly in case of failure) 2020-04-20 16:36:16 +03:00
DarkPhoenix
98579c774b Change shortcuts for undo/redo from built-in wx standards to ctrl-z and ctrl-y 2020-04-20 14:42:32 +03:00
DarkPhoenix
509fa279e7 Initialize session container with main thread session 2020-04-17 19:15:47 +03:00
DarkPhoenix
091ee87761 Update char list when new character gets added 2020-04-17 13:31:15 +03:00
DarkPhoenix
c0c20cc92e Remove skill refresh button 2020-04-17 13:27:51 +03:00
DarkPhoenix
1341f7bca1 Make some jargon replacements a bit looser 2020-04-17 11:27:28 +03:00
DarkPhoenix
fe93db1d4b Round booster side-effect context menu 2020-04-17 00:25:33 +03:00
DarkPhoenix
5db97ea773 Bump version 2020-04-16 22:46:45 +03:00
DarkPhoenix
1758e4f320 Rework fix for projection, so that it does not recalculate projected fits too early 2020-04-16 22:25:10 +03:00
DarkPhoenix
1a897c0419 Pass search results as set of item IDs 2020-04-16 15:13:32 +03:00
DarkPhoenix
32db3e3179 Create scoped gamedata sessions 2020-04-16 15:01:00 +03:00
DarkPhoenix
d830a8957a Bump version 2020-04-15 16:54:24 +03:00
DarkPhoenix
652ea48223 Accept 0 free slots for guns which have already been fitted 2020-04-15 16:53:03 +03:00
DarkPhoenix
8c25b2b8f5 Make sure it's impossible to add extra cap boosters via dragging too 2020-04-15 15:40:54 +03:00
DarkPhoenix
db4c56be8e Bump version 2020-04-15 15:27:19 +03:00
DarkPhoenix
f3bcffe2f9 Implement fax cap booster limit 2020-04-15 15:23:49 +03:00
DarkPhoenix
bc5786d099 Update static data to 1706308 2020-04-15 14:50:55 +03:00
DarkPhoenix
5959fe5daf Ignore case when searching for implant sets to allow some inconsistencies on CCP side 2020-04-14 15:28:40 +03:00
DarkPhoenix
649d338bb1 Split implants and boosters in EFT and multibuy exports 2020-04-14 11:36:08 +03:00
DarkPhoenix
dcb058a718 Update existing character if character with the same name exists 2020-04-13 12:52:02 +03:00
DarkPhoenix
1772bb5e7f Merge branch 'master' into singularity 2020-04-13 12:45:25 +03:00
Anton Vorobyov
30bd0adb06 Merge pull request #2159 from soro/auto_create_char
Regarding #2045: automatically create a character for a new sso character
2020-04-12 22:49:01 +03:00
DarkPhoenix
44dfcf771c Ensure projected fits get recalculated, since they get checkStates'd anyway 2020-04-11 02:26:17 +03:00
DarkPhoenix
a1f8a7a930 Fix escaping in regex search 2020-04-11 01:33:53 +03:00
Soeren Roerden
b22887dfad automatically create a character for a new sso character and add button to retrieve all chars directly linked to existing sso characters 2020-04-10 21:12:38 +02:00
DarkPhoenix
28137fa3f4 Remove excessive space 2020-04-10 13:11:04 +03:00
DarkPhoenix
9cbdc6055d Add search timer to attribute overrides to prevent hangs 2020-04-10 11:52:57 +03:00
DarkPhoenix
fc93c61fcf Add more entries 2020-04-10 11:31:17 +03:00
DarkPhoenix
3fa2e7ebd1 More additions to jargon 2020-04-10 06:07:33 +03:00
DarkPhoenix
818628da0c Finalize new jargon dictionary 2020-04-10 05:53:24 +03:00
DarkPhoenix
adf90a8263 Split basic and regex search functions 2020-04-10 00:57:41 +03:00
DarkPhoenix
362923ac64 Overhaul jargon dictionary (some entries are still missing) 2020-04-09 23:29:51 +03:00
DarkPhoenix
7d73838ce1 Change the way user definitions are used 2020-04-08 14:06:49 +03:00
DarkPhoenix
b3278ca9ec Tokenize regexp requests taking into consideration regexp context 2020-04-08 13:24:48 +03:00
DarkPhoenix
5707914ad5 Make use of regex for search 2020-04-08 03:17:25 +03:00
DarkPhoenix
9b697b24d8 Implement regexp function for gamedata 2020-04-08 02:34:28 +03:00
DarkPhoenix
098b088da6 Bump version 2020-04-07 21:39:24 +03:00
DarkPhoenix
14d62f31e1 Add conversions for names 2020-04-07 21:37:40 +03:00
DarkPhoenix
e7b1f55d08 Update static data to 1702461 2020-04-07 20:59:07 +03:00
DarkPhoenix
8f501896a1 Give separate axis selector and axis label names to make it clearer what the graphs do 2020-04-07 20:37:28 +03:00
DarkPhoenix
befcb9b874 Un-hide and un-fuck bumping graphs 2020-04-07 20:14:06 +03:00
DarkPhoenix
c70afa9a4c Hide experimental bumping graphs 2020-04-07 18:25:40 +03:00
DarkPhoenix
029c7dd4c2 Recalculate fit when overrides are toggled 2020-04-07 18:05:43 +03:00
DarkPhoenix
1f83dba1ac Add missing hidden imports to platform-specific specifications 2020-04-07 18:00:17 +03:00
DarkPhoenix
6eae3405fd Add hidden import for newer version of setuptools 2020-04-07 17:39:24 +03:00
DarkPhoenix
c0e1d9e4de Attempt to use newer version of setuptools 2020-04-07 17:09:59 +03:00
DarkPhoenix
7c0bd7aa88 Leave only setuptools override 2020-04-07 16:41:28 +03:00
DarkPhoenix
394583584c Remove some of hardcoded libraries for MacOS X build 2020-04-07 15:08:30 +03:00
DarkPhoenix
4112e2aa6b Debugging Mac OS X build, step 1 2020-04-07 14:17:55 +03:00
DarkPhoenix
aa19e0da72 Add bunch of experimental graphs related to bumping 2020-04-07 13:46:28 +03:00
DarkPhoenix
bba9be1598 Add momentum graphs 2020-04-07 10:50:12 +03:00
DarkPhoenix
17998916b4 Bump version 2020-04-06 22:24:06 +03:00
DarkPhoenix
543089bcd9 Add context menu support for predefined implant sets 2020-04-06 22:20:28 +03:00
DarkPhoenix
7f35c78a65 Add data about implant sets to eve.db 2020-04-06 21:01:20 +03:00
DarkPhoenix
b25798dd83 Update effects 2020-04-06 20:14:19 +03:00
DarkPhoenix
744b9ff78a Updated staticdata to 1701385 2020-04-06 19:19:06 +03:00
DarkPhoenix
8dc1457ebb Change the way zip file is generated 2020-04-06 15:09:06 +03:00
DarkPhoenix
982ad54fab Merge branch 'Metallicow-optimize-images' 2020-04-06 15:29:10 +03:00
DarkPhoenix
912192cd7d Merge branch 'optimize-images' of https://github.com/Metallicow/Pyfa into Metallicow-optimize-images 2020-04-06 15:26:32 +03:00
DarkPhoenix
74cd6d48da Show propmpt to creade damage patterns when there're none 2020-04-06 11:14:21 +03:00
DarkPhoenix
3467a7fe3f Update static data to 1684558 2020-03-11 17:01:34 +03:00
DarkPhoenix
eb269a05ed Bump version 2020-03-10 19:39:22 +03:00
DarkPhoenix
c63cf4b3b0 Add cap booster conversions 2020-03-10 19:19:13 +03:00
DarkPhoenix
11ed94454d Update staticdata to 1683031 2020-03-10 19:07:42 +03:00
DarkPhoenix
8df07645da Show RR power for uncharged ancillary RRs 2020-03-06 00:50:18 +03:00
DarkPhoenix
5666fdd250 Bump version 2020-02-27 15:24:45 +03:00
DarkPhoenix
0b55ae40fc Update staticdata to 1675961 2020-02-27 15:09:54 +03:00
DarkPhoenix
3726e84697 Add dbuffcollections (just to have overview of changed fleet buffs when stuff changes) 2020-02-20 13:31:18 +03:00
DarkPhoenix
a0c4341102 Fix ECM range rigs affecting ECM bursts with penalty 2020-02-17 23:42:48 +03:00
Metallicow
cd6b1038e8 optimize all pngs 2020-02-13 14:58:27 -06:00
DarkPhoenix
10583fd506 Update fighter additions tab icon 2020-02-13 17:25:40 +03:00
DarkPhoenix
713694be56 Bump version 2020-02-13 17:00:58 +03:00
DarkPhoenix
f50293cf77 Revert to wxpython 4.0.6 once again (see issue 2136) 2020-02-13 16:57:23 +03:00
DarkPhoenix
7c88fa477f Bump version 2020-02-13 12:20:03 +03:00
DarkPhoenix
f8df540fad Use newer wxpython version once again 2020-02-13 12:19:37 +03:00
DarkPhoenix
61a01805cc Reset locale and remove resolution data from all the images (wxpython phoenix issue #1515) 2020-02-13 12:14:26 +03:00
Metallicow
a93915cf04 trim trailing whitespace 2020-02-12 16:14:12 -06:00
DarkPhoenix
0f74c97fbf Temporarily revert python version to 3.7 2020-02-12 18:31:44 +03:00
DarkPhoenix
29713b69dc Fix the hack 2020-02-12 18:25:17 +03:00
DarkPhoenix
cc3c2cb9c8 Add hack to build wx on windows 2020-02-12 18:22:31 +03:00
DarkPhoenix
b36a3959da Revert wxpython version to 4.0.6 2020-02-12 18:18:18 +03:00
DarkPhoenix
3b26bfc0e9 Add missing entries to migration 2020-02-11 17:02:00 +03:00
DarkPhoenix
c59b621963 Add capacitor transfer tiericide conversion entries 2020-02-11 16:52:15 +03:00
DarkPhoenix
977a8fa329 Update staticdata to 1663997 2020-02-11 16:20:08 +03:00
DarkPhoenix
a5226fee83 Merge branch 'singularity' 2020-02-11 16:08:46 +03:00
DarkPhoenix
aec5a46452 Fix shebang line 2020-02-05 09:43:10 +03:00
DarkPhoenix
588f9a4490 Re-use market service item sorting for attribute overrides 2020-02-04 01:48:13 +03:00
DarkPhoenix
4ba948c6f9 Merge branch 'master' into ammo_graph
# Conflicts:
#	gui/builtinMarketBrowser/itemView.py
#	service/market.py
2020-02-04 01:43:52 +03:00
DarkPhoenix
e4069a3988 Update AppVeyor deploy oauth key after repo transfer 2020-02-04 00:41:03 +03:00
DarkPhoenix
6527f9e11e Attempt to terminate threads when pyfa is closed 2020-02-03 17:12:23 +03:00
DarkPhoenix
9ddfcc894f Make sure not to catch keyboard interrupts and system exits 2020-02-03 16:12:41 +03:00
DarkPhoenix
f22a4f13e5 Allow pasting non-mutated modules via ctrl-v 2020-02-03 15:54:22 +03:00
DarkPhoenix
fc9337df67 Add more info prints to mac os packaging scripts 2020-02-03 13:37:27 +03:00
DarkPhoenix
98a8332cfa Change the way we update pip for mac os builds 2020-02-03 13:33:26 +03:00
DarkPhoenix
a78eedad48 Remove unused files 2020-02-03 13:30:04 +03:00
DarkPhoenix
85e1a1bd06 Use newer image version for mac builds 2020-02-03 13:25:51 +03:00
DarkPhoenix
25b2c04309 Do not set environment variable as it's not used anymore 2020-02-03 13:23:56 +03:00
DarkPhoenix
54a84d0e42 Do not attempt to install custom python version, just use system default 2020-02-03 13:23:13 +03:00
DarkPhoenix
af0a4d1def Update travis deployment key 2020-02-03 13:11:48 +03:00
DarkPhoenix
97cdde84ce Uninstall not when setup just begins, but right before install begins 2020-02-03 06:17:28 +03:00
DarkPhoenix
a65129b277 Fix function definition order in inno setup script 2020-02-03 06:06:25 +03:00
DarkPhoenix
3b40a49918 Uninstall previous pyfa version unconditionally 2020-02-03 05:59:29 +03:00
DarkPhoenix
d95345b476 Insist on uninstalling old pyfa versions when next one is about to be installed 2020-02-02 23:48:06 +03:00
DarkPhoenix
2ba2d95017 Change clone depth to 400 on appveyor 2020-02-02 14:46:26 +03:00
DarkPhoenix
4d0ffedcc8 Install in 64 bit mode on Windows 2020-02-02 11:07:20 +03:00
DarkPhoenix
84abde4fc5 Some OCD in echoes + testing if build is started after webhook removal 2020-02-02 04:22:41 +03:00
DarkPhoenix
8897f1e4b1 Use my credentials when uploading builds to releases 2020-02-02 04:08:10 +03:00
DarkPhoenix
6f33cacb7a Clean up appveyor file 2020-02-02 03:54:52 +03:00
DarkPhoenix
b1a8c0ad09 Disable appveyor's RDP setup as it's a security hole 2020-02-02 03:40:20 +03:00
DarkPhoenix
13ed635803 We do not care if all PR builds will be built 2020-02-02 03:38:43 +03:00
DarkPhoenix
5a44909ebf Remove appveyor environment preparation which is not needed anymore 2020-02-02 03:13:57 +03:00
DarkPhoenix
6cbb80693d Switch to powershell echo 2020-02-02 03:04:53 +03:00
DarkPhoenix
0b90d254f9 Try another approach in echo'ing 2020-02-02 02:53:18 +03:00
DarkPhoenix
641d36205c Remove quotes from echo commands 2020-02-02 02:47:14 +03:00
DarkPhoenix
6e38b6ea4d Fix path to windows SDK once again 2020-02-02 02:38:26 +03:00
DarkPhoenix
84b4d8fabb Change windows SDK location 2020-02-02 02:03:23 +03:00
DarkPhoenix
c0e1f7e746 Fix mistype 2020-02-01 15:36:33 +03:00
DarkPhoenix
d734c12168 Try to find out when listing windows SDKs fails 2020-02-01 15:34:14 +03:00
DarkPhoenix
340d94eb3e Specify image in apprveyor file 2020-02-01 15:09:47 +03:00
DarkPhoenix
9b0b31648c Add debugging prints to see appveyor's OS version 2020-02-01 02:38:00 +03:00
DarkPhoenix
8346358c37 Fix appveyor script slashes 2020-02-01 02:24:09 +03:00
DarkPhoenix
b935700a12 Bump INNO setup version 2020-02-01 01:56:26 +03:00
DarkPhoenix
2f4a5a4830 Fix improper use of operator "is" when comparing to literal values 2020-01-31 18:16:36 +03:00
DarkPhoenix
e951ce8e9d Bump version 2020-01-31 18:06:28 +03:00
DarkPhoenix
fc6d42f483 Update effects 2020-01-31 17:59:50 +03:00
DarkPhoenix
7df1431ad2 Update staticdata to 1657583 2020-01-31 17:40:51 +03:00
DarkPhoenix
4d4680961e Bump versions of multiple packages 2020-01-31 16:08:24 +03:00
DarkPhoenix
1cae99b812 Remove VC 9.0 tools manifest
We're using newer version now, and we will see later if dependency section in manifest is needed
2020-01-31 16:07:26 +03:00
DarkPhoenix
3727d19311 In attribute editor what is you see is what you get now 2020-01-31 10:32:18 +03:00
DarkPhoenix
c45c093f4f Return search results as list to avoid various issues 2020-01-31 10:04:35 +03:00
DarkPhoenix
b613d3e312 Use market sorting in attribute override editor 2020-01-31 00:37:35 +03:00
DarkPhoenix
4cff9247b0 Always include ships and citadels in override editor output 2020-01-31 00:13:40 +03:00
DarkPhoenix
b9a26ec28d Do not return items from all the categories in overrides editor searches 2020-01-31 00:00:05 +03:00
DarkPhoenix
245f81e888 Actually make appveyor to use 64 bit python 2020-01-30 13:55:30 +03:00
DarkPhoenix
204c1ba9f2 Switch windows build to be 64 bits 2020-01-30 13:45:49 +03:00
DarkPhoenix
a7a4be133c Bump pyinstaller version once again 2020-01-30 13:04:49 +03:00
DarkPhoenix
14f9a46d7a Remove MPL hook 2020-01-30 11:59:04 +03:00
DarkPhoenix
003dd040dc Bump matplotlib version 2020-01-30 11:51:27 +03:00
DarkPhoenix
97cf53217e Bump python version to 3.8 2020-01-30 11:09:11 +03:00
DarkPhoenix
7c1805826d Fix mino and apostle RR effects affecting subcap modules 2020-01-29 16:11:30 +03:00
DarkPhoenix
d6a2b4dfc4 Fix projected system-wide effects menu after multiple renames 2020-01-29 15:58:02 +03:00
DarkPhoenix
d70952520a Update effects 2020-01-29 15:41:55 +03:00
DarkPhoenix
a57867b806 Update static data to 1655541 2020-01-29 15:18:07 +03:00
DarkPhoenix
17d7583cfc Remove overrides which are not needed 2020-01-29 12:54:23 +03:00
DarkPhoenix
55ad95081b Fix alternate tree display in case units did not have display names 2020-01-28 15:16:48 +03:00
DarkPhoenix
da8da1759f Bump version 2020-01-28 14:59:20 +03:00
DarkPhoenix
b4e758b9ee Add new and old but missing conversions 2020-01-28 14:58:54 +03:00
DarkPhoenix
3ba41db699 Update data to 1655072 2020-01-28 14:39:35 +03:00
DarkPhoenix
cfc47cf483 When learning skill in character editor, learn all the prerequisites 2020-01-27 11:44:20 +03:00
DarkPhoenix
38c8be995b Add even more condensed tooltip version (not used yet) 2020-01-24 17:56:07 +03:00
DarkPhoenix
492207700b Force pyinstaller to 3.3 on mac as well 2020-01-21 22:17:29 +03:00
DarkPhoenix
b69adefbf8 Restore matplotlib pyinstaller hook which is still needed in 3.3 2020-01-21 22:00:08 +03:00
DarkPhoenix
361299f51e Bump version 2020-01-21 21:51:02 +03:00
DarkPhoenix
025091c3f6 Roll back pyinstaller to 3.3 for windows builds 2020-01-21 21:50:10 +03:00
DarkPhoenix
a54d70036b Bump version number 2020-01-21 15:32:16 +03:00
DarkPhoenix
9e67b5962c Update the way we update pip on appveyor 2020-01-21 15:31:48 +03:00
Anton Vorobyov
ed0c080163 Merge pull request #2123 from Neugeniko/master
Update Invasion Damage Profiles due to npc changes.
2020-01-21 15:26:53 +03:00
DarkPhoenix
eacc97160b Merge branch 'master' into ammo_graph 2020-01-21 15:25:39 +03:00
Neugeniko
21389d84fc Update Invasion Damage Profiles due to npc changes.
#2122
2020-01-21 23:17:37 +11:00
DarkPhoenix
0fe54631ad Update staticdata to 1651039 2020-01-21 15:00:21 +03:00
DarkPhoenix
36ea5200f2 Remove pyinstaller from requirements as it's needed just for packaging 2020-01-21 13:33:17 +03:00
DarkPhoenix
d9934160a6 Compatibility with pyinstaller 2020-01-21 13:30:48 +03:00
DarkPhoenix
b9c92c48d3 Bump wx version 2020-01-17 17:15:21 +03:00
DarkPhoenix
6d23df6156 Fix on-effect resistance definition 2020-01-17 16:08:55 +03:00
DarkPhoenix
a913ab72c2 Bump version of pyinstaller to avoid security issues 2020-01-17 11:14:28 +03:00
DarkPhoenix
f6d33a2ac1 Use effect IDs rather than effect amount when deciding if we should rebuild abilities 2020-01-16 19:02:10 +03:00
DarkPhoenix
5a3fec33a7 Bump version 2020-01-16 16:26:19 +03:00
DarkPhoenix
95734aca2c Add fighter AB effect 2020-01-16 16:19:37 +03:00
DarkPhoenix
377254be9d Add nirvana effects 2020-01-16 16:09:17 +03:00
DarkPhoenix
ad9905a5e0 Add shield booster tieritice conversions 2020-01-16 15:46:30 +03:00
DarkPhoenix
6fc5a9699e Add slave as jargon entry for amulets 2020-01-16 15:39:54 +03:00
DarkPhoenix
0ee86f4836 Add slaves to renames dictionary 2020-01-16 15:34:56 +03:00
DarkPhoenix
85593367f7 Remove single-precition workaround and update data to 1646988 2020-01-16 15:19:39 +03:00
DarkPhoenix
465ea61b06 Merge branch 'singularity' 2020-01-16 14:57:44 +03:00
DarkPhoenix
2d5507e951 Force faction structure neut to be variation of t1 item 2020-01-08 00:47:56 +03:00
DarkPhoenix
84e20be153 Add auto targeting system to list of mods which do not get online by default 2020-01-04 19:32:31 +03:00
DarkPhoenix
60080c02b0 Fix red giant ecm bonus 2020-01-02 22:11:16 +03:00
DarkPhoenix
2a0d4179d0 Make script effect passive 2020-01-02 22:03:05 +03:00
DarkPhoenix
6dd55e0cd4 Move sansha incursion and sleeper profile one level up, as there are not too many 2019-12-28 21:48:56 +03:00
Anton Vorobyov
0adc6e0c6f Merge pull request #2113 from Neugeniko/master
Add Abyssal/Invasion Damage and Target Profiles.
2019-12-28 21:45:51 +03:00
Neugeniko
e155356701 Add Invasion & Abyssal Target Profiles 2019-12-29 00:28:48 +11:00
Neugeniko
ef44b50980 Add Abyssal & Invasion Damage Profile 2019-12-29 00:26:39 +11:00
DarkPhoenix
6785d16c87 More mods not activated by default 2019-12-28 04:22:11 +03:00
DarkPhoenix
76c670b7d5 Do not activate several categories of modules on fitting 2019-12-28 03:53:02 +03:00
DarkPhoenix
717303a72f Allow to put separate charges into citadel cargo 2019-12-27 12:39:37 +03:00
DarkPhoenix
e13125b174 Enable sigamp tooltip for citadels 2019-12-27 12:35:51 +03:00
DarkPhoenix
8aa7964b81 Do not show effective cap stats for ships with 100% neut resist (citadels) 2019-12-27 12:27:30 +03:00
DarkPhoenix
5e5f23d296 Show DG standup ECM as variation of t1 module 2019-12-26 12:28:01 +03:00
DarkPhoenix
05837f99ff Change order of structure meta levels 2019-12-26 12:26:25 +03:00
DarkPhoenix
70f620c2c3 Fix unit name processing 2019-12-25 01:33:43 +03:00
DarkPhoenix
10ffb987ea Detect concord race and show appropriate icon 2019-12-23 17:02:34 +03:00
DarkPhoenix
13ed785551 Drop tank stats on factor reload toggle 2019-12-23 13:26:23 +03:00
DarkPhoenix
69d2e38647 Use modified item attributes to show ancillary tank modules reload time 2019-12-23 13:17:08 +03:00
DarkPhoenix
c45abbdbcf Use new table as source for skill requirement data 2019-12-19 20:44:17 +03:00
DarkPhoenix
2655b001a9 Add new skillrequirement file 2019-12-19 19:56:23 +03:00
DarkPhoenix
3c7f4edb1b Fix replacements generation 2019-12-19 16:41:49 +03:00
DarkPhoenix
663cbab401 More updates to the script, and data update as well 2019-12-19 16:24:45 +03:00
DarkPhoenix
897ca9ca43 Update DB script to be able to work with sisi data 2019-12-19 15:56:57 +03:00
DarkPhoenix
b31a071859 Fix crashes related to target profiles / damage patterns 2019-12-17 13:10:41 +03:00
DarkPhoenix
8c2788fd78 Do not show implant set editor if user cancels addition of an implant set 2019-12-16 18:06:03 +03:00
DarkPhoenix
dee8fa400c Allow to override menu visibility settings with control key 2019-12-16 16:29:42 +03:00
DarkPhoenix
2339327473 Do some renames 2019-12-16 13:59:41 +03:00
Anton Vorobyov
f6f9239dd5 Merge pull request #2103 from Gochim/issue/2073
Issue #2073: Added ability to add a list of implants from implant view to a new implant set
2019-12-16 13:55:00 +03:00
DarkPhoenix
cd4c8c8c10 Do not save changes when changes were reverted 2019-12-16 13:42:49 +03:00
DarkPhoenix
c25eda8b64 Do not save mutated values when user did not touch them (and they were altered due to rounding) 2019-12-16 13:11:18 +03:00
Gochim
b6edf0e034 Issue #2073: Fixed a stuck in character editor 2019-12-12 18:03:45 +02:00
Gochim
af4277fc7e Issue #2073: Fixed name of a popup menu item for implant tab 2019-12-12 17:57:03 +02:00
Gochim
acd774abe5 Issue #2073: Fixed Codacy warning 2019-12-12 14:02:31 +02:00
Gochim
9081353634 Issue #2073: Final tweaks on implementation 2019-12-11 07:51:31 +02:00
Gochim
9c7fa37a72 Issue #2073: Added functionality to add all implants in fit implant tab to implant set list 2019-12-10 18:14:13 +02:00
Gochim
d92e11893a Issue #2073: Added mechanism to pass implant list to implant set manager 2019-12-10 08:50:21 +02:00
Gochim
f55ab00bf5 Fixed error message text in EntityEditor 2019-12-10 08:18:01 +02:00
DarkPhoenix
36265aa2a3 Add comment about built-in pattern order 2019-12-07 15:52:10 +03:00
DarkPhoenix
bfedcdbffd Simplify code a little 2019-12-07 15:42:26 +03:00
DarkPhoenix
a5d10c4a76 Change sorting of built-in damage profiles 2019-12-07 15:41:07 +03:00
DarkPhoenix
78423f67dd Merge branch 'master' into ammo_graph 2019-12-07 03:34:26 +03:00
DarkPhoenix
2962ce1945 Ensure 0%-100% spoolup is sorted properly 2019-12-07 03:07:49 +03:00
DarkPhoenix
0063d2955e Add info on invasion ships 2019-12-07 02:53:48 +03:00
DarkPhoenix
9787a18666 Fix issue with inability to right-click user-defined target profiles in graph window 2019-12-07 02:47:24 +03:00
DarkPhoenix
d8cd3197b5 Show short profile name in graphs 2019-12-07 02:43:53 +03:00
DarkPhoenix
e07c4f65ab Allow to have square brackets in profile name 2019-12-07 02:19:24 +03:00
DarkPhoenix
c3108f773a Use uniform as default resists profile, if no resist profile can be fetched 2019-12-07 01:29:15 +03:00
DarkPhoenix
a400821268 Remove "database defaults" 2019-12-07 01:21:46 +03:00
DarkPhoenix
ca4bac07da Implement switching between user and builtin patterns 2019-12-07 01:17:41 +03:00
DarkPhoenix
0038eacc3f Add database migration to add new columns which are used to refer builting profiles 2019-12-07 00:50:35 +03:00
DarkPhoenix
4bd633a0d4 Process names on pattern objects themselves 2019-12-06 23:24:29 +03:00
DarkPhoenix
ee837f0b04 Add comment about ideal target profile 2019-12-06 20:07:08 +03:00
DarkPhoenix
016e18cc89 Set negative IDs to all hardcoded entities 2019-12-06 20:04:56 +03:00
DarkPhoenix
1d6ac53183 Make target profile adder multi-level 2019-12-06 20:00:53 +03:00
DarkPhoenix
1e32dfa463 Always show target resist switcher 2019-12-06 19:35:20 +03:00
DarkPhoenix
4431753570 Reimplement switcher to use built-ins too and be multi-level 2019-12-06 17:59:44 +03:00
DarkPhoenix
6fdb57318c Expose builtin target profiles to service 2019-12-06 17:14:12 +03:00
DarkPhoenix
649db019de Add builtin fetcher for target profiles 2019-12-06 16:58:58 +03:00
DarkPhoenix
1d528be0ef Add target profile builtins as well 2019-12-06 14:45:46 +03:00
DarkPhoenix
2d6f6df83d Store built-in damage patterns in dictionary rather than in list 2019-12-06 14:25:27 +03:00
DarkPhoenix
7fa998f276 Avoid duplicating names in context menu 2019-12-06 02:59:14 +03:00
DarkPhoenix
6a3157a4c8 Add hardcoded damage patterns to damage pattern definition module 2019-12-06 02:47:11 +03:00
DarkPhoenix
74efa50576 Add multi-level menu support for incoming damage patterns 2019-12-06 02:11:32 +03:00
DarkPhoenix
61e32d0b1b Merge branch 'ammo_graph' of github.com:pyfa-org/Pyfa into ammo_graph 2019-12-06 01:09:16 +03:00
DarkPhoenix
bf04d26a7b Remove duplicate code 2019-12-06 01:08:11 +03:00
DarkPhoenix
e99be78c54 Partially rework damage pattern switcher 2019-12-05 20:04:50 +03:00
DarkPhoenix
e386232de1 Gather data on damage patterns into single object 2019-12-05 10:44:26 +03:00
DarkPhoenix
a15896044d Show cap delta detailed info even when fit has no cap use 2019-12-05 10:14:30 +03:00
DarkPhoenix
72c74513ce Add excessive effective cap gain to tooltip 2019-12-04 22:21:25 +03:00
DarkPhoenix
34d6d13cb2 Avoid extra indentation in non-spool version of the tooltip 2019-12-03 20:01:25 +03:00
DarkPhoenix
323bb8e064 Change layout once again 2019-12-03 19:57:40 +03:00
DarkPhoenix
b628f8ef9b Change layout of the tooltip 2019-12-03 19:45:49 +03:00
DarkPhoenix
1900216d36 Show spoolup part before damage distribution 2019-12-03 16:31:21 +03:00
DarkPhoenix
c045ed81c1 Do not show spoolup mark when fit has no spoolup weapons 2019-12-03 16:21:16 +03:00
DarkPhoenix
39edec60e3 Add damage type info to firepower panel tooltips 2019-12-03 16:15:05 +03:00
Gochim
259214e907 Issue #2073: Added popup menu item 2019-12-03 09:23:54 +02:00
DarkPhoenix
2e1c53392d Keep hull energizers online upon addition 2019-12-02 11:41:13 +03:00
DarkPhoenix
7a77d12686 Use built-in curl timeouts instead of coreutils 2019-11-27 16:35:22 +03:00
DarkPhoenix
763a7714ed Use proper timeout on Mac OS 2019-11-27 16:06:31 +03:00
DarkPhoenix
e89f35d654 Do not fail Mac OS build if upload fails 2019-11-27 15:56:57 +03:00
DarkPhoenix
3196751b7a Bump version 2019-11-27 15:11:26 +03:00
DarkPhoenix
f221024974 Update staticdata to 1618828 2019-11-27 15:10:49 +03:00
DarkPhoenix
66cab8a0d4 Bump version 2019-11-26 16:55:15 +03:00
DarkPhoenix
daa49a8cd4 Correctly detect zirnitra as amarr 2019-11-26 16:54:47 +03:00
DarkPhoenix
b8601ff240 Update icons/renders 2019-11-26 16:50:51 +03:00
DarkPhoenix
5df3eeca64 Add zirnitra renders 2019-11-26 16:34:28 +03:00
DarkPhoenix
274e4ac2ca Update effects 2019-11-26 16:27:06 +03:00
DarkPhoenix
f6485251ca Update staticdata to 1617768 2019-11-26 15:00:40 +03:00
DarkPhoenix
c03fb70def Merge branch 'singularity' 2019-11-26 14:55:51 +03:00
DarkPhoenix
2217aff5ab Add button to add custom drone groups 2019-11-26 14:53:47 +03:00
DarkPhoenix
400d0aaa22 Rework graph ammo picker to be dialog instead of frame 2019-11-25 16:54:25 +03:00
DarkPhoenix
bfc928934c Put entries into different sizers 2019-11-25 15:48:04 +03:00
DarkPhoenix
395c17270e Merge branch 'master' into ammo_graph 2019-11-25 13:56:16 +03:00
DarkPhoenix
8652a2891b Do not attempt to change skill levels of built-in all0/5 chars 2019-11-22 15:46:29 +03:00
DarkPhoenix
a09af0a9eb Propagate keys to upper windows if they were not processed in here 2019-11-22 15:45:01 +03:00
Anton Vorobyov
c7d4b93fba Merge pull request #2094 from RussianCow/level-keyboard-shortcuts
Add keyboard shortcuts to character level editor
2019-11-22 15:01:26 +03:00
Sasha
745c0db530 Add keyboard shortcuts to character level editor 2019-11-21 18:10:56 -08:00
DarkPhoenix
aa56ab8d6c Bump version 2019-11-21 13:01:14 +03:00
DarkPhoenix
043c430221 Update staticdata to 1610407 2019-11-21 13:00:36 +03:00
DarkPhoenix
dc5cc5855e Show range of bursts projectors, taking ship/citadel radius taken into consideration 2019-11-18 15:18:20 +03:00
DarkPhoenix
59d6266e2b Do not crash on exception classes without message attribute 2019-11-17 21:24:41 +03:00
DarkPhoenix
7495ba67f8 Revert change made for debugging 2019-11-17 17:40:07 +03:00
DarkPhoenix
e649683a4d Accept XML headers with extra info 2019-11-17 17:34:49 +03:00
DarkPhoenix
bec58a5772 Do not crash on cargo fetch failures 2019-11-17 17:29:16 +03:00
DarkPhoenix
e8f9ae8a9c Do not use hires assets on wxGTK 2019-11-16 19:22:37 +03:00
DarkPhoenix
679382e220 Do not separate number and unit in range tooltip, for consistency with other fields 2019-11-15 20:19:23 +03:00
DarkPhoenix
1b40467775 Merge branch 'master' into ammo_graph 2019-11-15 20:17:02 +03:00
DarkPhoenix
7f86782f54 Change range column tooltip for missiles 2019-11-15 13:23:27 +03:00
DarkPhoenix
f80b7d972f Implement hidden flight time bonus 2019-11-15 12:59:57 +03:00
Anton Vorobyov
c0bd489c1b Merge pull request #2085 from Gochim/master
Possible fix for #2084
2019-11-14 12:38:08 +03:00
Gochim
41e4c2107d Fix for #2084 2019-11-14 11:36:59 +02:00
Gochim
cfc95c272a Possible fix for #2084 2019-11-14 10:35:16 +02:00
DarkPhoenix
27e3e53868 Merge branch 'master' into ammo_graph 2019-11-13 22:03:01 +03:00
DarkPhoenix
f778f9ceae Take ship radius in consideration when displaying missile range in range column 2019-11-13 20:51:14 +03:00
DarkPhoenix
7fb6170bcb Implement missile "falloff" support in graphs 2019-11-13 20:28:52 +03:00
DarkPhoenix
00b9884c68 Remove unnecessary color setting, as aux window already does it for us 2019-11-13 19:56:49 +03:00
DarkPhoenix
b05bd04801 Do not allow to open more than 1 ammo pickers 2019-11-13 18:45:43 +03:00
DarkPhoenix
7ba5585b83 Set min window size of ammo picker as well 2019-11-13 17:07:32 +03:00
DarkPhoenix
9386ba3fb9 Fix initial window sizing 2019-11-13 17:03:45 +03:00
DarkPhoenix
1321e70035 Add info on drones/fighters to ammo picker 2019-11-13 16:46:47 +03:00
DarkPhoenix
e2d943b0b0 Gray out items for inactive radiobuttons 2019-11-13 16:33:23 +03:00
DarkPhoenix
424b769ba9 Fix ammo section labels 2019-11-13 16:14:00 +03:00
DarkPhoenix
3671f10c9c Resize ammo picker window 2019-11-13 16:08:06 +03:00
DarkPhoenix
935ecd0ea7 Make structure scrollable 2019-11-13 15:55:02 +03:00
DarkPhoenix
92e15ece72 Add structure with checkboxes to ammo switcher window 2019-11-13 15:20:43 +03:00
DarkPhoenix
a5c1875a29 Make sure to cache ammo set to reuse it when applying ammo to multiple modules 2019-11-13 13:48:13 +03:00
DarkPhoenix
9146c0f2c6 Use ammo service to generate ammo switcher context menu 2019-11-13 13:31:40 +03:00
DarkPhoenix
a917207e07 Reimplement some of logic used in ammo picker in a service package 2019-11-12 19:39:52 +03:00
DarkPhoenix
c21b92945f Merge branch 'master' into ammo_graph 2019-11-12 16:58:34 +03:00
DarkPhoenix
fa37428cd3 Update staticdata to 1573560935 2019-11-12 15:39:57 +03:00
DarkPhoenix
2a2d9d3456 Fix circular import issues for tests 2019-11-12 14:59:43 +03:00
Anton Vorobyov
a91efb681f Merge pull request #2079 from Gochim/minor_fixes
Several minor fixes in different parts of code
2019-11-12 00:07:31 +03:00
Gochim
386e05be8f Fixed method naming in stats.py classes 2019-11-11 19:19:31 +02:00
Anton Vorobyov
65e7bf609d Merge pull request #2078 from Gochim/master
Added central place to get damage types and ehp sources. Added tests
2019-11-11 16:40:22 +03:00
Gochim
7a58d97652 Merge remote-tracking branch 'origin/minor_fixes' into minor_fixes
# Conflicts:
#	eos/utils/stats.py
2019-11-10 17:36:47 +02:00
Gochim
c5118da417 Fixed small issue with #2078 by removing unnecessary prints 2019-11-10 17:35:48 +02:00
Gochim
13b505525d Refactored shipstats.py to use common damage profile and hull type names. Reduced code complexity 2019-11-10 17:27:46 +02:00
Gochim
b682dec363 Second fix for #2076 - use Abstract collections from .abc module. Fixes future issue 2019-11-10 17:27:46 +02:00
Gochim
6aa98e2214 Fixed test_aboutData test 2019-11-10 17:27:46 +02:00
Gochim
8fba988222 Added central place to get damage types and ehp sources. Added tests 2019-11-10 17:27:46 +02:00
Gochim
24a82efe50 Refactored shipstats.py to use common damage profile and hull type names. Reduced code complexity 2019-11-10 17:27:07 +02:00
Gochim
8054fa9267 Second fix for #2076 - use Abstract collections from .abc module. Fixes future issue 2019-11-09 23:27:28 +02:00
Gochim
a0e39a3725 Fixed test_aboutData test 2019-11-09 22:53:52 +02:00
Gochim
185d6d0c51 Merge remote-tracking branch 'origin/master' 2019-11-08 08:35:29 +02:00
Gochim
1975e96848 Added central place to get damage types and ehp sources. Added tests 2019-11-08 08:34:45 +02:00
Gochim
ab37d228ea Added central place to get damage types and ehp sources. Added tests 2019-11-08 08:34:22 +02:00
DarkPhoenix
049bd10797 Merge branch 'master' into ammo_graph 2019-11-07 19:02:12 +03:00
DarkPhoenix
f48483d754 Merge branch 'master' of github.com:pyfa-org/Pyfa 2019-11-07 18:36:10 +03:00
DarkPhoenix
e6cfd33435 Fix #2076 - use collection ABCs from .abc module 2019-11-07 18:35:14 +03:00
Anton Vorobyov
c29126ce1d Merge pull request #2077 from Gochim/master
Added instructions to run tests for the project
2019-11-07 18:34:58 +03:00
Gochim
c52170b731 Fixed path for bash script call 2019-11-07 14:45:29 +02:00
Gochim
6607dd31bf Merge remote-tracking branch 'origin/master' 2019-11-07 14:27:36 +02:00
Gochim
c6c74be38d Added instructions to run tests for the project 2019-11-07 14:27:14 +02:00
Gochim
41c6062ff9 Added instructions to run tests for the project 2019-11-07 14:26:41 +02:00
DarkPhoenix
bbb96a73b7 Add alias file for trig dread-related items 2019-11-06 23:09:28 +03:00
DarkPhoenix
9eb3b9e017 Do not use evepraisal info unless there are orders up 2019-11-04 02:50:55 +03:00
DarkPhoenix
6b3e94729c Update staticdata and bump version 2019-10-31 15:05:14 +03:00
DarkPhoenix
b486276167 Merge branch 'master' into ammo_graph 2019-10-31 11:29:31 +03:00
DarkPhoenix
fb48f2b5d4 Do not attempt to add entries to name maps if entity fetch failed 2019-10-30 16:46:34 +03:00
DarkPhoenix
cfffc77777 Change format name 2019-10-30 16:13:15 +03:00
DarkPhoenix
f7089f358d Fix stats export parenthesis 2019-10-30 16:12:33 +03:00
DarkPhoenix
06c4f2ce46 Bump version 2019-10-30 16:09:08 +03:00
Anton Vorobyov
83eb0abd92 Merge pull request #2070 from pyfa-org/json_in_repo
Store text staticdata in repo instead of binary
2019-10-30 16:05:55 +03:00
DarkPhoenix
4199b33c47 Merge branch 'master' into json_in_repo 2019-10-30 15:47:47 +03:00
Anton Vorobyov
23cd4bff5a Merge pull request #2069 from Gochim/master
[Updated] Implemented copying the currently open fit stats to the clipboard.
2019-10-30 15:44:53 +03:00
DarkPhoenix
b65f95fe77 Make sure to avoid doing DB updates avoiding sqlalchemy, as we're re-using the same session for pyfa now 2019-10-30 15:39:21 +03:00
DarkPhoenix
32160c94e1 Add extra metadata field which we use during gamedata DB checks 2019-10-30 15:26:26 +03:00
DarkPhoenix
ac02fba98b Move useless category IDs closer to context 2019-10-30 15:18:08 +03:00
DarkPhoenix
cde0108cba Change logging a little so info about DB being rebuilt is always printed to stdout 2019-10-30 15:16:13 +03:00
DarkPhoenix
39dc7e4a46 Compose DB out of data stored externally 2019-10-30 14:56:51 +03:00
Gochim
9943f784a8 Fixed code auto-checks for pull request 2019-10-30 13:34:54 +02:00
Gochim
88ce45f29e Merge remote-tracking branch 'origin/master' 2019-10-30 11:46:25 +02:00
Gochim
7157e876ca Fixed issue with mainFrame after merging 2019-10-30 11:46:03 +02:00
Gochim
0cf88cf7ca Added stats that were more or less agreed on in [Issue #2065] 2019-10-30 11:39:21 +02:00
Gochim
10dfdc3627 Added UI for new type of copying data about fit to the clipboard 2019-10-30 11:39:21 +02:00
Gochim
76bdefcda6 Fixed wording in contributing.md 2019-10-30 11:39:21 +02:00
Gochim
1c2c8cc5f9 Added UI for new type of copying data about fit to the clipboard 2019-10-30 11:39:21 +02:00
Alexander Maryanovsky
58f853de5b Implemented copying the currently open fit stats to the clipboard. 2019-10-30 11:39:21 +02:00
Gochim
c052297bf7 Added stats that were more or less agreed on in [Issue #2065] 2019-10-30 09:17:38 +02:00
DarkPhoenix
9e78cd1076 Fix drag-n-dropping module from market into specific empty slot 2019-10-28 13:23:40 +03:00
DarkPhoenix
79f4deacea Show hidden graphs on ctrl-alt-g 2019-10-28 12:56:34 +03:00
Gochim
ff42c4c711 Added UI for new type of copying data about fit to the clipboard 2019-10-26 18:36:38 +03:00
DarkPhoenix
02d31d49d8 Implement graph types to pick best ECM burst + damps ship 2019-10-26 00:30:45 +03:00
DarkPhoenix
64f47fcc24 Do not choke on fits for unknown ships 2019-10-25 01:00:32 +03:00
DarkPhoenix
0ceb8acd64 Rename some fields for the hidden graph 2019-10-24 23:15:38 +03:00
DarkPhoenix
78579e2e13 Adjust ECM burst + damp graph 2019-10-24 23:13:20 +03:00
DarkPhoenix
cf4e1d3935 Consistency fixes 2019-10-24 14:09:08 +03:00
DarkPhoenix
d1be0bb680 Add scanres vs locktime on active fit graph as experimental feature 2019-10-24 13:52:34 +03:00
DarkPhoenix
e70ebad3f7 Bump version 2019-10-22 15:37:25 +03:00
DarkPhoenix
4dfe5c3abf Update database and effects to 1589866 2019-10-22 15:36:37 +03:00
Gochim
384d9f4614 Fixed wording in contributing.md 2019-10-21 13:22:00 +03:00
Gochim
47434c68f9 Added UI for new type of copying data about fit to the clipboard 2019-10-20 15:25:06 +03:00
Gochim
af88afb6b5 Merge branch 'export-stats' of https://github.com/m-sasha/PyfaAT into m-sasha-export-stats
# Conflicts:
#	gui/mainFrame.py
#	gui/mainMenuBar.py
2019-10-20 14:48:00 +03:00
DarkPhoenix
e4df215e47 Change order of market group sorting for ammo picker 2019-10-18 12:10:02 +03:00
DarkPhoenix
33cb332978 Plug market sort into module grouping 2019-10-17 18:21:03 +03:00
DarkPhoenix
7c8f4d51bb Move sorting from item view to market service 2019-10-17 17:39:44 +03:00
DarkPhoenix
66bf7b3dc6 Merge branch 'master' into ammo_graph 2019-10-17 17:19:40 +03:00
Anton Vorobyov
536eb1efa5 Merge pull request #2064 from Gochim/master
Merged some additional info from wiki. Improved on readability
2019-10-17 17:19:10 +03:00
Anton Vorobyov
c4c763089e Merge branch 'master' into master 2019-10-17 17:19:00 +03:00
DarkPhoenix
cdfd4c0d8e Invoke pip the same way as on Windows 2019-10-17 17:01:10 +03:00
DarkPhoenix
f9bb8836e5 Upgrade pip when building mac distribution 2019-10-17 16:59:38 +03:00
Gochim
58b2634c8c Merged info from wiki. Improved on readability 2019-10-17 16:50:40 +03:00
Anton Vorobyov
093ae008ce Merge pull request #2063 from Gochim/master
Re-written in much greater detail instructions how to set up the project
2019-10-17 16:05:31 +03:00
Gochim
5f62fc0cdc Merge remote-tracking branch 'origin/master' 2019-10-16 22:08:33 +03:00
Gochim
e7a4b4ac26 Added section "Setting up the project with PyCharm" 2019-10-16 22:07:10 +03:00
Gochim
66e9944cb5 Added "Setting up the project manually" instructions 2019-10-16 22:07:10 +03:00
DIvanchenko
ad8528c248 Plan for CONTRIBUTING.md. Updated link to CONTRIBUTION.md. 2019-10-16 22:06:19 +03:00
DIvanchenko
07d22cd8e4 Created link to CONTRIBUTION.md. Fixed heading 2019-10-16 22:06:19 +03:00
DarkPhoenix
a6d5922d77 Bump minor version, as database has been updated 2019-10-16 16:33:43 +03:00
Ryan Holmes
958d7bff99 Update .appveyor.yml 2019-10-16 09:27:22 -04:00
Ryan Holmes
7819b80be4 Update .appveyor.yml 2019-10-16 09:25:14 -04:00
Gochim
2ca50a4658 Added section "Setting up the project with PyCharm" 2019-10-15 23:08:21 +03:00
Gochim
09ff4fd128 Added "Setting up the project manually" instructions 2019-10-15 20:17:48 +03:00
DarkPhoenix
3e53863f9e Bump version 2019-10-15 17:09:15 +03:00
DarkPhoenix
63d2289f97 Update database to 1585794 2019-10-15 17:06:42 +03:00
DarkPhoenix
2663ef2e66 Make mutated module import consider old 1mn gravid mutaplasmid name 2019-10-14 18:26:22 +03:00
DarkPhoenix
8bb1d43d0c Show module groups / drone header / fighter header in dialog 2019-10-11 13:23:18 +03:00
DarkPhoenix
3d70ca941c Change ammo picker window to be auxiliary frame rather than modal dialog 2019-10-10 19:10:28 +03:00
DIvanchenko
d4bdf47d62 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	README.md
2019-10-10 18:04:24 +03:00
DIvanchenko
660ee7c4bf Plan for CONTRIBUTING.md. Updated link to CONTRIBUTION.md. 2019-10-10 18:03:28 +03:00
DarkPhoenix
04a1e95730 Get list of fighters and drones as well 2019-10-10 16:03:56 +03:00
DarkPhoenix
9fddb64ef9 Get list of damage dealer mods with ammo data 2019-10-10 15:40:39 +03:00
DarkPhoenix
e883035120 Do not show menu item for non-dps graphs 2019-10-10 13:38:42 +03:00
DarkPhoenix
4d2da8e52e Merge branch 'master' into ammo_graph 2019-10-10 12:41:30 +03:00
DIvanchenko
1db1f3070b Created link to CONTRIBUTION.md. Fixed heading 2019-10-10 10:50:56 +03:00
DIvanchenko
3dba82c497 Created link to CONTRIBUTION.md. Fixed heading 2019-10-10 10:49:54 +03:00
DarkPhoenix
25e7b7a9f7 Fix RMB in graph fit list 2019-10-09 23:09:09 +03:00
DarkPhoenix
9582212ae0 Bump version 2019-10-09 19:38:25 +03:00
DarkPhoenix
7d2b60c327 Fix addition of drones via alt-dclick 2019-10-09 16:24:21 +03:00
DarkPhoenix
0121a0064e Show unknown meta groups as normal, also add standup faction group to faction tab 2019-10-09 14:38:08 +03:00
DarkPhoenix
2aa96fc819 Do not crash when user cancels setting of projection range 2019-10-09 13:30:01 +03:00
DarkPhoenix
8d81db0a3a Change what kind of strength is displayed for probe launchers 2019-10-09 13:13:40 +03:00
DarkPhoenix
e5ba35fde9 Pass effect in all effect handler calls 2019-10-08 23:41:26 +03:00
DarkPhoenix
885cd32cb0 Fix EFS export after adding projection range support 2019-10-08 23:11:58 +03:00
DarkPhoenix
18d8ed6558 Take modifier key info from event where possible 2019-10-08 20:50:14 +03:00
DarkPhoenix
9618ece4b4 Bump version 2019-10-08 19:50:57 +03:00
DarkPhoenix
a80a77a422 Update effects file 2019-10-08 19:50:38 +03:00
DarkPhoenix
3806be3ddd Add capsule renders 2019-10-08 19:46:15 +03:00
DarkPhoenix
3e803fef30 Actually expose capsule to a shuttle group 2019-10-08 19:37:32 +03:00
DarkPhoenix
12956d435a Update database to 1581357 and do necessary schema changes to support changed source data 2019-10-08 19:28:24 +03:00
DarkPhoenix
c1df335f08 Add context menu item which will handle fit duplication 2019-10-08 15:39:16 +03:00
DarkPhoenix
a3381007f3 Use numbers in default values instead of strings to avoid type errors 2019-10-07 16:58:11 +03:00
DarkPhoenix
1efe4ee5e5 Enable showing capsules in shuttle group 2019-10-05 10:27:08 +03:00
DarkPhoenix
ec21f93d3c Fix background color of panels behind buttons 2019-10-04 01:25:38 +03:00
DarkPhoenix
f384b32ed6 Remove unused file 2019-10-03 14:30:50 +03:00
DarkPhoenix
22d8f34c75 Fix pref panel titles on linux 2019-10-03 14:29:47 +03:00
DarkPhoenix
6128cd8322 Update once again
Cut everything outside of window
2019-10-03 13:34:42 +03:00
DarkPhoenix
386f403430 Update screenshot 2019-10-03 13:32:36 +03:00
DarkPhoenix
5f7d9aea89 Add amount of text in notes to notes tab title 2019-10-03 13:02:08 +03:00
DarkPhoenix
b367c449a9 Few more readme fixes 2019-10-03 09:56:53 +03:00
DarkPhoenix
26b3dff9d4 Update readme 2019-10-03 09:47:43 +03:00
DarkPhoenix
873a62e3f0 Make error dialog window like any other auxiliary window - do not keep it on top 2019-10-02 22:08:37 +03:00
Anton Vorobyov
d967ab375e Merge pull request #2050 from ZeroPointEnergy/feature/images_from_zip
Support loading images from zip
2019-10-02 19:16:50 +03:00
Andreas Zuber
fcf2d6a72c Support loading images from zip
This commit reenables the ability to load the images from a zip file
instead of a directory structure. It is possible to set the location of
this file via configforced.py
2019-10-02 17:01:14 +02:00
DarkPhoenix
843ced15bf Fix ammo damage ratios 2019-10-02 14:45:29 +03:00
DarkPhoenix
813db9340f Make sure to select right-clicked item on windows when Control is pressed 2019-10-02 13:19:46 +03:00
DarkPhoenix
acbd8a3298 Allow context menu-related batch actions to be triggered on ctrl too
Windows hides context menu when user presses alt
2019-10-02 12:44:27 +03:00
DarkPhoenix
561e22e894 Bump version 2019-10-02 12:11:25 +03:00
DarkPhoenix
05ac0a528a Show extra labels only when there's something inside 2019-10-02 10:56:01 +03:00
DarkPhoenix
c040353f6e Move some common functionality into common space of tab sizing method 2019-10-02 10:37:14 +03:00
DarkPhoenix
f23a8fa0c8 Adjust tab shadows to tab sizes 2019-10-02 10:33:11 +03:00
DarkPhoenix
ba93467646 Implement logic to have tabs of different sizes in additions pane and in fitting pane 2019-10-02 10:16:36 +03:00
DarkPhoenix
00d480860f Change tab outlook when option value is changed 2019-10-01 22:28:24 +03:00
DarkPhoenix
c94384acb8 Show amount of items hidden in additions tabs 2019-10-01 22:22:10 +03:00
DarkPhoenix
0c2c0ac6ef Add modules to session even when they were added via appendIgnoreEmpty 2019-10-01 10:25:31 +03:00
DarkPhoenix
61a33a331e Copy projection range when copying fit 2019-10-01 09:29:10 +03:00
DarkPhoenix
e374a6f2c6 Do not add null drains to not affect cap sim calculations 2019-09-30 17:27:10 +03:00
DarkPhoenix
dbd84dce28 Allow to change projected items' metas regardless of ability of target ship to fit them 2019-09-30 17:24:14 +03:00
DarkPhoenix
9d554f9c68 Make sure to do fit recalculation if it was changed after the last one 2019-09-30 17:20:22 +03:00
DarkPhoenix
576cf56735 Expose chance of jamming to stats pane itself rather than tooltip 2019-09-30 17:06:01 +03:00
DarkPhoenix
e2aaabbc16 Do not let jamming strength exceed 100% 2019-09-30 16:40:48 +03:00
DarkPhoenix
ef226898c0 Add projection range calculation to effects where it makes sense 2019-09-30 14:43:52 +03:00
DarkPhoenix
a0db235e5a Add support for projection range to bunch of effects 2019-09-30 03:17:21 +03:00
DarkPhoenix
5bf05ba775 Allow batch changes of projection range 2019-09-30 02:47:12 +03:00
DarkPhoenix
c073b1fa2a Do not show context menu on system-wide effects 2019-09-30 02:10:11 +03:00
DarkPhoenix
5f58307bf3 Add projection range commands to projected fighters 2019-09-30 02:04:24 +03:00
DarkPhoenix
8741b17a5e Add projection range commands for projected drones 2019-09-30 01:55:16 +03:00
DarkPhoenix
4c1fa09795 Apply drones and fighters from projected fit at range of 0 2019-09-30 01:21:39 +03:00
DarkPhoenix
ce7df2d01f Allow to change projection range for projected modules 2019-09-30 01:18:55 +03:00
DarkPhoenix
b433b0ea7c Change fit projection so that projection range actually counts for the sake of calculations overall
No effect support still
2019-09-30 00:19:31 +03:00
DarkPhoenix
20868d6b44 Add ability to change projection range of fits 2019-09-29 23:41:45 +03:00
DarkPhoenix
33103dbee9 Add column which shows projected item range 2019-09-29 22:16:19 +03:00
DarkPhoenix
2a05ac5a85 Pass projection range parameter to effects 2019-09-29 22:02:10 +03:00
DarkPhoenix
a013828128 Add projectionRange to actual objects built from database 2019-09-29 16:04:44 +03:00
DarkPhoenix
e19510b3d4 Move function which calculates range factor to eos 2019-09-29 16:00:37 +03:00
DarkPhoenix
390f2048f2 Add projection range column to projectable entities 2019-09-29 15:54:45 +03:00
DarkPhoenix
0bb732300e Do not rely on resistance view being available 2019-09-29 11:21:00 +03:00
DarkPhoenix
fd017df561 Add lock range limit support to ewar graph 2019-09-27 20:43:28 +03:00
DarkPhoenix
0ed16b9a6f Add lockrange support to DPS graphs 2019-09-27 20:19:29 +03:00
DarkPhoenix
865978fcc1 Add context menu which controls if graphs ignore drone control range or not, and add support for this option to RR graph 2019-09-27 18:40:33 +03:00
DarkPhoenix
a43f9930de Allow to change meta level of standup fighters 2019-09-23 16:44:26 +03:00
DarkPhoenix
c13cd23d54 Change parent of fit deletion dialog
Try out tip mentioned in https://github.com/wxWidgets/Phoenix/issues/1343
2019-09-23 15:32:16 +03:00
DarkPhoenix
ed1f52a114 Show implant description in tooltip of implant editor 2019-09-23 15:25:58 +03:00
DarkPhoenix
7dd063f04e Add graph setting to ignore drone control range 2019-09-17 13:03:21 +03:00
DarkPhoenix
6e9fc1d1d9 Do not crash on Nones in value 2019-09-11 08:32:13 +03:00
DarkPhoenix
cae0172e48 Bump version 2019-09-10 15:54:23 +03:00
DarkPhoenix
e2b492ee8d Update database and effects to 1564394 2019-09-10 15:53:37 +03:00
DarkPhoenix
545ddc7492 Adjust DB script to changes in phobos 2019-09-10 15:31:02 +03:00
DarkPhoenix
d0b7c58a1d Merge branch 'singularity' 2019-09-10 14:30:51 +03:00
DarkPhoenix
a9ad094422 Fix fax link amount bonus 2019-09-04 15:10:07 +03:00
DarkPhoenix
68154333c2 Merge branch 'master' into singularity 2019-09-02 02:25:25 +03:00
DarkPhoenix
5df2db5879 Bump version 2019-09-02 01:21:32 +03:00
DarkPhoenix
5a34db0d2f Change how fit deletion confirmation dialog is destroyed 2019-09-02 01:14:35 +03:00
DarkPhoenix
6f50be1e7e Fix another set of crashes with manual login 2019-08-30 15:36:34 +03:00
DarkPhoenix
d15fefcf1b Avoid various crashes when working with SslLoginServer dialog 2019-08-30 15:26:58 +03:00
DarkPhoenix
07bf1b400c Fix spool scale mode on the very final cycle with spoolup set 2019-08-30 09:42:26 +03:00
DarkPhoenix
9f975a958e Merge branch 'master' into singularity 2019-08-27 11:34:17 +03:00
DarkPhoenix
c2a240bab0 Fix mutadaptive rep group 2019-08-26 23:12:44 +03:00
DarkPhoenix
40c3bf723f Make drone RR rigs stacking penalized for shield RR bots 2019-08-26 19:43:44 +03:00
DarkPhoenix
7a92ace2db Remove stacking penalty from scorpion ECM strength bonus 2019-08-26 19:33:55 +03:00
DarkPhoenix
500f5b8310 Add redraw delay on fit changes 2019-08-26 14:47:34 +03:00
DarkPhoenix
44830a4de6 Add capacity to container name if it was added to cargo 2019-08-26 14:13:26 +03:00
DarkPhoenix
f3f13e7ba8 Make cargo containers searchable 2019-08-26 13:38:03 +03:00
DarkPhoenix
0269a64ae1 Add maximize button to resizeable windows and make character editor resizeable 2019-08-26 12:59:00 +03:00
DarkPhoenix
5d6cdcbd23 Fix indent 2019-08-26 12:28:55 +03:00
DarkPhoenix
81906a7bd2 Do not store item-specific resistance attrs on effects 2019-08-26 12:27:43 +03:00
DarkPhoenix
b25b038934 Fix on-effect resistance definition 2019-08-26 09:28:48 +03:00
DarkPhoenix
b469fa520e Do not crash on cap boosters only in fit 2019-08-26 09:02:55 +03:00
DarkPhoenix
4f865896c7 Force variations menu to respect meta group overrides 2019-08-26 04:01:23 +03:00
DarkPhoenix
3b50dddef2 Allow to online extra amount of command bursts on various caps 2019-08-26 03:48:17 +03:00
DarkPhoenix
380e9c2e87 Change how rounding on Y ticks happens - now it relies on shown Y range 2019-08-26 03:35:35 +03:00
DarkPhoenix
1c1443c862 Move calculation of normalization shift to separate function 2019-08-26 02:56:11 +03:00
DarkPhoenix
0529baac4a Merge branch 'master' into singularity 2019-08-23 13:44:40 +03:00
DarkPhoenix
7dab220009 Ignore non-active scrams and scrammables 2019-08-23 13:44:15 +03:00
DarkPhoenix
0ea0f8cdf2 Merge branch 'master' into singularity 2019-08-23 13:24:29 +03:00
DarkPhoenix
eebd59413b Apply scrams in DPS graph when projected mods is enabled 2019-08-23 13:19:17 +03:00
DarkPhoenix
f4a635eb43 Implement hybrid extended attribute getter and few scram-related functions for DPS graph 2019-08-23 11:53:13 +03:00
DarkPhoenix
0e57258cc5 Add ability to pass multiple afflictors to no-afflictor getter 2019-08-23 09:13:40 +03:00
DarkPhoenix
67462c3278 Do not crash on attempt to export blank fitting 2019-08-23 09:07:31 +03:00
DarkPhoenix
fce8129fa2 Add support for extended target profile stats export/import 2019-08-23 08:55:13 +03:00
DarkPhoenix
1d76f3ec31 Merge branch 'master' into singularity 2019-08-22 21:32:34 +03:00
DarkPhoenix
707dbeecf8 Fix subsystems giving fitting bonuses to non-med RRs 2019-08-22 21:30:10 +03:00
DarkPhoenix
56672f5830 Merge branch 'master' into singularity 2019-08-22 19:35:27 +03:00
DarkPhoenix
13a0bf9d42 Do not delay any damage besides doomsday mods 2019-08-22 19:34:38 +03:00
DarkPhoenix
1bff10c973 Bump version 2019-08-22 17:56:51 +03:00
DarkPhoenix
1d4aece7cc Limit max range of FoF missiles 2019-08-22 17:54:44 +03:00
DarkPhoenix
cdb79f499a Allow non-integer amount of cycles in spool calculator 2019-08-22 17:35:16 +03:00
DarkPhoenix
837dbb3677 Update database and effects to 1554701 2019-08-22 16:51:33 +03:00
DarkPhoenix
3d3bf4ce2c Implement fighter ability resistance support into dps graph 2019-08-22 12:38:39 +03:00
DarkPhoenix
46ae2a006e Consider default attr value when fetching original value, too 2019-08-22 11:58:31 +03:00
DarkPhoenix
0062206f87 Bump version once again 2019-08-22 11:36:58 +03:00
DarkPhoenix
b6642aa76c Change default price source to evemarketer 2019-08-22 11:34:25 +03:00
DarkPhoenix
522f1c8314 Change cap column tooltip 2019-08-22 11:32:00 +03:00
DarkPhoenix
6fceda5f27 Ensure right-clicked item is selected on Mac in Display list panels 2019-08-22 08:47:45 +03:00
DarkPhoenix
668a947543 Use copy-paste fix only on Mac 2019-08-22 08:05:36 +03:00
DarkPhoenix
f3eadc9ef1 Do nothing on copy-paste in secondary windows 2019-08-22 07:54:21 +03:00
DarkPhoenix
7693483720 Ensure that clicked item is selected on Mac in fitting panel 2019-08-22 07:37:49 +03:00
DarkPhoenix
219e1c11dc Attempt to remove mac's copy-paste workaround 2019-08-22 07:32:15 +03:00
DarkPhoenix
99c6614d86 Change more commands to not fail on partial fails 2019-08-21 18:27:37 +03:00
DarkPhoenix
93af60c3d0 Do not fail batch imports if one of elements fails to be imported 2019-08-21 18:16:27 +03:00
DarkPhoenix
b4789bbebf Conver items to typeIDs before submitting 2019-08-21 18:04:22 +03:00
DarkPhoenix
160c2f0942 Implement additions pane pasting via ctrl-v 2019-08-21 17:39:06 +03:00
DarkPhoenix
9605efe643 Support actual item pasting functionality 2019-08-21 16:47:48 +03:00
DarkPhoenix
56e09b8528 Add context menu which pastes clipboard into additions pane (not functional yet) 2019-08-21 15:46:20 +03:00
DarkPhoenix
7dc17543df Make new context menus disablable 2019-08-21 15:14:49 +03:00
DarkPhoenix
3793721dc3 Implement copy context menu for additions pane 2019-08-21 15:07:25 +03:00
DarkPhoenix
54aa284fd9 Add extra context menu contexts to some additions panels 2019-08-21 13:39:40 +03:00
DarkPhoenix
207818537b When setting fighter's amount attribute to max or more than max, set it to -1 internally
It will show up as max amount when reading
2019-08-21 13:22:04 +03:00
DarkPhoenix
d32ff668e1 Show capacitor regen difference for selected mods 2019-08-21 12:11:22 +03:00
DarkPhoenix
1b2cd62629 Round results a little to get rid of float error 2019-08-21 11:38:14 +03:00
DarkPhoenix
2d96af9fc8 Use regular getter when no modifications needed 2019-08-21 11:36:24 +03:00
DarkPhoenix
20422d3046 Actually calculate attr without passed afflictor 2019-08-21 09:58:31 +03:00
DarkPhoenix
0e2ae0e0f0 Extend afflictor info with extra data 2019-08-21 09:37:06 +03:00
DarkPhoenix
9572a51f28 Do not crash on None value in damage pattern editor 2019-08-20 21:48:06 +03:00
DarkPhoenix
cf6f884b3b Do not crash cap sim graph when there're no drains 2019-08-20 21:43:01 +03:00
DarkPhoenix
4ca737281d Fix background color of auxiliary windows on Windows 2019-08-20 18:29:29 +03:00
DarkPhoenix
847f4e343e Update database to 1553210 2019-08-20 19:45:33 +03:00
DarkPhoenix
e0db6eb2ad Fix json to SQL script 2019-08-20 19:33:19 +03:00
DarkPhoenix
c7f625456e Remove icons-related scripts and data as phobos can dump it successfully 2019-08-20 18:14:55 +03:00
DarkPhoenix
332eb048a1 Update json to SQL script to adapt it to latest changes to Phobos 2019-08-20 18:14:24 +03:00
DarkPhoenix
e2c7f169fd Do not bump minor version 2019-08-20 17:44:59 +03:00
DarkPhoenix
4eb68c7c13 Bump version 2019-08-20 11:56:24 +03:00
DarkPhoenix
c1228b95fe Do not sort skill bonuses in traits tab 2019-08-20 09:04:50 +03:00
DarkPhoenix
2ab61f2b9e Disallow having modules onlined if the are too many fit for maxGroupOnline limitation 2019-08-20 08:47:04 +03:00
DarkPhoenix
d266aa796e Do not crash on damage/target profiles named like [this] 2019-08-20 00:47:49 +03:00
DarkPhoenix
e488497a42 Cap sim now avoids optimization when running for cap graph request 2019-08-20 00:38:29 +03:00
DarkPhoenix
e8766817f8 Do not stop simulating cap too early in case we have cap injector in fit 2019-08-19 21:36:34 +03:00
DarkPhoenix
d577b1d1c6 Implement individual point getter for cap sim graph 2019-08-19 21:06:28 +03:00
DarkPhoenix
7984b57494 Implement range getter for cap sim 2019-08-19 20:44:32 +03:00
DarkPhoenix
567e8df174 Save cap sim state on fit 2019-08-19 15:34:19 +03:00
DarkPhoenix
65e7607221 Add checkbox which controls if data from capsim is used or not 2019-08-19 13:28:50 +03:00
DarkPhoenix
6e3b536d83 Add starting shield amount to shield graph as well 2019-08-19 13:20:02 +03:00
DarkPhoenix
348c4d71df Add "starting cap" parameter to cap graph 2019-08-19 13:10:28 +03:00
DarkPhoenix
9494885f45 Do not crash on infs/nans in values, just discard plot 2019-08-19 12:48:26 +03:00
DarkPhoenix
01bda70fef Rework mainOnly parameter into conditions 2019-08-19 12:37:52 +03:00
DarkPhoenix
8b2f9ce59d Reduce RAAR repairs on cycles after 8th if we decide to not reload 2019-08-19 09:45:20 +03:00
DarkPhoenix
60a8e905b8 Expose data about reloads to cycle getter 2019-08-19 09:32:55 +03:00
DarkPhoenix
d9a4b0a359 Add logic to control reloads of ancillary mods according to parameter setting 2019-08-19 09:17:51 +03:00
DarkPhoenix
2d43a6ade5 Pull ancillary reload parameter to internal cache getter 2019-08-19 09:01:20 +03:00
DarkPhoenix
d0a56e3ee8 Add checkbox to UI which will control if RAAR/RASB will reload or not 2019-08-19 01:28:12 +03:00
DarkPhoenix
9b15f1942d Do not allow to activate most modules besides guns on targets which are at distance more than optimal + 3x falloff 2019-08-18 22:13:43 +03:00
DarkPhoenix
edd261c677 Add RR graphs 2019-08-18 21:27:20 +03:00
DarkPhoenix
3c967ba9eb Add 3 extra columns to show RR power of different fits 2019-08-17 00:49:42 +03:00
DarkPhoenix
8332ccaa7a Add RR graph stub 2019-08-17 00:29:13 +03:00
DarkPhoenix
26b1610ca5 Remote rep drones now always show amount of HP repaired, enabled or not 2019-08-17 00:03:23 +03:00
DarkPhoenix
ae1a5f4e44 Rework various RR-related functionality to use new API 2019-08-16 23:58:07 +03:00
DarkPhoenix
4594f57961 Get RR data getter to drone 2019-08-16 23:27:37 +03:00
DarkPhoenix
c1d0849f87 Consider AAR rep multiplier when getting RR params 2019-08-16 20:58:56 +03:00
DarkPhoenix
313264a49f Implement RR parameter getter 2019-08-16 20:55:25 +03:00
DarkPhoenix
a724347236 Avoid pushing graph inwards because of labels 2019-08-16 19:20:11 +03:00
DarkPhoenix
df7ad187f5 Relayout on effectivity change 2019-08-16 09:42:12 +03:00
DarkPhoenix
c142a011a0 Show shield HP/EHP based on HP selection in main panel 2019-08-16 09:31:02 +03:00
DarkPhoenix
477c43884a Add extra argument to axis selection updater 2019-08-16 08:51:58 +03:00
DarkPhoenix
f3551ce570 Move HP toggled event to global 2019-08-16 08:41:14 +03:00
DarkPhoenix
6baa9dd322 Move interpolation and limitation to separate functions 2019-08-16 08:31:58 +03:00
DarkPhoenix
302975c243 Round to 0 to avoid showing too small numbers in scientific representation 2019-08-16 00:55:29 +03:00
DarkPhoenix
73f75fb44e Do not plot labels if they are out of bounds 2019-08-15 20:42:59 +03:00
DarkPhoenix
7f651b144f Fix shield amount normalization for X marking 2019-08-15 20:40:13 +03:00
DarkPhoenix
ff98658491 Use relative position of X description 2019-08-15 20:02:51 +03:00
DarkPhoenix
53db5943b1 Do not allow to clip x marks 2019-08-15 18:35:24 +03:00
DarkPhoenix
33b7ab0d98 Limit misc parameters when fetching point 2019-08-15 18:16:14 +03:00
DarkPhoenix
f0af93f8b9 Add extra space on X to the right to have space for x mark labels 2019-08-15 17:59:35 +03:00
DarkPhoenix
379fd2353a Reset x marks on x field change 2019-08-15 17:44:36 +03:00
DarkPhoenix
98f0766425 Drop x marks on various actions 2019-08-15 17:40:29 +03:00
DarkPhoenix
be07a4735c Added vertical marker line to show exact values on graphs 2019-08-15 17:25:25 +03:00
DarkPhoenix
d736a10dc9 Draw vertical line where user clicked 2019-08-15 15:42:06 +03:00
DarkPhoenix
c5c3b9cba1 Change how we calculate min/max Ys 2019-08-15 15:25:21 +03:00
DarkPhoenix
bfa9ad4d96 Implement single point getters 2019-08-15 15:06:50 +03:00
DarkPhoenix
2f8ece9080 Connect various MPL events to support drawing vertical line with graph values 2019-08-15 12:42:23 +03:00
DarkPhoenix
c7e769e42e Move "graphs enabled" variable to top of graphs module 2019-08-15 11:49:26 +03:00
DarkPhoenix
3ab06d0832 Move MPL-related code to canvas panel 2019-08-15 09:32:52 +03:00
DarkPhoenix
251bc71f86 Add canvas panel which will house MPL-related functionality 2019-08-14 20:33:19 +03:00
DarkPhoenix
3f3870bb30 Rename just panel to control panel 2019-08-14 19:54:06 +03:00
DarkPhoenix
eb9612b9a3 Add neut vs range graph 2019-08-14 14:27:50 +03:00
DarkPhoenix
1d7efce197 Add ECM vs range graph 2019-08-14 13:10:53 +03:00
DarkPhoenix
ff60cf313e Add TP over range graph 2019-08-14 12:39:36 +03:00
DarkPhoenix
a275878ba0 Add GD graph 2019-08-14 09:46:12 +03:00
DarkPhoenix
09fb4c1d35 Add TD vs range graph 2019-08-14 09:17:40 +03:00
DarkPhoenix
483c1c35fd Allow to use custom labels for selectors 2019-08-14 08:53:26 +03:00
DarkPhoenix
810b8be92a Add damp strength vs range graph 2019-08-14 00:09:38 +03:00
DarkPhoenix
679ed7b806 Implement iterators on fit and use them in graph code 2019-08-13 22:39:25 +03:00
DarkPhoenix
e1896c0216 Set parent for all busyinfo windows to put them properly on application screen 2019-08-13 11:26:28 +03:00
DarkPhoenix
01310c166e Convert miscparams to dict in generic methods to avoid extra conversions in every getter implementation 2019-08-13 09:13:19 +03:00
DarkPhoenix
3bc93899fe Add web strength vs range graph 2019-08-13 08:28:59 +03:00
DarkPhoenix
69bd988174 Add lock time graph 2019-08-12 22:13:24 +03:00
DarkPhoenix
20bee1196a Save display number and position on it relatively client area 2019-08-12 20:56:03 +03:00
DarkPhoenix
9803da1825 Add some extra logging to help with #1605 debugging 2019-08-12 20:05:21 +03:00
DarkPhoenix
bc61e32ee7 Change values after input delay 2019-08-12 17:03:12 +03:00
DarkPhoenix
4f784e2eea Allow to use floats in damage pattern editor 2019-08-12 16:52:08 +03:00
DarkPhoenix
931d8d355f When no ESI characters are added, do not close ESI windows 2019-08-12 15:48:35 +03:00
DarkPhoenix
6912b6eb39 Fix background color of SSO char management panel 2019-08-12 12:32:02 +03:00
DarkPhoenix
163d2c9b10 Do not freeze display, as it doesn't remove flicker anyway 2019-08-12 12:29:24 +03:00
DarkPhoenix
cc8def1cf5 Try to flicker less when redrawing lists 2019-08-12 15:13:51 +03:00
DarkPhoenix
bcdefdc4ac Rework more windows to rely on auxiliary frame 2019-08-12 14:41:41 +03:00
DarkPhoenix
4f2e1be9ac Set min size of various auxiliary windows 2019-08-12 14:05:18 +03:00
DarkPhoenix
663623dec6 Do not crash on dollar sign in fit name 2019-08-12 11:56:07 +03:00
DarkPhoenix
cecf5d7e31 Make siege rapid torp bonus non-stacking penalized with damage mods 2019-08-12 11:25:07 +03:00
DarkPhoenix
8a4caeaa2d Avoid doing unnecessary recalcs 2019-08-12 04:08:54 +03:00
DarkPhoenix
f8062ba39f Do not do extra recalc if it's not needed 2019-08-12 02:13:29 +03:00
DarkPhoenix
3e6e3b0743 Migrate more windows to new window control scheme 2019-08-12 01:41:38 +03:00
DarkPhoenix
1e35eaf62a Rework how single windows are opened 2019-08-12 01:11:44 +03:00
DarkPhoenix
8a3dc2f3dc Rework how single frame of some auxiliary window is opened 2019-08-12 00:48:18 +03:00
DarkPhoenix
34a6fdc07e Rework more windows to use aux frame 2019-08-12 00:32:27 +03:00
DarkPhoenix
fc65cb6000 More windows to auxiliary frame 2019-08-11 15:52:51 +03:00
DarkPhoenix
247add778d Rework item stats to use new auxiliary frame class 2019-08-11 15:18:40 +03:00
DarkPhoenix
ab1071f1d7 Fix HAW phoenix dps effects 2019-08-11 13:05:03 +03:00
DarkPhoenix
f5cb5c3993 Open only one window of attribute and character editors 2019-08-10 11:23:01 +03:00
DarkPhoenix
ea7f122030 Rework dev tools window from frame into dialog 2019-08-10 11:02:25 +03:00
DarkPhoenix
2160cc4aaa Change how attribute editor frame is closed 2019-08-10 02:50:20 +03:00
DarkPhoenix
817e99a05d Change the way we close character editor 2019-08-10 02:42:19 +03:00
DarkPhoenix
53f5656478 Rework item stats from dialog into frame 2019-08-10 02:36:37 +03:00
DarkPhoenix
42d11bd3f1 Raise graph and target profile editor windows when we invoke them and they are already open 2019-08-10 02:10:28 +03:00
DarkPhoenix
a028ebe198 Rework how we handle all modal dialogs 2019-08-10 01:56:43 +03:00
DarkPhoenix
c315adf987 Rework target profile editor to be non-blocking window 2019-08-09 20:57:20 +03:00
DarkPhoenix
01371f227c Change the way we handle dialogs 2019-08-09 20:09:31 +03:00
DarkPhoenix
3174deed99 Change range factor for turret ammo sorting from optimal + falloff/2 to optimal + falloff 2019-08-09 16:27:03 +03:00
DarkPhoenix
6db178e4d2 Delay cap booster activation until the moment when its charge will be used efficiently 2019-08-09 16:19:20 +03:00
DarkPhoenix
eb07e03e93 Start all injectors at 0 2019-08-09 09:32:07 +03:00
DarkPhoenix
a881cd2bcc Work around wx bug - show labels even after switching graphs 2019-08-09 00:34:27 +03:00
DarkPhoenix
676b09720a Replace reduce with sum 2019-08-09 00:29:09 +03:00
DarkPhoenix
ac7b6d9ecd Change the way we detect injectors 2019-08-09 00:18:00 +03:00
DarkPhoenix
49cb81b516 Push info about injector into cap sim 2019-08-08 19:46:44 +03:00
DarkPhoenix
27e361dc5b Attempt to fix hang on preferences close on Mac 2019-08-08 12:25:50 +03:00
DarkPhoenix
4c330bfb16 Increase travis git depth, because otherwise it fails git describe when there were no tags last x commits 2019-08-08 12:16:42 +03:00
DarkPhoenix
fcb85c85a3 Rename modules to items 2019-08-08 09:50:50 +03:00
DarkPhoenix
9be1b96226 Add modules to recents when they are removed too 2019-08-08 09:45:14 +03:00
DarkPhoenix
11598f9a09 Do not add items to recents which cannot be fetched (e.g. item was removed since last pyfa start) 2019-08-08 08:57:29 +03:00
DarkPhoenix
39e23237a5 Move functionality of storing item to market service 2019-08-08 08:54:41 +03:00
DarkPhoenix
22507673aa Do not sort items in recently used 2019-08-08 08:42:06 +03:00
DarkPhoenix
7fdcd4aa15 Do proper attribute conversions on window close 2019-08-07 23:18:06 +03:00
DarkPhoenix
c559508175 Avoid unnecessary calls 2019-08-07 23:05:55 +03:00
DarkPhoenix
95621b6aab Use spinbox as info source rather than mutator 2019-08-07 23:02:15 +03:00
DarkPhoenix
fb93aa1ad5 Fix crash on closing item stats window when mutation's tab animation was in progress 2019-08-07 22:49:30 +03:00
DarkPhoenix
035c69c60a Implement mutated item copy context menu 2019-08-07 15:44:12 +03:00
DarkPhoenix
788bbb5d25 Make dark lines a bit lighter 2019-08-07 14:27:27 +03:00
DarkPhoenix
04178ca824 Add option to disable cargo export in EFT format 2019-08-07 12:57:20 +03:00
DarkPhoenix
647bdb78df Fix minflood AAR penalty 2019-08-07 12:50:07 +03:00
DarkPhoenix
ce9099a25b Remove workaround as it seems to be not needed anymore 2019-08-07 12:31:35 +03:00
DarkPhoenix
4e715750a5 Apply stronger desaturation and shift from normal ligtness onto bright/dark graph lines 2019-08-07 11:57:40 +03:00
DarkPhoenix
b330f72326 Allow to edit target profiles via context menu 2019-08-07 10:27:41 +03:00
DarkPhoenix
dd5c95d2f2 Return white line for dark backgrounds 2019-08-07 09:48:39 +03:00
DarkPhoenix
ae5e0cc71a Update bright icon again - make it more saturated 2019-08-07 09:42:47 +03:00
DarkPhoenix
cfe0e36e48 Make bright icon brighter 2019-08-07 09:41:03 +03:00
DarkPhoenix
63a362286e Add comment on why we need marker 2019-08-07 09:38:01 +03:00
DarkPhoenix
2155aa0d21 Move proportion width calcuation to display class 2019-08-07 09:24:26 +03:00
DarkPhoenix
f52fda3f03 Implement auto proportion scaling weights 2019-08-07 09:12:50 +03:00
DarkPhoenix
f315f8b85a Increase column width 2019-08-07 08:52:56 +03:00
DarkPhoenix
72e56246f4 Rework legend to show lines rather than patches 2019-08-07 08:46:55 +03:00
DarkPhoenix
5102cb35c8 Instantiate target wrappers with proper line style 2019-08-07 00:02:58 +03:00
DarkPhoenix
170853f0f4 Add line style support 2019-08-06 23:51:09 +03:00
DarkPhoenix
7bc0d88898 Add line style icons 2019-08-06 23:17:06 +03:00
DarkPhoenix
4834cfe8ca Generalize style picker popup code 2019-08-06 16:27:44 +03:00
DarkPhoenix
2c2065119b Generalize some click code 2019-08-06 16:18:57 +03:00
DarkPhoenix
636672fdce Plug plot line lightness into everything 2019-08-06 16:11:56 +03:00
DarkPhoenix
bc8c70fa9c Add lightness icons 2019-08-06 15:38:52 +03:00
DarkPhoenix
e3ac9a7722 Add line lightness column 2019-08-06 15:13:35 +03:00
DarkPhoenix
e14d3d7214 Use set colors for actual graph 2019-08-06 14:27:35 +03:00
DarkPhoenix
5b898a678b Handle changing colors via color picker 2019-08-06 14:15:13 +03:00
DarkPhoenix
e2d6baaeb1 Add color named to dict with data 2019-08-06 13:08:19 +03:00
DarkPhoenix
eb87ba1d89 Automatically assign colors 2019-08-06 13:01:40 +03:00
DarkPhoenix
0257e70c29 Code color column to properly show wrapper color 2019-08-06 12:50:11 +03:00
DarkPhoenix
70d1a3534b Rework dict with color data to use color enum 2019-08-06 12:44:59 +03:00
DarkPhoenix
16f4903eba Add various color icons 2019-08-06 12:39:10 +03:00
DarkPhoenix
6b77d72f06 Add red color icon 2019-08-06 10:08:07 +03:00
DarkPhoenix
ac5768e666 Remove color column icon and set it to static size 2019-08-06 09:58:00 +03:00
DarkPhoenix
f3bd47f347 Add color getter-setter for source wrapper 2019-08-05 20:29:41 +03:00
DarkPhoenix
1fbb47d64b Add color column 2019-08-05 20:24:28 +03:00
DarkPhoenix
3797887abc Add color definitions 2019-08-05 20:11:19 +03:00
DarkPhoenix
8870eef79b Fix vector scrolling under Windows 2019-08-05 14:15:58 +03:00
DarkPhoenix
eefcd9e738 Fix mistype 2019-08-05 13:29:53 +03:00
DarkPhoenix
5f296bbe30 Fix display of shield and cap amount 2019-08-05 11:20:18 +03:00
DarkPhoenix
d88fa1131d Rescale proportions of source and target sizers according to amount of columns they have 2019-08-05 10:53:00 +03:00
DarkPhoenix
3c6071ad88 Do not show resist column and mode picker when resists are ignored 2019-08-05 10:41:06 +03:00
DarkPhoenix
deb772f0a7 Show "Effective" prefix when resists are not ignored 2019-08-05 10:26:17 +03:00
DarkPhoenix
858719aad8 Enable "open in new tab" menu 2019-08-05 09:57:08 +03:00
DarkPhoenix
14debfd25c Change proportions between attacker and target lists 2019-08-05 08:12:44 +03:00
DarkPhoenix
510c9cafec Add context menu to change resist modes 2019-08-05 03:10:41 +03:00
DarkPhoenix
6434902f86 Do actual resist calculations 2019-08-05 02:37:54 +03:00
DarkPhoenix
16be84420b Add display of resist mode to column 2019-08-05 02:23:39 +03:00
DarkPhoenix
8f2283f9aa Implement auto primary layer detection 2019-08-05 02:14:27 +03:00
DarkPhoenix
920b84886c Get proper wrapper when requesting it by row 2019-08-04 23:56:55 +03:00
DarkPhoenix
cb2f0e40ba Add column which shows target resists 2019-08-04 23:55:42 +03:00
DarkPhoenix
14a9c9910c Implement resist modes except for auto 2019-08-04 23:30:06 +03:00
DarkPhoenix
c8d0ae8659 Make internal list of wrapper private 2019-08-04 20:04:12 +03:00
DarkPhoenix
fd541ead6c Change sorting order 2019-08-04 00:27:09 +03:00
DarkPhoenix
71e7ea0230 Fix another issue when working with sets 2019-08-04 00:24:28 +03:00
DarkPhoenix
cab2d41269 Fix calculation crash in DPS graph 2019-08-04 00:20:22 +03:00
DarkPhoenix
f5b1c79029 Do not access properties which were removed 2019-08-04 00:07:55 +03:00
DarkPhoenix
885a3f1ac9 Remove unneeded property 2019-08-04 00:00:53 +03:00
DarkPhoenix
e821b2d09c Store wrappers in graph lists 2019-08-03 23:56:44 +03:00
DarkPhoenix
1b2bff8a77 Change default graph resolution and depth 2019-08-03 17:33:56 +03:00
DarkPhoenix
d213e94860 Reorganize graph folder structure 2019-08-03 17:23:34 +03:00
DarkPhoenix
d2b71d97d2 Minor style fixes 2019-08-03 01:27:21 +03:00
DarkPhoenix
1ff7bdf1a7 Increase resolution of warp time graph 2019-08-03 01:10:58 +03:00
DarkPhoenix
f221f2df4f Swap getters and denormalizers 2019-08-03 01:04:20 +03:00
DarkPhoenix
46f365c42d Change internal interfaces a little 2019-08-03 00:55:58 +03:00
DarkPhoenix
a53c00aeda Change linear iter function 2019-08-02 23:47:48 +03:00
DarkPhoenix
044818aa65 Change add extra points function style a little 2019-08-02 23:36:18 +03:00
DarkPhoenix
a55084dbae Do not flicker when switching graphs on Windows 2019-08-02 16:51:45 +03:00
DarkPhoenix
c2c9528e80 Implement "adaptive" resolution for smooth graphs 2019-08-02 16:43:10 +03:00
DarkPhoenix
9c7ad95f6e Add float error workarounds 2019-08-02 15:40:53 +03:00
DarkPhoenix
fe9dc0a3e5 Implement point getter for time functions 2019-08-02 15:18:31 +03:00
DarkPhoenix
25712ef778 Move data preparation for x time mixin to separate function 2019-08-02 15:02:42 +03:00
DarkPhoenix
a63b543e0c Rework DPS graph to use new getters as well 2019-08-02 14:45:11 +03:00
DarkPhoenix
8ebec1f957 Fix comment 2019-08-02 10:34:16 +03:00
DarkPhoenix
0733fee878 Rework shield regen graph 2019-08-02 10:32:02 +03:00
DarkPhoenix
d52dd535a3 Rework cap regen graph 2019-08-02 10:21:20 +03:00
DarkPhoenix
cbc6475875 Split up base graph file too 2019-08-02 10:09:05 +03:00
DarkPhoenix
c6de92592c Rework mobility graph to use new getters 2019-08-02 10:02:42 +03:00
DarkPhoenix
5f97734881 Make distinction between mainParam, mainParamRange and x
- mainParam: (handle, value)
- mainParamRange: (handle (value1, value2))
- x: value
2019-08-02 09:49:15 +03:00
DarkPhoenix
62fbb7c9c8 Rework warp time graph to use new getter approach 2019-08-02 09:36:22 +03:00
DarkPhoenix
4ddbdebae4 Specify cache getter in getters 2019-08-02 00:10:38 +03:00
DarkPhoenix
542b79fa00 Do not request needed data every point calculation 2019-08-02 00:02:51 +03:00
DarkPhoenix
9f6f5c8a76 Show addition of negative amount as subtraction 2019-08-01 23:46:40 +03:00
DarkPhoenix
8591f649d1 Fix the same in another view 2019-08-01 23:41:32 +03:00
DarkPhoenix
3bbd51614d Fix modifier signs in affected tab view 2019-08-01 23:40:01 +03:00
DarkPhoenix
cb20c8588f Add missing jump portal and clone vat bay effects 2019-08-01 23:16:01 +03:00
DarkPhoenix
10b1c6ebfb Show proper warp time even when various modules which reduce ship speed to 0 are active 2019-08-01 23:03:45 +03:00
DarkPhoenix
3c6739b83a Inputs->params in few remaining functions 2019-08-01 22:41:18 +03:00
DarkPhoenix
57426f783e Rework warp time graph to have single getter (and break all other graphs for now) 2019-08-01 20:25:57 +03:00
DarkPhoenix
0788ff050d Rename inputs into params when they are actually not inputs 2019-08-01 20:15:49 +03:00
DarkPhoenix
18d59c119c Add double-click support to fit browser lite 2019-08-01 15:38:52 +03:00
DarkPhoenix
ae34cd5422 Allow to specify None as distance - it means that range will be ignored and all weapons will always hit 2019-08-01 15:28:33 +03:00
DarkPhoenix
50807e9381 Add tooltip to time input field 2019-08-01 13:09:28 +03:00
DarkPhoenix
fdb4d4d443 Rework input class 2019-08-01 13:00:29 +03:00
DarkPhoenix
ff22f12a56 Add extra option to show/hide legend 2019-08-01 12:48:29 +03:00
DarkPhoenix
15dc2a325a Change layout of fit browser lite a little 2019-08-01 12:40:20 +03:00
DarkPhoenix
ee9c1db000 Add support for ship browser lite to projected view 2019-08-01 12:26:35 +03:00
DarkPhoenix
b3b134ea45 Add support for ship browser lite to command view 2019-08-01 12:21:01 +03:00
DarkPhoenix
2e9b024390 Add browser lite handlers to graphs window 2019-08-01 11:54:33 +03:00
DarkPhoenix
ee2193e1bb Implement moving of fits back and forth in ship browser lite 2019-08-01 11:46:04 +03:00
DarkPhoenix
a582cf93bd Revert "user short names" change 2019-08-01 11:30:43 +03:00
DarkPhoenix
fc2d7cf7b8 Search by short ship name in fit browser lite as well 2019-08-01 11:26:02 +03:00
DarkPhoenix
61836dbb83 Move browser out of context menu file and do not list fits already existing in window 2019-08-01 11:23:26 +03:00
DarkPhoenix
154122388e Use short ship names along with fit names 2019-08-01 11:12:26 +03:00
DarkPhoenix
0114417018 Do actual search of fits on the left 2019-08-01 09:32:45 +03:00
DarkPhoenix
e662edc2cc Set custom window name depending on context 2019-08-01 09:09:30 +03:00
DarkPhoenix
9e6cdb2f4f Set focus to search bar when opening fit browser lite 2019-08-01 09:04:01 +03:00
DarkPhoenix
98b1fdb476 Change layout of tgt profile editor 2019-08-01 08:56:46 +03:00
DarkPhoenix
0f0e544f54 Fill window with actual data 2019-08-01 08:38:45 +03:00
DarkPhoenix
6d50f03396 Make sure buttons are aligned vertically at the center 2019-08-01 00:48:27 +03:00
DarkPhoenix
7ec9d3f122 Make sure graphs properly react to target profile updates 2019-08-01 00:21:42 +03:00
DarkPhoenix
592adb36f1 Start implementing fit browser lite 2019-07-31 20:22:18 +03:00
DarkPhoenix
d571191ec2 Add menu which allows to add target profiles to graph 2019-07-31 16:23:11 +03:00
DarkPhoenix
1f5fe47580 Rework target profile and damage pattern menus to use regular ticks 2019-07-31 15:54:09 +03:00
DarkPhoenix
1e3783c21d Move target profile context menu handling to separate package
This is needed to be able to import them separately at different times and avoid code duplication
2019-07-31 09:53:37 +03:00
DarkPhoenix
7190d91d31 Enable "add currently open fit" context menu for graphs 2019-07-31 09:13:29 +03:00
DarkPhoenix
5f697c166a Enable context menus on target list 2019-07-31 08:57:20 +03:00
DarkPhoenix
68b5fd9893 Show tooltips for target profiles too 2019-07-31 08:54:31 +03:00
DarkPhoenix
3e1a91d073 Clear plot cache on tgt profile changes 2019-07-31 08:34:46 +03:00
DarkPhoenix
c68451228a Move more logic to base class 2019-07-31 00:04:54 +03:00
DarkPhoenix
77ae235385 Offload actual set adding logic to windows calling the context menu 2019-07-30 22:01:33 +03:00
DarkPhoenix
c4009bdbd7 Start sharing some functionality between fit and target lists 2019-07-30 20:12:20 +03:00
DarkPhoenix
1eb48b00e1 Move fit-specific logic to fit list 2019-07-30 19:59:08 +03:00
DarkPhoenix
67cef93dd8 Re-use context menu infrastructure for fit list in graph window 2019-07-30 19:43:42 +03:00
DarkPhoenix
2aa274f56f Remove character editor implant set context menu hack as it's no longer needed 2019-07-30 19:20:14 +03:00
DarkPhoenix
cd20164d7a Pass calling window to context menu 2019-07-30 19:12:45 +03:00
DarkPhoenix
5a0ca503c1 Get rid of float error when converting float value to text in input boxes 2019-07-30 17:22:58 +03:00
DarkPhoenix
4c1c15e69e Rework target profile editor input boxes for better editing experience 2019-07-30 17:11:53 +03:00
DarkPhoenix
0320a16ba4 Merge branch 'master' into dps_sim_graph 2019-07-30 08:46:53 +03:00
DarkPhoenix
fcc8f3c5a7 Revert python version change used for tox 2019-07-30 08:45:56 +03:00
DarkPhoenix
fae3e8568a Merge branch 'graph_fix' 2019-07-30 08:44:40 +03:00
DarkPhoenix
4d2bb5ba87 Bump version 2019-07-30 08:22:54 +03:00
DarkPhoenix
d71cf64564 Add last known working numpy version 2019-07-30 08:11:16 +03:00
DarkPhoenix
1bb30499c2 Force MPL version to last known working 2019-07-30 07:59:19 +03:00
DarkPhoenix
d8deb98d7b Remove import of lib which is supposedly not used by older versions of
MPL
2019-07-27 23:05:14 +03:00
DarkPhoenix
e1078ef6da Try older MPL version 2019-07-27 22:20:58 +03:00
DarkPhoenix
a1d807bd45 Remove debugging stuff and try to downgrade matplotlib 2019-07-27 22:12:01 +03:00
DarkPhoenix
4f3228388c Try forcing module which is causing issues 2019-07-27 20:10:12 +03:00
DarkPhoenix
81e3edc041 Update some components in requirements file 2019-07-27 19:58:20 +03:00
DarkPhoenix
077db2ecd6 Add extra dependency to spec files 2019-07-27 19:14:31 +03:00
DarkPhoenix
6d2746ad75 Reraise exception on import 2019-07-27 19:02:10 +03:00
DarkPhoenix
0ffdae97fd Add some debug info to MPL import 2019-07-27 18:37:34 +03:00
DarkPhoenix
70fd1ac6de Update effects file 2019-07-27 12:49:39 +03:00
DarkPhoenix
78d056c6ff Merge branch 'master' into dps_sim_graph 2019-07-27 12:48:15 +03:00
DarkPhoenix
43ba63233d Merge branch 'vni_changes' 2019-07-27 12:43:54 +03:00
DarkPhoenix
adf750fe44 Adjust VNI effects 2019-07-27 12:32:56 +03:00
DarkPhoenix
250996e8ac Update icons 2019-07-27 08:58:27 +03:00
DarkPhoenix
56639a0812 Update database to 1541099 2019-07-27 08:50:47 +03:00
DarkPhoenix
c12e450648 Avoid reusing tooltips as it leads to segfaults due to some reason 2019-07-27 01:47:45 +03:00
DarkPhoenix
4fce6f7b99 Allow changing of extra attributes via profile editor 2019-07-26 19:30:10 +03:00
DarkPhoenix
27b8c12639 Add extra attributes to target profile editor 2019-07-26 17:48:19 +03:00
DarkPhoenix
5d5d9ff153 Rename pattern to profile 2019-07-26 15:55:10 +03:00
DarkPhoenix
d803c8374f Add target profile icon 2019-07-26 13:07:33 +03:00
DarkPhoenix
a5b22aa112 Denormalize infinity sig as special case, very much like 0 sig 2019-07-26 12:46:40 +03:00
DarkPhoenix
ae8fb25d3f Show plot marker if there's only one data point 2019-07-26 12:29:10 +03:00
DarkPhoenix
530dd1c03b Denormalize relative speed correctly if target has it equal to 0 2019-07-26 00:29:11 +03:00
DarkPhoenix
473b65850d Fetch target name correctly 2019-07-26 00:11:47 +03:00
DarkPhoenix
2c49bde5bf Do not consider TP multiplier as NaN for gun calculation 2019-07-26 00:00:18 +03:00
DarkPhoenix
97b32b33d3 Always show target profiles in target list 2019-07-25 23:48:24 +03:00
DarkPhoenix
1382e87133 Allow application of webs/TPs on target profiles 2019-07-25 20:49:20 +03:00
DarkPhoenix
19d03591b1 Process targets in DPS calculation code 2019-07-25 20:37:35 +03:00
DarkPhoenix
6f1321aa13 Initialize graph with ideal target profile, and plug it into UI's columns 2019-07-25 19:45:20 +03:00
DarkPhoenix
365a3798c2 Rename some remaining UI elements 2019-07-25 16:40:59 +03:00
DarkPhoenix
8d3981e1a4 Reimport extra target profile fields if they are defined 2019-07-25 16:36:22 +03:00
DarkPhoenix
e34fcb2f9c Rename multiple entities to reflect that it's target profile rather than target resists 2019-07-25 16:20:41 +03:00
DarkPhoenix
71f1c69f23 Plug new fields into actual targetResists objects 2019-07-25 10:00:51 +03:00
DarkPhoenix
072ad028a3 Add extra columns to target profile table 2019-07-24 19:50:58 +03:00
DarkPhoenix
a652e12fa4 Clear up drone/fighter DPS data on changing factor reload flag 2019-07-24 19:29:52 +03:00
DarkPhoenix
58f3618350 Add more info about various modules to misc column 2019-07-10 09:01:23 +03:00
DarkPhoenix
1b26cee9c1 Add some info about citadel modules to "Misc" column 2019-07-10 02:20:16 +03:00
DarkPhoenix
4752e5a20f Immobilize titans which use their DDs 2019-07-09 15:48:30 +03:00
DarkPhoenix
d8e277593d Add DD support to dps graph 2019-07-09 15:38:23 +03:00
DarkPhoenix
edbc341909 Use volley data in misc column to show doomsday damage 2019-07-09 07:49:17 +03:00
DarkPhoenix
5f20f249f7 Change reaper DD to show only one instance of damage 2019-07-09 07:41:10 +03:00
DarkPhoenix
a1de3b9225 Set published flag for DB TD 2019-07-09 00:37:36 +03:00
DarkPhoenix
5110e63809 Apply webs and TPs for all graph types 2019-07-08 19:53:10 +03:00
DarkPhoenix
26d4cfa2de Plug webs/TPs into x time graph 2019-07-08 19:24:43 +03:00
DarkPhoenix
ae1a9950bc Apply TP drones as well 2019-07-08 19:02:16 +03:00
DarkPhoenix
1c120f2fd6 Apply all webs including drones to target 2019-07-08 18:48:25 +03:00
DarkPhoenix
d7e45b0f76 Collect info about dromis into dictionary as well 2019-07-08 16:46:55 +03:00
DarkPhoenix
e796b748b6 Make sure dromis can be resisted 2019-07-08 16:37:43 +03:00
DarkPhoenix
a74984d37b Get resistance info of temporarily applied mods and use it during attr calculation 2019-07-08 11:42:04 +03:00
DarkPhoenix
e342f96fbe Move resistance attribute ID getter to separate function 2019-07-08 10:58:01 +03:00
DarkPhoenix
e262aa7daa Move resistance calculation to multiplication method 2019-07-08 10:27:06 +03:00
DarkPhoenix
c64d09ca54 Get data about webbing/TPing drones 2019-07-08 08:27:00 +03:00
DarkPhoenix
8def076175 Add burst projectors as webs/TPs 2019-07-08 08:16:23 +03:00
DarkPhoenix
a64fbd8976 Clear plot cache properly when target is modified 2019-07-08 07:34:09 +03:00
DarkPhoenix
eda869fe0d Skip modules which are not active 2019-07-08 07:22:21 +03:00
DarkPhoenix
04a74e278b Plug webs/TPs into calculation process 2019-07-08 00:29:23 +03:00
DarkPhoenix
6786cc7eff Expose boost/multiplier data to calculation method 2019-07-07 21:39:36 +03:00
DarkPhoenix
6984bd435f Add functions which calculate webbed/TPed stats and plug them into distance calculation 2019-07-07 21:22:23 +03:00
DarkPhoenix
ec8b771a24 Implement cache which stores data about cache TPs and webs 2019-07-07 20:16:21 +03:00
DarkPhoenix
6ce72e4fb3 Add methods which will be used to access temporarily modified values 2019-07-07 19:48:50 +03:00
DarkPhoenix
cda9ba5978 Add more columns for other graph types 2019-07-07 19:17:08 +03:00
DarkPhoenix
e2ae89f6b9 Add more columns to DPS graphs 2019-07-07 18:55:52 +03:00
DarkPhoenix
3bc3705c42 Show icons instead of names for dps/volley columns 2019-07-07 18:02:53 +03:00
DarkPhoenix
522de5ca5a Do not set column image if there's none 2019-07-07 17:27:37 +03:00
DarkPhoenix
efd8a6964e Add/remove fit list columns dynamically as graph is switched 2019-07-07 17:00:42 +03:00
DarkPhoenix
1cd10d2109 Do not call command fit refresh twice 2019-07-07 15:07:24 +03:00
DarkPhoenix
3a09f4b45c Rework FitChanged command to avoid refreshing graph multiple times in certain cases 2019-07-07 14:25:27 +03:00
DarkPhoenix
64bc2c34c2 Move addition of column by name to separate method 2019-07-07 12:21:53 +03:00
DarkPhoenix
845630437e Do not show dps/volley columns by default 2019-07-07 12:10:32 +03:00
DarkPhoenix
c4484d735a Add dps/volley columns to fit list 2019-07-07 02:50:07 +03:00
DarkPhoenix
5b74c6c5e1 Update graph info when fit name changes 2019-07-07 02:33:54 +03:00
DarkPhoenix
3e410540c9 Implement cache clear reasons to avoid clearing caches when we do not need that (esp useful for dmg time cache) 2019-07-07 02:08:04 +03:00
DarkPhoenix
5bba1dc88b Add context menu item which controls if webs/TPs are applied to the target 2019-07-07 00:50:12 +03:00
DarkPhoenix
8c0cae8bc3 Switch drone mode handling to use enums 2019-07-06 12:31:26 +03:00
DarkPhoenix
71e55a000b Drone controls now actually control how drones apply on graph 2019-07-06 03:29:09 +03:00
DarkPhoenix
7bcdf95f5c Refresh graph when graph options change 2019-07-06 03:16:31 +03:00
DarkPhoenix
4402addcb0 Add drone options to context menus 2019-07-06 03:06:47 +03:00
DarkPhoenix
3d57861481 Add ignore target resists menu 2019-07-06 02:42:11 +03:00
DarkPhoenix
5d1d2b87df Add context menu support to graph window 2019-07-06 02:30:06 +03:00
DarkPhoenix
389b5d57aa Do not restore graph type selected last time 2019-07-06 01:02:18 +03:00
DarkPhoenix
53de46bab7 Add graph settings and save selected graph type there 2019-07-05 20:15:44 +03:00
DarkPhoenix
e6dce726b7 Rework how toggling factor reload works 2019-07-05 09:10:23 +03:00
DarkPhoenix
63ca8dc559 Recalc all fits which might need that when changing factorReload flag 2019-07-05 01:08:00 +03:00
DarkPhoenix
6e083a5af8 Merge branch 'dps_sim_graph' of github.com:pyfa-org/Pyfa into dps_sim_graph 2019-07-05 00:40:30 +03:00
DarkPhoenix
ac93c5487c Change the way force reload setting is changed 2019-07-05 00:36:44 +03:00
DarkPhoenix
1f94b28b87 Add fighter bomb support 2019-07-04 19:30:02 +03:00
DarkPhoenix
78b6eb4283 Add regular and guided bombs to graphs 2019-07-04 19:14:46 +03:00
DarkPhoenix
417e478d27 Add smartbombs to calculation 2019-07-04 18:37:26 +03:00
DarkPhoenix
78d2dff0d8 Move x time graphs to new methods 2019-07-04 17:37:45 +03:00
DarkPhoenix
63c45c5060 Plug in all calculations besides where X is time 2019-07-04 17:22:23 +03:00
DarkPhoenix
c4f225003a Add fighters to dps vs range graph 2019-07-04 14:33:28 +03:00
DarkPhoenix
185cf4f625 Add drones to dps-range calculation 2019-07-04 13:40:04 +03:00
DarkPhoenix
d2b838e9d5 Rework interface between dps graph and time cache 2019-07-04 13:10:45 +03:00
DarkPhoenix
15b6a848e8 Move warp time subwarp speed calculation to separate cache as well 2019-07-04 11:40:38 +03:00
DarkPhoenix
193fcc60d8 Split time cache into separate file as well 2019-07-04 09:36:31 +03:00
DarkPhoenix
ae110371fe Split up dps graph file a little 2019-07-04 09:11:55 +03:00
DarkPhoenix
5857413285 Get rid of float error when changing vector length via scrolling 2019-07-03 20:07:19 +03:00
DarkPhoenix
4448d7e62f Plug turrets and missiles into dps vs range calculation 2019-07-03 20:03:22 +03:00
DarkPhoenix
d3ca0a961e Implement various functions to calculate damage delivery to specific targets 2019-07-03 18:06:33 +03:00
DarkPhoenix
405492d9d7 Move all the turret calculation logic into new graph 2019-07-03 11:38:21 +03:00
DarkPhoenix
d27d7656d5 Implement turret cth formula 2019-07-03 10:38:06 +03:00
DarkPhoenix
120bd9aa0c Set attacker vector to 90 degrees as well to be able to transversal match with fewer clicks 2019-07-03 10:23:12 +03:00
DarkPhoenix
6ab79ab5c0 Fix angular speed calculation 2019-07-03 10:19:33 +03:00
DarkPhoenix
b8d189c0ad Change vector behavior to be consistent with trigonometry 2019-07-03 10:14:55 +03:00
DarkPhoenix
86e04321c8 Add some calculations to angular velocity calculator 2019-07-03 08:39:44 +03:00
DarkPhoenix
6bcc906c4a Start moving some math to the new damage graph 2019-07-03 08:25:27 +03:00
DarkPhoenix
c3becec822 Refresh graph when calculation returned some error 2019-07-02 16:36:11 +03:00
DarkPhoenix
aae2e7c531 Enable all dps graphs over time 2019-07-02 16:30:24 +03:00
DarkPhoenix
52490144d3 Move some processing from intermediate method to final method to save resources when we need dps/volley, not damage 2019-07-02 14:42:03 +03:00
DarkPhoenix
c04c672f11 Fix incorrect intermediate-to-final cache conversion 2019-07-02 14:38:01 +03:00
DarkPhoenix
f51979b69a Plug new cache format into dmg vs time graph 2019-07-02 13:49:29 +03:00
DarkPhoenix
ab6b9759b0 Generate proper final dmg-time cache 2019-07-02 13:40:48 +03:00
DarkPhoenix
b3027532ff Collect all intermediate dps/volley/damage stats for all items 2019-07-02 02:08:29 +03:00
DarkPhoenix
494c9b08cb Start implementation of generic damage-time cache generator 2019-07-01 20:11:30 +03:00
DarkPhoenix
c595195519 Run special failover only on zero division errors 2019-07-01 12:32:28 +03:00
DarkPhoenix
c3efa819f4 Implement fallback for case when we convert relative value into absolute and then when converting it back to relative fails 2019-06-30 11:32:31 +03:00
DarkPhoenix
4e7580b277 Move dps vs time functionality to new graph 2019-06-29 23:49:43 +03:00
DarkPhoenix
af642a4259 Normalize to seconds when possible 2019-06-29 12:44:25 +03:00
DarkPhoenix
c365efb67e Move dmg vs time logic into new graph infrastructure 2019-06-29 12:31:30 +03:00
DarkPhoenix
fc7613451e Copy functionality from fit list to target list 2019-06-29 11:21:54 +03:00
DarkPhoenix
62b7b44120 Rework cache to store plot results based on composite key 2019-06-29 10:43:21 +03:00
DarkPhoenix
744fce2e82 Make it obvious that we're clearning cache by fitID 2019-06-29 10:31:21 +03:00
DarkPhoenix
dd55493b4e Minor stylistic fixes 2019-06-29 10:24:11 +03:00
DarkPhoenix
7e7b49d2e4 Move shield regen graph to new infrastructure 2019-06-29 10:21:16 +03:00
DarkPhoenix
24494e9b29 Rename cap graph 2019-06-29 00:28:24 +03:00
DarkPhoenix
eff0510092 Do not show time input when it's not needed 2019-06-28 22:08:19 +03:00
DarkPhoenix
988688939b Merge cap regen graph into already existing cap graph 2019-06-28 20:17:23 +03:00
DarkPhoenix
d448116e91 Transfer cap amount vs time graph to new infrastructure 2019-06-28 19:42:49 +03:00
DarkPhoenix
75ce6ffbcf Add stubs for getters 2019-06-28 19:07:16 +03:00
DarkPhoenix
60933a309f Re-enable dps graph again and add some info about how to process inputs and outputs
Real calculation hasn't been transferred yet
2019-06-28 18:56:57 +03:00
DarkPhoenix
428cb5c888 Re-enable mobility graph 2019-06-28 18:31:39 +03:00
DarkPhoenix
d195ec7e68 Move all the logic from eos graph to gui graph for warp time
Now backend graphs have to be aware of handles used in UI graphs, so why not
2019-06-28 15:44:50 +03:00
DarkPhoenix
c2017f3cb9 Re-enable DPS graph and make few fixes 2019-06-28 10:13:03 +03:00
DarkPhoenix
66ff4d827c Integrate graph frame with new APIs 2019-06-28 10:08:53 +03:00
DarkPhoenix
745914bf9e Add parameter normalization function 2019-06-28 09:24:06 +03:00
DarkPhoenix
421146eb54 More work on interfaces between gui and eos graphs 2019-06-27 20:45:21 +03:00
DarkPhoenix
ef81f9c830 Return input data in InputData objects for easier access 2019-06-27 18:52:23 +03:00
DarkPhoenix
1e760b2111 Re-enable warp graph and adapt it to new framework 2019-06-27 16:54:12 +03:00
DarkPhoenix
fe50372b12 Use unit as part of key again will be useful in warp graph 2019-06-27 13:15:22 +03:00
DarkPhoenix
7ef79eaa79 Stop using units as part of input key, they are not going to be different anyway 2019-06-26 21:39:12 +03:00
DarkPhoenix
9b282587b2 Remove limits argument as it's no longer used 2019-06-26 21:24:02 +03:00
DarkPhoenix
4af36514bc Handle vectors a in a separate function 2019-06-26 20:12:08 +03:00
DarkPhoenix
5320e99276 Restore values for vectors (just in case!) 2019-06-26 20:06:51 +03:00
DarkPhoenix
b733205541 Get rid of this smart shit and just store ranges and consts separately 2019-06-26 19:58:26 +03:00
DarkPhoenix
b125c62930 Reset stored values when switching graphs 2019-06-26 19:30:16 +03:00
DarkPhoenix
7895e4076d Add logic which transfers values when switching input fields 2019-06-26 19:29:11 +03:00
DarkPhoenix
9ec192de7d Add methods to convert input values 2019-06-26 18:59:52 +03:00
DarkPhoenix
8e41a31d1d Set vector defaults on initialization and graph switch 2019-06-26 18:03:37 +03:00
DarkPhoenix
fa4a2436aa When vectors are changed, ask to update graphs 2019-06-26 17:00:30 +03:00
DarkPhoenix
22ca78cb68 Implement method which gathers values across control panel boxes 2019-06-26 16:50:54 +03:00
DarkPhoenix
ee4a1f936b Add two classes to handle user input 2019-06-26 15:46:17 +03:00
DarkPhoenix
15a8c5750a Call layout when frame is created as well 2019-06-26 07:59:18 +03:00
DarkPhoenix
9f261f5b80 Change window size when needed 2019-06-26 07:53:22 +03:00
DarkPhoenix
b6a58b4ba6 Change vectors when needed 2019-06-25 19:53:13 +03:00
DarkPhoenix
09ca85ca81 Merge vector classes into one 2019-06-25 19:16:03 +03:00
DarkPhoenix
3aa69a6eaf Update inputs when X selection is updated 2019-06-25 17:42:15 +03:00
DarkPhoenix
2a645b1b04 Move input layout code into its own function 2019-06-25 16:56:26 +03:00
DarkPhoenix
0420f399ad Show-hide vectors and target list as needed 2019-06-25 16:37:33 +03:00
DarkPhoenix
509a45dcee Show labels for vectors separately 2019-06-25 16:02:45 +03:00
DarkPhoenix
52724d790b Change control panel layout 2019-06-25 15:25:48 +03:00
DarkPhoenix
4b960af9ab Rework code to use handle and unit to access various definitions 2019-06-25 11:40:10 +03:00
DarkPhoenix
022f0c06ee Do not show sig % except for the cases when it's used as main value range 2019-06-25 08:23:21 +03:00
DarkPhoenix
5ffd644ad9 Rework subgraph options 2019-06-24 20:24:19 +03:00
DarkPhoenix
03183827a6 Show all the needed controls on the panel 2019-06-24 16:15:35 +03:00
DarkPhoenix
5e7fcc32b6 Start adding code which uses new graph definition for layout 2019-06-24 10:33:59 +03:00
DarkPhoenix
3c0d87940b Change damage stats graph definition 2019-06-21 20:10:38 +03:00
DarkPhoenix
4cf07c4b76 Slap shit together and commit 2019-06-21 09:10:55 +03:00
DarkPhoenix
28db388fa0 Add subclass to specify direction only 2019-06-20 15:59:59 +03:00
DarkPhoenix
2c1905f041 Add vectors to panel (not yet functional) 2019-06-20 00:02:02 +03:00
DarkPhoenix
30d03f0ab5 Do not crash with Show y = 0 disabled and no fits 2019-06-18 16:38:10 +03:00
DarkPhoenix
4ca3f10bc9 Move more stuff away from the frame 2019-06-18 16:12:27 +03:00
DarkPhoenix
9cc228cfff Always run localized injectors heat effect early to apply heat bonus regardless of effect run ordering 2019-06-17 10:10:58 +03:00
DarkPhoenix
3359d8cb88 More code to control panel 2019-06-14 18:26:21 +03:00
DarkPhoenix
738d7f687d Move more code to control panel file 2019-06-14 16:38:41 +03:00
DarkPhoenix
b224196b05 Get rid of logic which handles legacy versions of matplotlib 2019-06-14 14:43:42 +03:00
DarkPhoenix
bbcc32c8cf Split graph frame into multiple files 2019-06-14 13:17:11 +03:00
DarkPhoenix
3c0b8643f6 Move graph file into graph package 2019-06-13 13:28:04 +03:00
DarkPhoenix
c85b6e4a36 Add vector class 2019-06-13 13:20:04 +03:00
DarkPhoenix
6003302e10 Merge branch 'master' into dps_sim_graph 2019-06-13 12:32:38 +03:00
DarkPhoenix
e7dd045979 Use default spool value for dps over range graph, if module has no per-module override 2019-06-06 20:14:32 +03:00
DarkPhoenix
6ca7a22c3e Add info about effective capacitor which takes into consideration neut resistance 2019-06-06 17:29:10 +03:00
DarkPhoenix
e8f09514ab Swap extra cap stats readout 2019-06-06 17:20:05 +03:00
DarkPhoenix
1a3a656879 Optimize checking long lines for speed 2019-06-06 09:09:25 +03:00
DarkPhoenix
e77ada4e8c Start searching from 1 char if strin contains CJK glyphs 2019-06-05 19:06:17 +03:00
DarkPhoenix
41b72c2789 Fix comment 2019-06-04 09:51:10 +03:00
DarkPhoenix
a4be7c5e9a Leave more time for less prioritized sources if more prioritized sources spent less time than we allocated to them 2019-06-04 09:42:44 +03:00
DarkPhoenix
fb3c183b3e Do not attempt to fetch data from unknown systems 2019-06-03 18:39:23 +03:00
DarkPhoenix
3e7dbef659 Remove debugging print 2019-06-03 18:31:48 +03:00
DarkPhoenix
89260d1d36 Always prefer primary data source, and switch evepraisal market source to use min price for items 2019-06-03 18:29:38 +03:00
DarkPhoenix
d451bda7ed Add evepraisal as price source 2019-06-03 18:02:48 +03:00
Anton Vorobyov
933c84466f Merge pull request #1993 from MaruMaruOO/master
Fix for EFS exports with ASBs.
2019-05-31 08:15:38 +03:00
MaruMaruOO
d4c9100f77 Fix for EFS exports with ASBs. 2019-05-30 20:34:55 -04:00
DarkPhoenix
c6aa72a3e3 Re-enable target list in graph panel 2019-05-29 15:29:24 +03:00
DarkPhoenix
7cf6ff04b6 Comment out target list as it caused graphical issues on windows 2019-05-28 17:47:27 +03:00
DarkPhoenix
5b575fdfe3 Make sure panel has no padding to avoid ugly border on Windows 2019-05-28 17:30:50 +03:00
DarkPhoenix
a8a5fabce7 Always add last data point to dps over time graph 2019-05-28 16:33:30 +03:00
DarkPhoenix
f41d6dd2c1 Update database to 1514398 2019-05-28 16:15:29 +03:00
DarkPhoenix
09727c102a Bump pyfa version 2019-05-28 16:06:40 +03:00
DarkPhoenix
6580734dc7 Print full connection exception in case of failure in debug mode 2019-05-28 16:03:25 +03:00
DarkPhoenix
ff34865067 Add target panel as dark code 2019-05-28 15:05:16 +03:00
DarkPhoenix
bdd400fd51 Remove conflicting shortcut 2019-05-27 19:07:58 +03:00
DarkPhoenix
1e8184a80b Make ESI browser tree panel non-scalable 2019-05-27 19:06:53 +03:00
DarkPhoenix
6a20f04c7f Merge branch 'master' into singularity 2019-05-27 19:04:27 +03:00
Anton Vorobyov
d81acc1f9c Merge pull request #1987 from AaronOpfer/esi_import_sizing
improve sizing on esi fit import browser
2019-05-27 19:03:59 +03:00
DarkPhoenix
bc84c20cb2 Update database with actual contents before and after fill, also do it in UI commands 2019-05-27 15:35:14 +03:00
DarkPhoenix
d5c5e2698e Redraw only after some delay (reuse market search delay for that) 2019-05-27 13:46:40 +03:00
Anton Vorobyov
16a78e689e Merge pull request #1988 from MaruMaruOO/master
Updates EFS exports to support local repairs, cap  warfare and ammo switching.
2019-05-27 10:32:49 +03:00
MaruMaruOO
066f29660d Added repair and cap data to EFS exports. 2019-05-27 02:18:10 -04:00
Aaron Opfer
bba0df5f50 improve sizing on esi fit import browser
On my machine, using the ESI import feature and clicking "Fetch Fits" gives the appearance of nothing happening. Turns out, this was because by default the tree on the left-hand side of the window has zero width by default and the parent window needs to be resized to see the fits. Fix this by setting a minimum size for the fitting browser tree and increase the default window size to compensate.
2019-05-26 04:33:15 -05:00
DarkPhoenix
45452ca680 Add rename mappings for faction trig guns 2019-05-25 22:04:17 +03:00
DarkPhoenix
4fbbc18f9f Accept mix of localized hints and regular names in XML importer 2019-05-25 17:43:47 +03:00
DarkPhoenix
22ec280ec2 Fix showing of neut resistance 2019-05-24 23:17:02 +03:00
DarkPhoenix
89c06b5201 Rescale contents on graph switch 2019-05-24 13:35:45 +03:00
DarkPhoenix
86d5f72988 Normalize drone tracking for Misc column 2019-05-23 15:49:49 +03:00
MaruMaruOO
c3e055a4c9 Merge branch 'master' of https://github.com/pyfa-org/Pyfa 2019-05-22 02:55:46 -04:00
MaruMaruOO
e48631956d Add typeIDs for cargo to EFS exports. 2019-05-22 02:35:47 -04:00
DarkPhoenix
2964f3b009 Do not recreate checkbox on each graphical switch
Leads to weird graphical glitches on GTK
2019-05-21 22:09:08 +03:00
DarkPhoenix
527c66dca4 Change the way radio buttons look 2019-05-21 21:29:26 +03:00
DarkPhoenix
24909f0523 Extend allowable range a little so that first reload of triglavians is included 2019-05-21 21:11:09 +03:00
DarkPhoenix
ed7494b3a4 Implement graph type selection 2019-05-21 19:47:55 +03:00
DarkPhoenix
8fae275e5a Cache graph values on GUI graphs so they do not get recalculated when graph options are changed 2019-05-21 19:06:11 +03:00
DarkPhoenix
a09a2a5f4b Add option whether 0 value should be shown or not on graphs 2019-05-21 17:51:50 +03:00
DarkPhoenix
2adc150811 Limit dmg and dps over time graphs to not hog resources on weaker machines for too long 2019-05-21 14:37:35 +03:00
DarkPhoenix
f5cad33b6c Some layout changes 2019-05-20 12:22:44 +03:00
DarkPhoenix
338cf45f65 Include "high" endpoint for damage over time graph 2019-05-20 10:41:26 +03:00
DarkPhoenix
359c60bafb Increase graph size and add some padding 2019-05-20 10:32:40 +03:00
DarkPhoenix
f808b73a5d Add axis labels 2019-05-20 07:56:04 +03:00
DarkPhoenix
8dd87cde58 When fit is removed, update projected/command contents if needed 2019-05-19 21:53:44 +03:00
DarkPhoenix
1ec78d9beb Remove fit from graph window when it gets deleted 2019-05-19 21:29:43 +03:00
DarkPhoenix
9c710285f2 Do not cycle over mods which are not dealing damage when composing cache 2019-05-19 21:04:41 +03:00
DarkPhoenix
90f745a18f Refresh cache only for changed fits rather than every fit 2019-05-19 20:54:12 +03:00
DarkPhoenix
af446579ab Get clean subwarp speed (no cloaks, propmods, webs etc) 2019-05-19 20:38:56 +03:00
DarkPhoenix
bcc11bd172 Reorder fields in graph 2019-05-19 14:11:05 +03:00
DarkPhoenix
0c31f756a8 Restore DPS vs range graph 2019-05-19 14:02:24 +03:00
DarkPhoenix
16fdd5a5e6 Fix warp graph 2019-05-19 04:07:40 +03:00
DarkPhoenix
ec1a2c66ee Restore shield graphs 2019-05-18 22:52:59 +03:00
DarkPhoenix
c3f41d68e6 Round in getYforX as well 2019-05-18 11:19:08 +03:00
DarkPhoenix
2f8701b4b2 Rework plot point processing for dmg over time graph the same way 2019-05-18 11:15:27 +03:00
DarkPhoenix
9b2d5410d6 Fix dps over time graph 2019-05-18 11:03:12 +03:00
Anton Vorobyov
1d8c9d2c40 Merge pull request #1977 from jtaylormayfield/master
Applied implant and booster skill check
2019-05-18 01:04:05 +03:00
J. Taylor Mayfield
8c0817245f Include skill prerequisites for applied implants and boosters in fit skill check. 2019-05-17 15:27:17 -05:00
DarkPhoenix
2a04e60ae0 Restore functionality of dmg vs time graph 2019-05-17 18:44:52 +03:00
DarkPhoenix
fb5eb220fd Rework graph interfaces again 2019-05-17 17:48:20 +03:00
DarkPhoenix
512f48ebdd Force frame refresh on graph redraw 2019-05-17 16:02:43 +03:00
DarkPhoenix
09db7d26a7 Rework mobility vs time graph 2019-05-17 15:38:06 +03:00
DarkPhoenix
690cf5eca1 Rework cap regen graph to use new interfaces 2019-05-17 15:11:52 +03:00
DarkPhoenix
1aee4c59c4 Merge branch 'singularity' of github.com:pyfa-org/Pyfa into singularity 2019-05-17 14:49:13 +03:00
DarkPhoenix
f1384074b5 Rework internal graph interfaces 2019-05-17 14:48:42 +03:00
DarkPhoenix
203bed06d6 Do not consider previous item heights when setting new item height 2019-05-16 22:13:01 +03:00
DarkPhoenix
0b00e28863 Fix #1974 2019-05-15 01:15:41 +03:00
DarkPhoenix
d74d331642 Merge branch 'singularity' of github.com:pyfa-org/Pyfa into singularity 2019-05-15 00:52:23 +03:00
DarkPhoenix
f075fbdc63 Do not show abyssal items in variations menu 2019-05-15 00:52:04 +03:00
DarkPhoenix
d59b6696ca Remove links to unmaintained packages 2019-05-14 14:22:09 +03:00
Anton Vorobyov
eedf6f9a39 Merge pull request #1973 from ZeroPointEnergy/pyfa_gentoo_overlay
Add link to Gentoo pyfa overlay
2019-05-14 14:19:07 +03:00
DarkPhoenix
1cca5729fc Add cap delta to tooltip on capacitor view 2019-05-14 14:15:58 +03:00
Andreas Zuber
a7b01ece22 Add link to Gentoo pyfa overlay 2019-05-14 13:08:47 +02:00
DarkPhoenix
d17e6d08d8 Fix definite integral calculation for distance traveled graph 2019-05-13 10:03:19 +03:00
DarkPhoenix
b29aaa9e20 Show ship name in legend as well (short, if needed) 2019-05-13 09:27:25 +03:00
DarkPhoenix
71ae59b2b5 Bump version 2019-05-13 06:48:35 +03:00
DarkPhoenix
51294f6cbc Change the way graphs are imported 2019-05-13 06:46:25 +03:00
DarkPhoenix
0439ace886 UK -> US spelling 2019-05-12 18:35:23 +03:00
DarkPhoenix
c85c735f9a Bump version 2019-05-12 18:04:40 +03:00
DarkPhoenix
c65b582497 Remove dot after "vs" 2019-05-12 18:01:44 +03:00
DarkPhoenix
7f2ac83e17 Add context menu which removes fits from graphs 2019-05-12 17:42:56 +03:00
DarkPhoenix
5ef2a40d1e Delete fits by pressing del key in graphs window 2019-05-12 17:32:17 +03:00
DarkPhoenix
5b52da737a Do not trigger esc when modifier keys are pressed 2019-05-12 17:08:41 +03:00
DarkPhoenix
51e8713cd6 Add warp time graph 2019-05-12 17:04:11 +03:00
DarkPhoenix
c9b60f2c65 Add distance vs time graph 2019-05-12 16:26:02 +03:00
DarkPhoenix
d777999af4 Add speed vs time graph 2019-05-12 15:46:50 +03:00
DarkPhoenix
74444d56c4 Add shield amount vs time graph 2019-05-12 15:30:41 +03:00
DarkPhoenix
a433c9638a Add cap-time graph 2019-05-12 14:59:19 +03:00
DarkPhoenix
672141cffc Add cap amount graph 2019-05-12 14:40:57 +03:00
DarkPhoenix
ac132cbb92 Add shield recharge graph 2019-05-12 14:32:57 +03:00
DarkPhoenix
d9535b08b1 Rename graphs 2019-05-12 12:28:47 +03:00
DarkPhoenix
d93544b3bc Fix DPS over time graph 2019-05-12 06:46:28 +03:00
DarkPhoenix
2320c3cb57 Make sure to include all Y-values 2019-05-12 05:54:03 +03:00
DarkPhoenix
bd5710c676 Calculate graph data only once 2019-05-12 05:30:49 +03:00
DarkPhoenix
49f1412d91 Fix bug with drones 2019-05-12 04:56:59 +03:00
DarkPhoenix
54eea7d702 Rework damage over time graph to show actual damage dealt per volley 2019-05-12 04:44:27 +03:00
DarkPhoenix
e26bcb2e5e Move DoT logic into volley parameter fetcher 2019-05-12 03:15:10 +03:00
DarkPhoenix
7305c0a017 Add optional parameter to cycle parameter getters 2019-05-12 02:55:42 +03:00
DarkPhoenix
7d37b9e0e0 Implement volley parameters for modules 2019-05-12 02:49:21 +03:00
DarkPhoenix
87f28db730 Implement volley parameters for drones and fighters 2019-05-12 02:38:36 +03:00
DarkPhoenix
56d9a8b626 Rework fighter calculations to use cycle parameters 2019-05-12 02:18:44 +03:00
DarkPhoenix
cb8f76c582 Implement module cycle parameters logic for modules 2019-05-11 17:34:01 +03:00
DarkPhoenix
af0b7b92c7 Implement cycle parameters for drones 2019-05-11 16:15:03 +03:00
DarkPhoenix
9418b7a709 Calculate 0 range data points 2019-05-11 14:53:59 +03:00
Alexander Maryanovsky
b2c718d614 Implemented copying the currently open fit stats to the clipboard. 2018-09-08 20:14:34 +03:00
1372 changed files with 3242939 additions and 28930 deletions

View File

@@ -1,124 +1,78 @@
image: Visual Studio 2019
clone_depth: 400
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
matrix:
- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"
init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- PYTHON: "C:\\Python37-x64"
# Should be enabled only for build process debugging
# init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- ps: echo("OS version:")
- ps: "[System.Environment]::OSVersion.Version"
- ECHO "Filesystem root:"
- ps: "ls \"C:/\""
- ps: echo("Filesystem - root:")
- ps: "ls \"C:\\\""
- ECHO "Filesystem projects root:"
- ps: echo("Filesystem - projects root:")
- ps: "ls \"C:\\projects\\\""
- ECHO "Filesystem pyfa root:"
- ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\""
- ps: echo("Filesystem - pyfa root:")
- ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\\\""
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
- ps: echo("Filesystem - installed SDKs:")
- ps: "ls \"C:\\Program Files (x86)\\Windows Kits\\\""
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- cmd: "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- cmd: "python --version"
- cmd: "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"
- cmd: "python -m pip install --upgrade pip"
# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- ECHO "Install pip requirements:"
- "pip install -r requirements.txt"
- "pip install PyInstaller"
- ps: echo("Install pip requirements:")
# This one is needed to build wxpython 4.0.6 on windows
- cmd: "python -m pip install pathlib2"
- cmd: "python -m pip install -r requirements.txt"
- cmd: "python -m pip install PyInstaller==3.6"
before_build:
# directory that will contain the built files
- ps: $env:PYFA_DIST_DIR = "c:\projects\$env:APPVEYOR_PROJECT_SLUG\dist"
- ps: $env:PYFA_VERSION = (python ./scripts/dump_version.py)
- ps: echo("pyfa version ")
- ps: echo ($env:PYFA_VERSION)
- ps: echo("pyfa version $env:PYFA_VERSION")
build_script:
- ECHO "Build pyfa:"
##########
# PyInstaller - create binaries for pyfa
##########
- ps: echo("Build pyfa:")
# Build gamedata DB
- cmd: "python db_update.py"
# Build command for PyInstaller
- "python -m PyInstaller --noupx --clean --windowed --noconsole -y pyfa.spec"
- cmd: "python -m PyInstaller --noupx --clean --windowed --noconsole -y pyfa.spec"
# Copy over manifest (See pyfa-org/pyfa#1622)
- ps: xcopy /y dist_assets\win\pyfa.exe.manifest $env:PYFA_DIST_DIR\pyfa\
# Not really sure if this is needed, but why not
- ps: xcopy /y dist_assets\win\Microsoft.VC90.CRT.manifest $env:PYFA_DIST_DIR\pyfa\
##########
# InnoScript EXE building
# This is in a separate script because I don't feel like copying over the logic to AppVeyor script right now...
##########
- "python dist_assets/win/dist.py"
# InnoScript EXE building. This is in a separate script because I don't feel like copying over the logic to AppVeyor script right now...
- cmd: "python dist_assets/win/dist.py"
- ps: dir $env:PYFA_DIST_DIR/
#- ECHO "Build pyfa (Debug):"
#- copy C:\projects\pyfa\dist_assets\win\pyfa_debug.spec C:\projects\pyfa\pyfa_debug.spec
#- "pyinstaller.exe --clean --noconfirm --windowed --upx-dir=C:\\projects\\pyfa\\scripts\\upx.exe C:\\projects\\pyfa\\pyfa_debug.spec"
build: on
after_build:
- ps: "ls \"./\""
#- ps: "ls \"C:\\projects\\pyfa\\build\\pyfa\\\""
# - ps: "ls \"C:\\projects\\$env:APPVEYOR_PROJECT_SLUG\\build\\exe.win32-2.7\\\""
# Zip
# APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER
#- 7z a build.zip -r C:\projects\pyfa\build\pyfa\*.*
- ps: 7z a "pyfa-$env:PYFA_VERSION-win.zip" -r "$env:PYFA_DIST_DIR\pyfa\*.*"
#- 7z a pyfa_debug.zip -r C:\projects\pyfa\dist\pyfa_debug\*.*
on_success:
# Do nothing right now
- ps: 7z a "pyfa-$env:PYFA_VERSION-win.zip" -r "$env:PYFA_DIST_DIR\pyfa\*"
test_script:
#- tox
#- "py.test --cov=./"
# Run the project tests
# - "%CMD_IN_ENV% python C:/projects/eve-gnosis/setup.py nosetests"
after_test:
# If tests are successful, create binary packages for the project.
# - "%CMD_IN_ENV% python setup.py bdist_wheel"
# - "%CMD_IN_ENV% python setup.py bdist_wininst"
# - "%CMD_IN_ENV% python setup.py bdist_msi"
# - ps: "ls dist"
# Ha... we're just building
artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: pyfa*-win.zip
- path: pyfa*-win.exe
#- path: pyfa_debug.zip
# name: Pyfa_debug
deploy:
tag: $(pyfa_version)
@@ -126,10 +80,9 @@ deploy:
description: 'Release description'
provider: GitHub
auth_token:
secure: BfNHO66ff5hVx2O2ORbl49X0U/5h2V2T0IuRZDwm7fd1HvsVluF0wRCbl29oRp1M
secure: X+U3hOAMTt7HGXCR/LXaGNF6qyhUXetrjz5+xlWiNJQ3XEdzhZZmHK75m0Hm6qre
draft: true
force_update: false
# deploy on tag push only
on:
APPVEYOR_REPO_TAG: true # deploy on tag push only
#on_success:
# - TODO: upload the content of dist/*.whl to a public wheelhouse
#
APPVEYOR_REPO_TAG: true

View File

@@ -1,16 +1,18 @@
os: linux
language: python
git:
depth: 400
python:
- 3.6
- 3.8
matrix:
include:
- os: osx
osx_image: xcode7.3
osx_image: xcode11.3
language: generic
env: PYTHON=3.6.1
before_install:
- bash scripts/setup-osx.sh
install:
- python3 db_update.py
- export PYFA_VERSION="$(python3 scripts/dump_version.py)"
- bash scripts/package-osx.sh
before_deploy:
@@ -19,7 +21,7 @@ before_deploy:
deploy:
provider: releases
api_key:
secure: Xfu0xApoB0zUPLXl29aYUulVC3iA4/3bXQwwADKCfAKZwxgNon4dLbO7Rie5/7Ukf2POL0KwmRaQGN3kOr+XSoIVTE4M5sXxnhiaaLGKQ+48hDizLE6JuXcZGJvkxUaghaTzIdCwHsG7VGBsPfQgfGsjJcfBp8tFNLmRyM/Jpsr8T6BR2MxtBIEUVy8zrOWFNZqnmWrY2pWMsB9fYt3JFNdpqeIgRAYqbBsBcZQ1MngLTi3ztuYS5IaF+lk06RrnBlHmUsJu/5nCvIpvPvD0i2BLZ3Uu0+Fn+8QWUgjJEL9MNseXZMXynu05xd8YRk7Ajc9CUrzQIIbAktyteYp85kE3pUJHmrMLcXhh7nqkwttR5/47Zwa3OLJLJFKBxMx6wY5jFkJjkV08850B7aWrmTFl/Eqc3Q5nZMuiEt3wFRbjxHi9h1mTN/fkxfRRHg8u3ENGPR+ZPiFC3J18qtks/B/hsKjjHvZP1i79OYlET4V/zyLyyQkCbpDaARQANuotLYJyZ7tH+KWEyRsvTi0M9Yev9mNNw6aI4vzh4HfkEhvcvnWnYwckPj1dnjQ573Qpw0Z9wsconoWfHAn+hBDt3+YLMrrFZl++mCRskHH1mZChX3aGMDi49zD0kfxBUkYPOAhguc6PwudBxHUZP+O6T/SoHylff6EizCE/k5dGeAk=
secure: D8tBW0kyHlKf/sXS69aIuexsYTx9auY2DzudKFlfcvdzqat4N2XZqZbZCTVd7YVvptQ8Dj0oZ/p3KUxEGpnJZmlTeJL142rpM/qaNd6wOIMy2yUde/aZl+W9JLFNQp7KHutM+MxObYLzJGihx/8YsupmFx6lxgdngGDXtXYZe/ruDIWDs92ShoKJ4vlce9Csm7eGKv7wv6Z6V9sD5FS3E9J8xdWStHxsbrkPBOflmG+uHU09dpEqzUm+ZYROIoTwig1Xbw3fw+gfjmNrfdSU4fAJcVZI1hrgoenZyJbMfhI2Ej/nZdbZgaXcZNF/eUpqOGgbPe1JljqFnHTbexcE+LPBVyAToScsGMpByHhig67DrZ0nk9gSZoC6CPNl5YS6xub+5dncMJ3P5L03DOGYRu4SL9NczbeuQyKuea7+JPP/8VLwfFDSEqbNEAmgzABAzrdfano+VXtuBuE/Tiy5eE7le9hJu6aSQoKW1SA3cUhMsmr2amzdO96sh+PN8FA1oNr45Yuy0pqOj4SUIkb8JUy4th7vgdhljEkSxrHDK1UcHpxUTp+IIUZkZVVk50aH68dQZxGwSTVOeRxpjrTcEf7VCGaM98qxi/ZK4RW6Ewiq0eo0AxwEeB2Zm841lycGPR/406vM9/ZBzv5IhELIdDdVWTk+dGjJBXB8z5hPJOg=
file_glob: true
file: "dist/pyfa-*.zip"
skip_cleanup: true

102
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,102 @@
# Contribution
## Requirements
- Python 3.6
- Git CLI installed
- Python, pip and git are all available as command-line commands (add to the path if needed)
Virtual environment will be created in *PyfaEnv* folder. Project will be cloned and run from the *PyfaDEV* folder. Separate virtual environment will be created so required libraries won't clutter the main python installation.
> Commands and screens were created on Windows 10. Please, update all the paths according to your OS.
## Setting up the project manually
Clone the repository
```
git clone <repo> PyfaDEV
```
Create the virtual environment
```
python -m venv PyfaEnv
```
Activate the virtual environment
```
For cmd.exe: PyfaEnv\scripts\activate.bat
For bash: source <venv>/Scripts/activate
```
> For other OS check [Python documentation](https://docs.python.org/3/library/venv.html)
Install requirements for the project from *requirements.txt*
```
pip install -r PyfaDEV\requirements.txt
```
> For some Linux distributions, you may need to install separate wxPython bindings, such as `python-matplotlib-wx`
Check that the libs from *requirements.txt* are installed
```
pip list
```
Test that the project is starting properly
```
python PyfaDEV\pyfa.py
```
## Setting up the project with PyCharm/IntelliJ
Install PyCharm / Other IntelliJ product with Python plugin
After launching - select *Check out from Version Control* -> *GIt*
![welcome](https://user-images.githubusercontent.com/54093496/66862580-d8edab00-ef99-11e9-94e2-e93d7043e620.png)
Login to GitHub, paste the repo URL and select the folder to which to clone the project into, press *Clone*.
![Clone](https://user-images.githubusercontent.com/54093496/66862748-38e45180-ef9a-11e9-9f68-4903baf47385.png)
After process is complete, open *File* -> *Settings* -> *Project* -> *Project Interpreter*.
![Settings](https://user-images.githubusercontent.com/54093496/66862792-544f5c80-ef9a-11e9-9e0f-f64767f3f1b0.png)
Press on options and add new virtual environment.
![venv](https://user-images.githubusercontent.com/54093496/66862833-67622c80-ef9a-11e9-94fa-47cca0158d29.png)
Open project tree view and double-click on the *requirements.txt*. Press *Install requirements*. Install all requirements.
![Reqs](https://user-images.githubusercontent.com/54093496/66862870-7a74fc80-ef9a-11e9-9b18-e64be42c49b8.png)
Create new *Run Configuration*. Set correct *Script path* and *Python interpreter*.
![Run configuraion](https://user-images.githubusercontent.com/54093496/66862970-b4460300-ef9a-11e9-9fb4-20e24759904b.png)
Check that the project is starting properly.
## Running tests
Switch to the proper virtual environment
```
For cmd.exe: PyfaEnv\scripts\activate.bat
For bash: source <venv>/Scripts/activate
```
Install pytest
```
pip install pytest
```
Switch to pyfa directory.
Run tests (any will do)
```
python -m pytest
py.test
```
More information on tests can be found on appropriate [Wiki page](https://github.com/pyfa-org/Pyfa/wiki/Developers:-Writing-Tests-for-Pyfa).

View File

@@ -2,20 +2,19 @@
[![Join us on Slack!](https://pyfainvite.azurewebsites.net/badge.svg)](https://pyfainvite.azurewebsites.net/) [![Build Status](https://travis-ci.org/pyfa-org/Pyfa.svg?branch=master)](https://travis-ci.org/pyfa-org/Pyfa)
![pyfa](https://cloud.githubusercontent.com/assets/3904767/10271512/af385ef2-6ade-11e5-8f67-52b8b1e4c797.PNG)
![pyfa](https://user-images.githubusercontent.com/275209/66119992-864be080-e5e2-11e9-994a-3a4368c9fad7.png)
## What is it?
pyfa, short for **py**thon **f**itting **a**ssistant, allows you to create, experiment with, and save ship fittings without being in game. Open source and written in Python, it is available on any platform where Python 2.x and wxWidgets are available, including Windows, Mac OS X, and Linux.
Pyfa, short for **py**thon **f**itting **a**ssistant, allows you to create, experiment with, and save ship fittings without being in game. Open source and written in Python, it is available on any platform where Python 3 and wxWidgets are available, including Windows, Mac OS X, and Linux.
## Latest Version and Changelogs
The latest version along with release notes can always be found on the project's [Releases](https://github.com/DarkFenX/Pyfa/releases) page. pyfa will notify you if you are running an outdated version.
The latest version along with release notes can always be found on the project's [releases](https://github.com/pyfa-org/Pyfa/releases) page. Pyfa will notify you if you are running an outdated version.
## Installation
Windows and OS X users are supplied self-contained builds of pyfa on the [latest releases](https://github.com/pyfa-org/Pyfa/releases/latest) page. An `.exe` installer is also available for Windows builds. Linux users can run pyfa using their distribution's Python interpreter. There is no official self-contained package for Linux, however, there are a number of third-party packages available through distribution-specific repositories.
#### OS X
### OS X
Apart from the official release, there is also a [Homebrew](http://brew.sh) option for installing pyfa on OS X. Please note this is maintained by a third-party and is not tested by pyfa developers. Simply fire up in terminal:
```
$ brew install Caskroom/cask/pyfa
@@ -24,39 +23,34 @@ $ brew install Caskroom/cask/pyfa
### Linux Distro-specific Packages
The following is a list of pyfa packages available for certain distributions. Please note that these packages are maintained by third-parties and are not evaluated by the pyfa developers.
* Debian/Ubuntu/derivatives: https://github.com/AdamMajer/Pyfa/releases
* Arch: https://aur.archlinux.org/packages/pyfa/
* openSUSE: https://build.opensuse.org/package/show/home:rmk2/pyfa
* FreeBSD: http://www.freshports.org/games/pyfa/ (see [#484](https://github.com/pyfa-org/Pyfa/issues/484) for instructions)
* Gentoo: https://github.com/ZeroPointEnergy/gentoo-pyfa-overlay
### Dependencies
If you wish to help with development or simply need to run pyfa through a Python interpreter, the following software is required:
* Python 3.6
* Requirements as listed in `requirements.txt`
## Contribution
If you wish to help with development or you need to run pyfa through a Python interpreter, check out [the instructions](https://github.com/pyfa-org/Pyfa/blob/master/CONTRIBUTING.md).
## Bug Reporting
The preferred method of reporting bugs is through the project's [GitHub Issues interface](https://github.com/pyfa-org/Pyfa/issues). Alternatively, posting a report in the [pyfa thread](http://forums.eveonline.com/default.aspx?g=posts&t=247609) on the official EVE Online forums is acceptable. Guidelines for bug reporting can be found on [this wiki page](https://github.com/DarkFenX/Pyfa/wiki/Bug-Reporting).
The preferred method of reporting bugs is through the project's [GitHub Issues interface](https://github.com/pyfa-org/Pyfa/issues). Alternatively, posting a report in the [pyfa thread](https://forums.eveonline.com/t/27156) on the official EVE Online forums is acceptable. Guidelines for bug reporting can be found on [this wiki page](https://github.com/pyfa-org/Pyfa/wiki/Bug-Reporting).
## License
pyfa is licensed under the GNU GPL v3.0, see LICENSE
Pyfa is licensed under the GNU GPL v3.0, see LICENSE
## Resources
* Development repository: [https://github.com/pyfa-org/Pyfa](https://github.com/pyfa-org/Pyfa)
* [Development repository](https://github.com/pyfa-org/Pyfa)
* [EVE forum thread](https://forums.eveonline.com/t/27156)
* [EVE University guide using pyfa](http://wiki.eveuniversity.org/Guide_to_using_PYFA)
* [EVE University guide using pyfa](https://wiki.eveuniversity.org/PYFA)
* [EVE Online website](http://www.eveonline.com/)
## Contacts:
* Sable Blitzmann
* GitHub: @blitzmann
* [TweetFleet Slack](https://www.fuzzwork.co.uk/tweetfleet-slack-invites/): @blitzmann
* [Gitter chat](https://gitter.im/pyfa-org/Pyfa): @ blitzmann
* Email: sable.blitzmann@gmail.com
* Kadesh / DarkPhoenix
* GitHub: @DarkFenX
* EVE: Kadesh Priestess
* Email: phoenix@mail.ru
* Sable Blitzmann
* GitHub: @blitzmann
* [TweetFleet Slack](https://www.fuzzwork.co.uk/tweetfleet-slack-invites/): @blitzmann
* [Gitter chat](https://gitter.im/pyfa-org/Pyfa): @blitzmann
* Email: sable.blitzmann@gmail.com
## CCP Copyright Notice
EVE Online, the EVE logo, EVE and all associated logos and designs are the intellectual property of CCP hf. All artwork, screenshots, characters, vehicles, storylines, world facts or other recognizable features of the intellectual property relating to these trademarks are likewise the intellectual property of CCP hf. EVE Online and the EVE logo are the registered trademarks of CCP hf. All rights are reserved worldwide. All other trademarks are the property of their respective owners. CCP hf. has granted permission to pyfa to use EVE Online and all associated logos and designs for promotional and information purposes on its website but does not endorse, and is not in any way affiliated with, pyfa. CCP is in no way responsible for the content on or functioning of this program, nor can it be liable for any damage arising from the use of this program.

View File

@@ -49,6 +49,8 @@ def DBInMemory_test():
gamedata_version = gamedata_session.execute(
"SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'client_build'"
).fetchone()[0]
except (KeyboardInterrupt, SystemExit):
raise
except Exception as e:
print("Missing gamedata version.")
gamedata_version = None
@@ -72,7 +74,7 @@ def DBInMemory_test():
# noinspection PyPep8
#from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit
# noinspection PyPep8
#from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user
#from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, miscData, module, override, price, queries, skill, targetProfile, user
# If using in memory saveddata, you'll want to reflect it so the data structure is good.
if saveddata_connectionstring == "sqlite:///:memory:":

View File

@@ -62,4 +62,4 @@ def HeronFit(DB, Gamedata, Saveddata):
for _ in range(4):
fit.modules.append(mod)
return fit
return fit

View File

@@ -33,11 +33,14 @@ pyfaPath = None
savePath = None
saveDB = None
gameDB = None
imgsZIP = None
logPath = None
loggingLevel = None
logging_setup = None
cipher = None
clientHash = None
experimentalFeatures = None
version = None
ESI_CACHE = 'esi_cache'
@@ -96,11 +99,13 @@ def defPaths(customSavePath=None):
global savePath
global saveDB
global gameDB
global imgsZIP
global saveInRoot
global logPath
global cipher
global clientHash
global version
global experimentalFeatures
pyfalog.debug("Configuring Pyfa")
@@ -155,6 +160,10 @@ def defPaths(customSavePath=None):
if not gameDB:
gameDB = os.path.join(pyfaPath, "eve.db")
imgsZIP = getattr(configforced, "imgsZIP", imgsZIP)
if not imgsZIP:
imgsZIP = os.path.join(pyfaPath, "imgs.zip")
if debug:
logFile = "pyfa_debug.log"
else:
@@ -162,6 +171,10 @@ def defPaths(customSavePath=None):
logPath = os.path.join(savePath, logFile)
experimentalFeatures = getattr(configforced, "experimentalFeatures", experimentalFeatures)
if experimentalFeatures is None:
experimentalFeatures = False
# DON'T MODIFY ANYTHING BELOW
import eos.config
@@ -220,6 +233,8 @@ def defLogging():
# reset=False,
)
])
except (KeyboardInterrupt, SystemExit):
raise
except:
print("Critical error attempting to setup logging. Falling back to console only.")
logging_setup = NestedSetup([
@@ -233,7 +248,7 @@ def defLogging():
])
class LoggerWriter(object):
class LoggerWriter:
def __init__(self, level):
# self.level is really like using log.debug(message)
# at least in my case

557
db_update.py Normal file
View File

@@ -0,0 +1,557 @@
#!/usr/bin/env python3
#======================================================================
# Copyright (C) 2012 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with eos. If not, see <http://www.gnu.org/licenses/>.
#======================================================================
import functools
import itertools
import json
import os
import re
import sqlite3
import sys
ROOT_DIR = os.path.realpath(os.path.dirname(__file__))
DB_PATH = os.path.join(ROOT_DIR, 'eve.db')
JSON_DIR = os.path.join(ROOT_DIR, 'staticdata')
if ROOT_DIR not in sys.path:
sys.path.insert(0, ROOT_DIR)
GAMEDATA_SCHEMA_VERSION = 4
def db_needs_update():
"""True if needs, false if it does not, none if we cannot check it."""
try:
with open(os.path.join(JSON_DIR, 'phobos', 'metadata.json')) as f:
data_version = next((r['field_value'] for r in json.load(f) if r['field_name'] == 'client_build'))
except (KeyboardInterrupt, SystemExit):
raise
# If we have no source data - return None; should not update in this case
except:
return None
if not os.path.isfile(DB_PATH):
print('Gamedata DB not found')
return True
db_data_version = None
db_schema_version = None
try:
db = sqlite3.connect(DB_PATH)
cursor = db.cursor()
cursor.execute('SELECT field_value FROM metadata WHERE field_name = \'client_build\'')
for row in cursor:
db_data_version = int(row[0])
cursor.execute('SELECT field_value FROM metadata WHERE field_name = \'schema_version\'')
for row in cursor:
db_schema_version = int(row[0])
cursor.close()
db.close()
except (KeyboardInterrupt, SystemExit):
raise
except:
print('Error when fetching gamedata DB metadata')
return True
if data_version != db_data_version:
print('Gamedata DB data version mismatch: needed {}, DB has {}'.format(data_version, db_data_version))
return True
if GAMEDATA_SCHEMA_VERSION != db_schema_version:
print('Gamedata DB schema version mismatch: needed {}, DB has {}'.format(GAMEDATA_SCHEMA_VERSION, db_schema_version))
return True
return False
def update_db():
print('Building gamedata DB...')
if os.path.isfile(DB_PATH):
os.remove(DB_PATH)
import eos.db
import eos.gamedata
# Create the database tables
eos.db.gamedata_meta.create_all()
def _readData(minerName, jsonName, keyIdName=None):
with open(os.path.join(JSON_DIR, minerName, '{}.json'.format(jsonName)), encoding='utf-8') as f:
rawData = json.load(f)
if not keyIdName:
return rawData
# IDs in keys, rows in values
data = []
for k, v in rawData.items():
row = {}
row.update(v)
if keyIdName not in row:
row[keyIdName] = int(k)
data.append(row)
return data
def _addRows(data, cls, fieldMap=None):
if fieldMap is None:
fieldMap = {}
for row in data:
instance = cls()
for k, v in row.items():
if isinstance(v, str):
v = v.strip()
setattr(instance, fieldMap.get(k, k), v)
eos.db.gamedata_session.add(instance)
def processEveTypes():
print('processing evetypes')
data = _readData('fsd_lite', 'evetypes', keyIdName='typeID')
for row in data:
if (
# Apparently people really want Civilian modules available
(row['typeName'].startswith('Civilian') and "Shuttle" not in row['typeName']) or
row['typeName'] == 'Capsule' or
row['groupID'] == 4033 # destructible effect beacons
):
row['published'] = True
# Nearly useless and clutter search results too much
elif row['typeName'].startswith('Limited Synth '):
row['published'] = False
newData = []
for row in data:
if (
row['published'] or
# group Ship Modifiers, for items like tactical t3 ship modes
row['groupID'] == 1306 or
# Micro Bombs (Fighters)
row['typeID'] in (41549, 41548, 41551, 41550) or
# Abyssal weather (environment)
row['groupID'] in (
1882,
1975,
1971,
1983) # the "container" for the abyssal environments
):
newData.append(row)
_addRows(newData, eos.gamedata.Item)
return newData
def processEveGroups():
print('processing evegroups')
data = _readData('fsd_lite', 'evegroups', keyIdName='groupID')
_addRows(data, eos.gamedata.Group)
return data
def processEveCategories():
print('processing evecategories')
data = _readData('fsd_lite', 'evecategories', keyIdName='categoryID')
_addRows(data, eos.gamedata.Category)
def processDogmaAttributes():
print('processing dogmaattributes')
data = _readData('fsd_binary', 'dogmaattributes', keyIdName='attributeID')
_addRows(data, eos.gamedata.AttributeInfo)
def processDogmaTypeAttributes(eveTypesData):
print('processing dogmatypeattributes')
data = _readData('fsd_binary', 'typedogma', keyIdName='typeID')
eveTypeIds = set(r['typeID'] for r in eveTypesData)
newData = []
seenKeys = set()
def checkKey(key):
if key in seenKeys:
return False
seenKeys.add(key)
return True
for typeData in data:
if typeData['typeID'] not in eveTypeIds:
continue
for row in typeData.get('dogmaAttributes', ()):
row['typeID'] = typeData['typeID']
if checkKey((row['typeID'], row['attributeID'])):
newData.append(row)
for row in eveTypesData:
for attrId, attrName in {4: 'mass', 38: 'capacity', 161: 'volume', 162: 'radius'}.items():
if attrName in row and checkKey((row['typeID'], attrId)):
newData.append({'typeID': row['typeID'], 'attributeID': attrId, 'value': row[attrName]})
_addRows(newData, eos.gamedata.Attribute)
return newData
def processDynamicItemAttributes():
print('processing dynamicitemattributes')
data = _readData('fsd_binary', 'dynamicitemattributes')
for mutaID, mutaData in data.items():
muta = eos.gamedata.DynamicItem()
muta.typeID = mutaID
muta.resultingTypeID = mutaData['inputOutputMapping'][0]['resultingType']
eos.db.gamedata_session.add(muta)
for x in mutaData['inputOutputMapping'][0]['applicableTypes']:
item = eos.gamedata.DynamicItemItem()
item.typeID = mutaID
item.applicableTypeID = x
eos.db.gamedata_session.add(item)
for attrID, attrData in mutaData['attributeIDs'].items():
attr = eos.gamedata.DynamicItemAttribute()
attr.typeID = mutaID
attr.attributeID = attrID
attr.min = attrData['min']
attr.max = attrData['max']
eos.db.gamedata_session.add(attr)
def processDogmaEffects():
print('processing dogmaeffects')
data = _readData('fsd_binary', 'dogmaeffects', keyIdName='effectID')
_addRows(data, eos.gamedata.Effect, fieldMap={'resistanceAttributeID': 'resistanceID'})
def processDogmaTypeEffects(eveTypesData):
print('processing dogmatypeeffects')
data = _readData('fsd_binary', 'typedogma', keyIdName='typeID')
eveTypeIds = set(r['typeID'] for r in eveTypesData)
newData = []
for typeData in data:
if typeData['typeID'] not in eveTypeIds:
continue
for row in typeData.get('dogmaEffects', ()):
row['typeID'] = typeData['typeID']
newData.append(row)
_addRows(newData, eos.gamedata.ItemEffect)
return newData
def processDogmaUnits():
print('processing dogmaunits')
data = _readData('fsd_binary', 'dogmaunits', keyIdName='unitID')
_addRows(data, eos.gamedata.Unit, fieldMap={'name': 'unitName'})
def processMarketGroups():
print('processing marketgroups')
data = _readData('fsd_binary', 'marketgroups', keyIdName='marketGroupID')
_addRows(data, eos.gamedata.MarketGroup, fieldMap={'name': 'marketGroupName'})
def processMetaGroups():
print('processing metagroups')
data = _readData('fsd_binary', 'metagroups', keyIdName='metaGroupID')
_addRows(data, eos.gamedata.MetaGroup)
def processCloneGrades():
print('processing clonegrades')
data = _readData('fsd_lite', 'clonegrades')
newData = []
# December, 2017 - CCP decided to use only one set of skill levels for alpha clones. However, this is still
# represented in the data as a skillset per race. To ensure that all skills are the same, we store them in a way
# that we can check to make sure all races have the same skills, as well as skill levels
check = {}
for ID in data:
for skill in data[ID]['skills']:
newData.append({
'alphaCloneID': int(ID),
'alphaCloneName': 'Alpha Clone',
'typeID': skill['typeID'],
'level': skill['level']})
if ID not in check:
check[ID] = {}
check[ID][int(skill['typeID'])] = int(skill['level'])
if not functools.reduce(lambda a, b: a if a == b else False, [v for _, v in check.items()]):
raise Exception('Alpha Clones not all equal')
newData = [x for x in newData if x['alphaCloneID'] == 1]
if len(newData) == 0:
raise Exception('Alpha Clone processing failed')
tmp = []
for row in newData:
if row['alphaCloneID'] not in tmp:
cloneParent = eos.gamedata.AlphaClone()
setattr(cloneParent, 'alphaCloneID', row['alphaCloneID'])
setattr(cloneParent, 'alphaCloneName', row['alphaCloneName'])
eos.db.gamedata_session.add(cloneParent)
tmp.append(row['alphaCloneID'])
_addRows(newData, eos.gamedata.AlphaCloneSkill)
def processTraits():
print('processing traits')
data = _readData('phobos', 'traits')
def convertSection(sectionData):
sectionLines = []
headerText = '<b>{}</b>'.format(sectionData['header'])
sectionLines.append(headerText)
for bonusData in sectionData['bonuses']:
prefix = '{} '.format(bonusData['number']) if 'number' in bonusData else ''
bonusText = '{}{}'.format(prefix, bonusData['text'].replace('\u00B7', '\u2022 '))
sectionLines.append(bonusText)
sectionLine = '<br />\n'.join(sectionLines)
return sectionLine
newData = []
for row in data:
typeLines = []
typeId = row['typeID']
traitData = row['traits']
for skillData in sorted(traitData.get('skills', ()), key=lambda i: i['header']):
typeLines.append(convertSection(skillData))
if 'role' in traitData:
typeLines.append(convertSection(traitData['role']))
if 'misc' in traitData:
typeLines.append(convertSection(traitData['misc']))
traitLine = '<br />\n<br />\n'.join(typeLines)
newRow = {'typeID': typeId, 'traitText': traitLine}
newData.append(newRow)
_addRows(newData, eos.gamedata.Traits)
def processMetadata():
print('processing metadata')
data = _readData('phobos', 'metadata')
_addRows(data, eos.gamedata.MetaData)
def processReqSkills(eveTypesData):
print('processing requiredskillsfortypes')
def composeReqSkills(raw):
reqSkills = {}
for skillTypeID, skillLevel in raw.items():
reqSkills[int(skillTypeID)] = skillLevel
return reqSkills
eveTypeIds = set(r['typeID'] for r in eveTypesData)
data = _readData('fsd_binary', 'requiredskillsfortypes')
reqsByItem = {}
itemsByReq = {}
for typeID, skillreqData in data.items():
typeID = int(typeID)
if typeID not in eveTypeIds:
continue
for skillTypeID, skillLevel in composeReqSkills(skillreqData).items():
reqsByItem.setdefault(typeID, {})[skillTypeID] = skillLevel
itemsByReq.setdefault(skillTypeID, {})[typeID] = skillLevel
for item in eos.db.gamedata_session.query(eos.gamedata.Item).all():
if item.typeID in reqsByItem:
item.reqskills = json.dumps(reqsByItem[item.typeID])
if item.typeID in itemsByReq:
item.requiredfor = json.dumps(itemsByReq[item.typeID])
def processReplacements(eveTypesData, eveGroupsData, dogmaTypeAttributesData, dogmaTypeEffectsData):
print('finding item replacements')
def compareAttrs(attrs1, attrs2):
# Consider items as different if they have no attrs
if len(attrs1) == 0 and len(attrs2) == 0:
return False
if set(attrs1) != set(attrs2):
return False
if all(attrs1[aid] == attrs2[aid] for aid in attrs1):
return True
return False
skillReqAttribs = {
182: 277,
183: 278,
184: 279,
1285: 1286,
1289: 1287,
1290: 1288}
skillReqAttribsFlat = set(skillReqAttribs.keys()).union(skillReqAttribs.values())
# Get data on type groups
# Format: {type ID: group ID}
typesGroups = {}
for row in eveTypesData:
typesGroups[row['typeID']] = row['groupID']
# Get data on item effects
# Format: {type ID: set(effect, IDs)}
typesEffects = {}
for row in dogmaTypeEffectsData:
typesEffects.setdefault(row['typeID'], set()).add(row['effectID'])
# Get data on type attributes
# Format: {type ID: {attribute ID: attribute value}}
typesNormalAttribs = {}
typesSkillAttribs = {}
for row in dogmaTypeAttributesData:
attributeID = row['attributeID']
if attributeID in skillReqAttribsFlat:
typeSkillAttribs = typesSkillAttribs.setdefault(row['typeID'], {})
typeSkillAttribs[row['attributeID']] = row['value']
# Ignore these attributes for comparison purposes
elif attributeID in (
# We do not need mass as it affects final ship stats only when carried by ship itself
# (and we're not going to replace ships), but it's wildly inconsistent for other items,
# which otherwise would be the same
4, # mass
124, # mainColor
162, # radius
422, # techLevel
633, # metaLevel
1692, # metaGroupID
1768 # typeColorScheme
):
continue
else:
typeNormalAttribs = typesNormalAttribs.setdefault(row['typeID'], {})
typeNormalAttribs[row['attributeID']] = row['value']
# Get data on skill requirements
# Format: {type ID: {skill type ID: skill level}}
typesSkillReqs = {}
for typeID, typeAttribs in typesSkillAttribs.items():
typeSkillAttribs = typesSkillAttribs.get(typeID, {})
if not typeSkillAttribs:
continue
typeSkillReqs = typesSkillReqs.setdefault(typeID, {})
for skillreqTypeAttr, skillreqLevelAttr in skillReqAttribs.items():
try:
skillType = int(typeSkillAttribs[skillreqTypeAttr])
skillLevel = int(typeSkillAttribs[skillreqLevelAttr])
except (KeyError, ValueError):
continue
typeSkillReqs[skillType] = skillLevel
# Format: {group ID: category ID}
groupCategories = {}
for row in eveGroupsData:
groupCategories[row['groupID']] = row['categoryID']
# As EVE affects various types mostly depending on their group or skill requirements,
# we're going to group various types up this way
# Format: {(group ID, frozenset(skillreq, type, IDs), frozenset(type, effect, IDs): [type ID, {attribute ID: attribute value}]}
groupedData = {}
for row in eveTypesData:
typeID = row['typeID']
# Ignore items outside of categories we need
if groupCategories[typesGroups[typeID]] not in (
6, # Ship
7, # Module
8, # Charge
18, # Drone
20, # Implant
22, # Deployable
23, # Starbase
32, # Subsystem
35, # Decryptors
65, # Structure
66, # Structure Module
87, # Fighter
):
continue
typeAttribs = typesNormalAttribs.get(typeID, {})
# Ignore items w/o attributes
if not typeAttribs:
continue
# We need only skill types, not levels for keys
typeSkillreqs = frozenset(typesSkillReqs.get(typeID, {}))
typeGroup = typesGroups[typeID]
typeEffects = frozenset(typesEffects.get(typeID, ()))
groupData = groupedData.setdefault((typeGroup, typeSkillreqs, typeEffects), [])
groupData.append((typeID, typeAttribs))
# Format: {type ID: set(type IDs)}
replacements = {}
# Now, go through composed groups and for every item within it
# find items which are the same
for groupData in groupedData.values():
for type1, type2 in itertools.combinations(groupData, 2):
if compareAttrs(type1[1], type2[1]):
replacements.setdefault(type1[0], set()).add(type2[0])
replacements.setdefault(type2[0], set()).add(type1[0])
# Update DB session with data we generated
for item in eos.db.gamedata_session.query(eos.gamedata.Item).all():
itemReplacements = replacements.get(item.typeID)
if itemReplacements is not None:
item.replacements = ','.join('{}'.format(tid) for tid in sorted(itemReplacements))
def processImplantSets(eveTypesData):
print('composing implant sets')
# Includes only implants which can be considered part of sets, not all implants
implant_groups = (300, 1730)
specials = {'Genolution': ('Genolution Core Augmentation', r'CA-\d+')}
implantSets = {}
for row in eveTypesData:
if not row.get('published'):
continue
if row.get('groupID') not in implant_groups:
continue
typeName = row.get('typeName', '')
# Regular sets matching
m = re.match('(?P<grade>(High|Mid|Low)-grade) (?P<set>\w+) (?P<implant>(Alpha|Beta|Gamma|Delta|Epsilon|Omega))', typeName, re.IGNORECASE)
if m:
implantSets.setdefault((m.group('grade'), m.group('set')), set()).add(row['typeID'])
# Special set matching
for setHandle, (setName, implantPattern) in specials.items():
pattern = '(?P<set>{}) (?P<implant>{})'.format(setName, implantPattern)
m = re.match(pattern, typeName)
if m:
implantSets.setdefault((None, setHandle), set()).add(row['typeID'])
break
data = []
for (gradeName, setName), implants in implantSets.items():
if len(implants) < 2:
continue
implants = ','.join('{}'.format(tid) for tid in sorted(implants))
row = {'setName': setName, 'gradeName': gradeName, 'implants': implants}
data.append(row)
_addRows(data, eos.gamedata.ImplantSet)
eveTypesData = processEveTypes()
eveGroupsData = processEveGroups()
processEveCategories()
processDogmaAttributes()
dogmaTypeAttributesData = processDogmaTypeAttributes(eveTypesData)
processDynamicItemAttributes()
processDogmaEffects()
dogmaTypeEffectsData = processDogmaTypeEffects(eveTypesData)
processDogmaUnits()
processMarketGroups()
processMetaGroups()
processCloneGrades()
processTraits()
processMetadata()
eos.db.gamedata_session.flush()
processReqSkills(eveTypesData)
processReplacements(eveTypesData, eveGroupsData, dogmaTypeAttributesData, dogmaTypeEffectsData)
processImplantSets(eveTypesData)
# Add schema version to prevent further updates
metadata_schema_version = eos.gamedata.MetaData()
metadata_schema_version.field_name = 'schema_version'
metadata_schema_version.field_value = GAMEDATA_SCHEMA_VERSION
eos.db.gamedata_session.add(metadata_schema_version)
eos.db.gamedata_session.flush()
# CCP still has 5 subsystems assigned to T3Cs, even though only 4 are available / usable. They probably have some
# old legacy requirement or assumption that makes it difficult for them to change this value in the data. But for
# pyfa, we can do it here as a post-processing step
for attr in eos.db.gamedata_session.query(eos.gamedata.Attribute).filter(eos.gamedata.Attribute.ID == 1367).all():
attr.value = 4.0
for item in eos.db.gamedata_session.query(eos.gamedata.Item).filter(eos.gamedata.Item.name.like('%abyssal%')).all():
item.published = False
for x in [
30 # Apparel
]:
cat = eos.db.gamedata_session.query(eos.gamedata.Category).filter(eos.gamedata.Category.ID == x).first()
print ('Removing Category: {}'.format(cat.name))
eos.db.gamedata_session.delete(cat)
eos.db.gamedata_session.commit()
eos.db.gamedata_engine.execute('VACUUM')
print('done')
if __name__ == '__main__':
update_db()

View File

@@ -30,7 +30,8 @@ added_files = [
import_these = [
'numpy.core._dtype_ctypes', # https://github.com/pyinstaller/pyinstaller/issues/3982
'sqlalchemy.ext.baked' # windows build doesn't launch without if when using sqlalchemy 1.3.x
'sqlalchemy.ext.baked', # windows build doesn't launch without if when using sqlalchemy 1.3.x
'pkg_resources.py2_warn' # issue 2156
]
icon = os.path.join(os.getcwd(), "dist_assets", "mac", "pyfa.icns")

View File

@@ -1,78 +0,0 @@
# This apes hook-matplotlib.backends.py, but REMOVES backends, all but
# the ones in the list below.
# Courtesy of https://github.com/bpteague/cytoflow/blob/70f9291/packaging/hook-matplotlib.backends.py
KEEP = ["WXAgg", "WX", "agg"]
from PyInstaller.compat import is_darwin
from PyInstaller.utils.hooks import (
eval_statement, exec_statement, logger)
def get_matplotlib_backend_module_names():
"""
List the names of all matplotlib backend modules importable under the
current Python installation.
Returns
----------
list
List of the fully-qualified names of all such modules.
"""
# Statement safely importing a single backend module.
import_statement = """
import os, sys
# Preserve stdout.
sys_stdout = sys.stdout
try:
# Redirect output printed by this importation to "/dev/null", preventing
# such output from being erroneously interpreted as an error.
with open(os.devnull, 'w') as dev_null:
sys.stdout = dev_null
__import__('%s')
# If this is an ImportError, print this exception's message without a traceback.
# ImportError messages are human-readable and require no additional context.
except ImportError as exc:
sys.stdout = sys_stdout
print(exc)
# Else, print this exception preceded by a traceback. traceback.print_exc()
# prints to stderr rather than stdout and must not be called here!
except Exception:
sys.stdout = sys_stdout
import traceback
print(traceback.format_exc())
"""
# List of the human-readable names of all available backends.
backend_names = eval_statement(
'import matplotlib; print(matplotlib.rcsetup.all_backends)')
# List of the fully-qualified names of all importable backend modules.
module_names = []
# If the current system is not OS X and the "CocoaAgg" backend is available,
# remove this backend from consideration. Attempting to import this backend
# on non-OS X systems halts the current subprocess without printing output
# or raising exceptions, preventing its reliable detection.
if not is_darwin and 'CocoaAgg' in backend_names:
backend_names.remove('CocoaAgg')
# For safety, attempt to import each backend in a unique subprocess.
for backend_name in backend_names:
if backend_name in KEEP:
continue
module_name = 'matplotlib.backends.backend_%s' % backend_name.lower()
stdout = exec_statement(import_statement % module_name)
# If no output was printed, this backend is importable.
if not stdout:
module_names.append(module_name)
logger.info(' Matplotlib backend "%s": removed' % backend_name)
return module_names
# Freeze all importable backends, as PyInstaller is unable to determine exactly
# which backends are required by the current program.
e=get_matplotlib_backend_module_names()
print(e)
excludedimports = e

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"/>
<file name="MSVCR90.DLL"/>
<file name="MSVCM90.DLL"/>
<file name="MSVCP90.DLL"/>
</assembly>

View File

@@ -14,7 +14,7 @@ with open("version.yml", 'r') as file:
os.environ["PYFA_DIST_DIR"] = os.path.join(os.getcwd(), 'dist')
os.environ["PYFA_VERSION"] = version
iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" # inno script location via wine
iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
source = os.path.join(os.environ["PYFA_DIST_DIR"], "pyfa")

View File

@@ -15,10 +15,6 @@
#define MyAppURL "https://github.com/pyfa-org/Pyfa/"
#define MyAppExeName "pyfa.exe"
; What version starts with the new structure (1.x.0). This is used to determine if we run directory structure cleanup
#define MajorVersionFlag 2
#define MinorVersionFlag 0
#ifndef MyOutputFile
#define MyOutputFile LowerCase(StringChange(MyAppName+'-'+MyAppVersion+'-win', " ", "-"))
#endif
@@ -30,7 +26,6 @@
#endif
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
@@ -41,6 +36,9 @@ AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
CloseApplications=yes
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
@@ -49,7 +47,6 @@ OutputDir={#MyOutputDir}
OutputBaseFilename={#MyOutputFile}
SetupIconFile={#MyAppDir}\pyfa.ico
SolidCompression=yes
CloseApplications=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
@@ -83,6 +80,7 @@ Type: files; Name: "{app}\*.pyc"
[Code]
/////////////////////////////////////////////////////////////////////
function IsAppRunning(const FileName : string): Boolean;
var
FSWbemLocator: Variant;
@@ -99,6 +97,7 @@ begin
FSWbemLocator := Unassigned;
end;
/////////////////////////////////////////////////////////////////////
procedure RemoveFromVirtualStore;
var
VirtualStore,FileName,FilePath:String;
@@ -115,6 +114,7 @@ begin
end;
end;
/////////////////////////////////////////////////////////////////////
function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
if(IsAppRunning( 'pyfa.exe' )) then
@@ -127,54 +127,61 @@ begin
end
end;
function GetUninstallString: string;
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: string;
sUnInstPath: String;
sUnInstallString: String;
begin
Result := '';
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{{3DA39096-C08D-49CD-90E0-1D177F32C8AA}_is1'); //Your App GUID/ID
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
if not RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString) then
if not RegQueryStringValue(HKLM32, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU32, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
function IsUpgrade: Boolean;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
function InitializeSetup: Boolean;
var
V: Integer;
iResultCode: Integer;
sUnInstallString: string;
iOldVersionMajor: Cardinal;
iOldVersionMinor: Cardinal;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
Result := True; // in case when no previous version is found
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\{3DA39096-C08D-49CD-90E0-1D177F32C8AA}_is1', 'UninstallString') then //Your App GUID/ID
if (CurStep=ssInstall) then
begin
RegQueryDWordValue(HKEY_LOCAL_MACHINE,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\{3DA39096-C08D-49CD-90E0-1D177F32C8AA}_is1',
'MajorVersion', iOldVersionMajor);
RegQueryDWordValue(HKEY_LOCAL_MACHINE,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\{3DA39096-C08D-49CD-90E0-1D177F32C8AA}_is1',
'MinorVersion', iOldVersionMinor);
if (iOldVersionMajor < {#MajorVersionFlag}) or ((iOldVersionMajor = {#MajorVersionFlag}) and (iOldVersionMinor < {#MinorVersionFlag})) then // If old version with old structure is installed.
if (IsUpgrade()) then
begin
V := MsgBox(ExpandConstant('An old version of pyfa was detected. Due to recent changes in the application structure, you must uninstall the previous version first. This will not affect your user data (saved fittings, characters, etc.). Do you want to uninstall now?'), mbInformation, MB_YESNO); //Custom Message if App installed
if V = IDYES then
begin
sUnInstallString := GetUninstallString();
sUnInstallString := RemoveQuotes(sUnInstallString);
Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);
Result := True; //if you want to proceed after uninstall
//Exit; //if you want to quit after uninstall
end
else
Result := False; //when older version present and not uninstalled
UnInstallOldVersion();
end;
end;
end;

View File

@@ -8,11 +8,6 @@
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>

View File

@@ -20,7 +20,6 @@ added_files = [
('../../service/jargon/*.yaml', 'service/jargon'),
('../../dist_assets/win/pyfa.ico', '.'),
('../../dist_assets/win/pyfa.exe.manifest', '.'),
('../../dist_assets/win/Microsoft.VC90.CRT.manifest', '.'),
(requests.certs.where(), '.'), # is this needed anymore?
('../../eve.db', '.'),
('../../README.md', '.'),
@@ -30,7 +29,8 @@ added_files = [
import_these = [
'numpy.core._dtype_ctypes', # https://github.com/pyinstaller/pyinstaller/issues/3982
'sqlalchemy.ext.baked' # windows build doesn't launch without if when using sqlalchemy 1.3.x
'sqlalchemy.ext.baked', # windows build doesn't launch without if when using sqlalchemy 1.3.x
'pkg_resources.py2_warn' # issue 2156
]
# Walk directories that do dynamic importing

View File

@@ -1,83 +0,0 @@
# -*- mode: python -*-
# Note: This script is provided AS-IS for those that may be interested.
# pyfa does not currently support pyInstaller (or any other build process) 100% at the moment
# Command line to build:
# (Run from directory where pyfa.py and pyfa.spec lives.)
# c:\Python27\scripts\pyinstaller.exe --clean --noconfirm --windowed --upx-dir=.\scripts\upx.exe pyfa.spec
# Don't forget to change the path to where your pyfa.py and pyfa.spec lives
# pathex=['C:\\Users\\Ebag333\\Documents\\GitHub\\Ebag333\\Pyfa'],
import os
block_cipher = None
added_files = [
( 'imgs/gui/*.png', 'imgs/gui' ),
( 'imgs/gui/*.gif', 'imgs/gui' ),
( 'imgs/icons/*.png', 'imgs/icons' ),
( 'imgs/renders/*.png', 'imgs/renders' ),
( 'dist_assets/win/pyfa.ico', '.' ),
( 'dist_assets/cacert.pem', '.' ),
( 'eve.db', '.' ),
( 'README.md', '.' ),
( 'LICENSE', '.' ),
]
import_these = []
# Walk eos.effects and add all effects so we can import them properly
for root, folders, files in os.walk("eos/effects"):
for file_ in files:
if file_.endswith(".py") and not file_.startswith("_"):
mod_name = "{}.{}".format(
root.replace("/", "."),
file_.split(".py")[0],
)
import_these.append(mod_name)
a = Analysis(
['pyfa.py'],
pathex=['C:\\projects\\pyfa\\'],
binaries=[],
datas=added_files,
hiddenimports=import_these,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher,
)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
debug=True,
console=True,
strip=False,
upx=True,
name='pyfa_debug',
icon='dist_assets/win/pyfa.ico',
onefile=False,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
onefile=False,
name='pyfa_debug',
icon='dist_assets/win/pyfa.ico',
)

71
eos/calc.py Normal file
View File

@@ -0,0 +1,71 @@
# =============================================================================
# Copyright (C) 2019 Ryan Holmes
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
# Just copy-paste penalization chain calculation code (with some modifications,
# as multipliers arrive in different form) in here to not make actual attribute
# calculations slower than they already are due to extra function calls
def calculateMultiplier(multipliers):
"""
multipliers: dictionary in format:
{stacking group name: [(mult, resist attr ID), (mult, resist attr ID)]}
"""
val = 1
for penalizedMultipliers in multipliers.values():
# A quick explanation of how this works:
# 1: Bonuses and penalties are calculated seperately, so we'll have to filter each of them
l1 = [v[0] for v in penalizedMultipliers if v[0] > 1]
l2 = [v[0] for v in penalizedMultipliers if v[0] < 1]
# 2: The most significant bonuses take the smallest penalty,
# This means we'll have to sort
abssort = lambda _val: -abs(_val - 1)
l1.sort(key=abssort)
l2.sort(key=abssort)
# 3: The first module doesn't get penalized at all
# Any module after the first takes penalties according to:
# 1 + (multiplier - 1) * math.exp(- math.pow(i, 2) / 7.1289)
for l in (l1, l2):
for i in range(len(l)):
bonus = l[i]
val *= 1 + (bonus - 1) * math.exp(- i ** 2 / 7.1289)
return val
def calculateRangeFactor(srcOptimalRange, srcFalloffRange, distance, restrictedRange=True):
"""Range strength/chance factor, applicable to guns, ewar, RRs, etc."""
if distance is None:
return 1
if srcFalloffRange > 0:
# Most modules cannot be activated when at 3x falloff range, with few exceptions like guns
if restrictedRange and distance > srcOptimalRange + 3 * srcFalloffRange:
return 0
return 0.5 ** ((max(0, distance - srcOptimalRange) / srcFalloffRange) ** 2)
elif distance <= srcOptimalRange:
return 1
else:
return 0
def calculateLockTime(srcScanRes, tgtSigRadius):
if not srcScanRes or not tgtSigRadius:
return None
return min(40000 / srcScanRes / math.asinh(tgtSigRadius) ** 2, 30 * 60)

View File

@@ -1,7 +1,7 @@
import heapq
import time
from math import sqrt, exp
from functools import reduce
from collections import Counter
DAY = 24 * 60 * 60 * 1000
@@ -13,7 +13,7 @@ def lcm(a, b):
return n / a
class CapSimulator(object):
class CapSimulator:
"""Entity's EVE Capacitor Simulator"""
def __init__(self):
@@ -21,6 +21,7 @@ class CapSimulator(object):
self.capacitorCapacity = 100
self.capacitorRecharge = 1000
self.startingCapacity = 1000
# max simulated time.
self.t_max = DAY
@@ -41,6 +42,14 @@ class CapSimulator(object):
# relevant decimal digits of capacitor for LCM period optimization
self.stability_precision = 1
# Stores how cap sim changed cap values outside of cap regen time
self.saved_changes = ()
self.saved_changes_internal = None
# Reports if sim was stopped due to detecting stability early
self.optimize_repeats = True
self.result_optimized_repeats = None
def scale_activation(self, duration, capNeed):
for res in self.scale_resolutions:
mod = duration % res
@@ -59,7 +68,7 @@ class CapSimulator(object):
return duration, capNeed
def init(self, modules):
"""prepare modules. a list of (duration, capNeed, clipSize, disableStagger) tuples is
"""prepare modules. a list of (duration, capNeed, clipSize, disableStagger, reloadTime, isInjector) tuples is
expected, with clipSize 0 if the module has infinite ammo.
"""
self.modules = modules
@@ -67,48 +76,57 @@ class CapSimulator(object):
def reset(self):
"""Reset the simulator state"""
self.state = []
self.saved_changes_internal = {}
self.result_optimized_repeats = False
mods = {}
period = 1
disable_period = False
# Loop over modules, clearing clipSize if applicable, and group modules based on attributes
for (duration, capNeed, clipSize, disableStagger, reloadTime) in self.modules:
for (duration, capNeed, clipSize, disableStagger, reloadTime, isInjector) in self.modules:
if self.scale:
duration, capNeed = self.scale_activation(duration, capNeed)
# set clipSize to infinite if reloads are disabled unless it's
# a cap booster module.
if not self.reload and capNeed > 0:
# a cap booster module
if not self.reload and not isInjector:
clipSize = 0
reloadTime = 0
# Group modules based on their properties
if (duration, capNeed, clipSize, disableStagger, reloadTime) in mods:
mods[(duration, capNeed, clipSize, disableStagger, reloadTime)] += 1
key = (duration, capNeed, clipSize, disableStagger, reloadTime, isInjector)
if key in mods:
mods[key] += 1
else:
mods[(duration, capNeed, clipSize, disableStagger, reloadTime)] = 1
mods[key] = 1
# Loop over grouped modules, configure staggering and push to the simulation state
for (duration, capNeed, clipSize, disableStagger, reloadTime), amount in mods.items():
for (duration, capNeed, clipSize, disableStagger, reloadTime, isInjector), amount in mods.items():
# period optimization doesn't work when reloads are active.
if clipSize:
disable_period = True
# Just push multiple instances if item is injector. We do not want to stagger them as we will
# use them as needed and want them to be available right away
if isInjector:
for i in range(amount):
heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize, reloadTime, isInjector])
continue
if self.stagger and not disableStagger:
# Stagger all mods if they do not need to be reloaded
if clipSize == 0:
duration = int(duration / amount)
# Stagger mods after first
else:
stagger_amount = (duration * clipSize + reloadTime) / (amount * clipSize)
for i in range(1, amount):
heapq.heappush(self.state,
[i * stagger_amount, duration,
capNeed, 0, clipSize, reloadTime])
heapq.heappush(self.state, [i * stagger_amount, duration, capNeed, 0, clipSize, reloadTime, isInjector])
# If mods are not staggered - just multiply cap use
else:
capNeed *= amount
period = lcm(period, duration)
# period optimization doesn't work when reloads are active.
if clipSize:
disable_period = True
heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize, reloadTime])
heapq.heappush(self.state, [0, duration, capNeed, 0, clipSize, reloadTime, isInjector])
if disable_period:
self.period = self.t_max
@@ -119,7 +137,8 @@ class CapSimulator(object):
"""Run the simulation"""
start = time.time()
awaitingInjectors = []
awaitingInjectorsCounterWrap = Counter()
self.reset()
push = heapq.heappush
@@ -129,27 +148,36 @@ class CapSimulator(object):
stability_precision = self.stability_precision
period = self.period
activation = None
iterations = 0
capCapacity = self.capacitorCapacity
tau = self.capacitorRecharge / 5.0
cap_wrap = capCapacity # cap value at last period
cap_lowest = capCapacity # lowest cap value encountered
cap_lowest_pre = capCapacity # lowest cap value before activations
cap = capCapacity # current cap value
cap_wrap = self.startingCapacity # cap value at last period
cap_lowest = self.startingCapacity # lowest cap value encountered
cap_lowest_pre = self.startingCapacity # lowest cap value before activations
cap = self.startingCapacity # current cap value
t_wrap = self.period # point in time of next period
t_last = 0
t_max = self.t_max
while 1:
activation = pop(state)
t_now, duration, capNeed, shot, clipSize, reloadTime = activation
# Nothing to pop - might happen when no mods are activated, or when
# only cap injectors are active (and are postponed by code below)
try:
activation = pop(state)
except IndexError:
break
t_now, duration, capNeed, shot, clipSize, reloadTime, isInjector = activation
# Max time reached, stop simulation - we're stable
if t_now >= t_max:
break
cap = ((1.0 + (sqrt(cap / capCapacity) - 1.0) * exp((t_last - t_now) / tau)) ** 2) * capCapacity
# Regenerate cap from last time point
if t_now > t_last:
cap = ((1.0 + (sqrt(cap / capCapacity) - 1.0) * exp((t_last - t_now) / tau)) ** 2) * capCapacity
if t_now != t_last:
if cap < cap_lowest_pre:
@@ -157,36 +185,104 @@ class CapSimulator(object):
if t_now == t_wrap:
# history is repeating itself, so if we have more cap now than last
# time this happened, it is a stable setup.
if cap >= cap_wrap:
awaitingInjectorsCounterNow = Counter(awaitingInjectors)
if self.optimize_repeats and cap >= cap_wrap and awaitingInjectorsCounterNow == awaitingInjectorsCounterWrap:
self.result_optimized_repeats = True
break
cap_wrap = round(cap, stability_precision)
awaitingInjectorsCounterWrap = awaitingInjectorsCounterNow
t_wrap += period
cap -= capNeed
if cap > capCapacity:
cap = capCapacity
t_last = t_now
iterations += 1
t_last = t_now
# If injecting cap will "overshoot" max cap, postpone it
if isInjector and cap - capNeed > capCapacity:
awaitingInjectors.append((duration, capNeed, shot, clipSize, reloadTime, isInjector))
if cap < cap_lowest:
if cap < 0.0:
break
cap_lowest = cap
else:
# If we will need more cap than we have, but we are not at 100% -
# use awaiting cap injectors to top us up until we have enough or
# until we're full
if capNeed > cap and cap < capCapacity:
while awaitingInjectors and capNeed > cap and capCapacity > cap:
neededInjection = min(capNeed - cap, capCapacity - cap)
# Find injectors which have just enough cap or more
goodInjectors = [i for i in awaitingInjectors if -i[1] >= neededInjection]
if goodInjectors:
# Pick injector which overshoots the least
bestInjector = min(goodInjectors, key=lambda i: -i[1])
else:
# Take the one which provides the most cap
bestInjector = max(goodInjectors, key=lambda i: -i[1])
# Use injector
awaitingInjectors.remove(bestInjector)
inj_duration, inj_capNeed, inj_shot, inj_clipSize, inj_reloadTime, inj_isInjector = bestInjector
cap -= inj_capNeed
if cap > capCapacity:
cap = capCapacity
self.saved_changes_internal[t_now] = cap
# Add injector to regular state tracker
inj_t_now = t_now
inj_t_now += inj_duration
inj_shot += 1
if inj_clipSize:
if inj_shot % inj_clipSize == 0:
inj_shot = 0
inj_t_now += inj_reloadTime
push(state, [inj_t_now, inj_duration, inj_capNeed, inj_shot, inj_clipSize, inj_reloadTime, inj_isInjector])
# queue the next activation of this module
t_now += duration
shot += 1
if clipSize:
if shot % clipSize == 0:
shot = 0
t_now += reloadTime # include reload time
activation[0] = t_now
activation[3] = shot
# Apply cap modification
cap -= capNeed
if cap > capCapacity:
cap = capCapacity
self.saved_changes_internal[t_now] = cap
if cap < cap_lowest:
# Negative cap - we're unstable, simulation is over
if cap < 0.0:
break
cap_lowest = cap
# Try using awaiting injectors to top up the cap after spending some
while awaitingInjectors and cap < capCapacity:
neededInjection = capCapacity - cap
# Find injectors which do not overshoot max cap
goodInjectors = [i for i in awaitingInjectors if -i[1] <= neededInjection]
if not goodInjectors:
break
# Take the one which provides the most cap
bestInjector = max(goodInjectors, key=lambda i: -i[1])
# Use injector
awaitingInjectors.remove(bestInjector)
inj_duration, inj_capNeed, inj_shot, inj_clipSize, inj_reloadTime, inj_isInjector = bestInjector
cap -= inj_capNeed
if cap > capCapacity:
cap = capCapacity
self.saved_changes_internal[t_now] = cap
# Add injector to regular state tracker
inj_t_now = t_now
inj_t_now += inj_duration
inj_shot += 1
if inj_clipSize:
if inj_shot % inj_clipSize == 0:
inj_shot = 0
inj_t_now += inj_reloadTime
push(state, [inj_t_now, inj_duration, inj_capNeed, inj_shot, inj_clipSize, inj_reloadTime, inj_isInjector])
# queue the next activation of this module
t_now += duration
shot += 1
if clipSize:
if shot % clipSize == 0:
shot = 0
t_now += reloadTime # include reload time
activation[0] = t_now
activation[3] = shot
push(state, activation)
if activation is not None:
push(state, activation)
push(state, activation)
# update instance with relevant results.
self.t = t_last
@@ -194,7 +290,7 @@ class CapSimulator(object):
# calculate EVE's stability value
try:
avgDrain = reduce(float.__add__, [x[2] / x[1] for x in self.state], 0.0)
avgDrain = sum(x[2] / x[1] for x in self.state)
self.cap_stable_eve = 0.25 * (1.0 + sqrt(-(2.0 * avgDrain * tau - capCapacity) / capCapacity)) ** 2
except ValueError:
self.cap_stable_eve = 0.0
@@ -204,7 +300,9 @@ class CapSimulator(object):
self.cap_stable_low = cap_lowest
self.cap_stable_high = cap_lowest_pre
else:
self.cap_stable_low = \
self.cap_stable_high = 0.0
self.cap_stable_low = self.cap_stable_high = 0.0
self.saved_changes = tuple((k / 1000, max(0, self.saved_changes_internal[k])) for k in sorted(self.saved_changes_internal))
self.saved_changes_internal = None
self.runtime = time.time() - start

View File

@@ -90,9 +90,12 @@ class FittingHardpoint(IntEnum):
@unique
class SpoolType(IntEnum):
SCALE = 0 # [0..1]
TIME = 1 # Expressed via time in seconds since spool up started
CYCLES = 2 # Expressed in amount of cycles since spool up started
# Spool and cycle scale are different in case if max spool amount cannot
# be divided by spool step without remainder
SPOOL_SCALE = 0 # [0..1]
CYCLE_SCALE = 1 # [0..1]
TIME = 2 # Expressed via time in seconds since spool up started
CYCLES = 3 # Expressed in amount of cycles since spool up started
@unique
@@ -101,3 +104,12 @@ class FitSystemSecurity(IntEnum):
LOWSEC = 1
NULLSEC = 2
WSPACE = 3
@unique
class Operator(IntEnum):
PREASSIGN = 0
PREINCREASE = 1
MULTIPLY = 2
POSTINCREASE = 3
FORCE = 4

View File

@@ -17,34 +17,66 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import re
import threading
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import MetaData, create_engine, event
from sqlalchemy.orm import sessionmaker, scoped_session
from . import migration
from eos import config
from logbook import Logger
pyfalog = Logger(__name__)
pyfalog.info("Initializing database")
pyfalog.info("Gamedata connection: {0}", config.gamedata_connectionstring)
pyfalog.info("Saveddata connection: {0}", config.saveddata_connectionstring)
class ReadOnlyException(Exception):
pass
def re_fn(expr, item):
try:
reg = re.compile(expr, re.IGNORECASE)
except (SystemExit, KeyboardInterrupt):
raise
except:
return False
return reg.search(item) is not None
pyfalog.debug('Initializing gamedata')
gamedata_connectionstring = config.gamedata_connectionstring
if callable(gamedata_connectionstring):
gamedata_engine = create_engine("sqlite://", creator=gamedata_connectionstring, echo=config.debug)
else:
gamedata_engine = create_engine(gamedata_connectionstring, echo=config.debug)
@event.listens_for(gamedata_engine, 'connect')
def create_functions(dbapi_connection, connection_record):
dbapi_connection.create_function('regexp', 2, re_fn)
gamedata_meta = MetaData()
gamedata_meta.bind = gamedata_engine
gamedata_session = sessionmaker(bind=gamedata_engine, autoflush=False, expire_on_commit=False)()
GamedataSession = scoped_session(sessionmaker(bind=gamedata_engine, autoflush=False, expire_on_commit=False))
gamedata_session = GamedataSession()
gamedata_sessions = {threading.get_ident(): gamedata_session}
def get_gamedata_session():
thread_id = threading.get_ident()
if thread_id not in gamedata_sessions:
gamedata_sessions[thread_id] = GamedataSession()
return gamedata_sessions[thread_id]
pyfalog.debug('Getting gamedata version')
# This should be moved elsewhere, maybe as an actual query. Current, without try-except, it breaks when making a new
# game db because we haven't reached gamedata_meta.create_all()
try:
@@ -54,12 +86,15 @@ try:
config.gamedata_date = gamedata_session.execute(
"SELECT `field_value` FROM `metadata` WHERE `field_name` LIKE 'dump_time'"
).fetchone()[0]
except (KeyboardInterrupt, SystemExit):
raise
except Exception as e:
pyfalog.warning("Missing gamedata version.")
pyfalog.critical(e)
config.gamedata_version = None
config.gamedata_date = None
pyfalog.debug('Initializing saveddata')
saveddata_connectionstring = config.saveddata_connectionstring
if saveddata_connectionstring is not None:
if callable(saveddata_connectionstring):
@@ -76,16 +111,19 @@ else:
# Lock controlling any changes introduced to session
sd_lock = threading.RLock()
pyfalog.debug('Importing gamedata DB scheme')
# Import all the definitions for all our database stuff
# noinspection PyPep8
from eos.db.gamedata import alphaClones, attribute, category, effect, group, item, marketGroup, metaData, metaGroup, queries, traits, unit, dynamicAttributes
from eos.db.gamedata import alphaClones, attribute, category, effect, group, item, marketGroup, metaData, metaGroup, queries, traits, unit, dynamicAttributes, implantSet
pyfalog.debug('Importing saveddata DB scheme')
# noinspection PyPep8
from eos.db.saveddata import booster, cargo, character, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, \
miscData, mutator, module, override, price, queries, skill, targetResists, user
from eos.db.saveddata import booster, cargo, character, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, \
miscData, mutator, module, override, price, queries, skill, targetProfile, user
# Import queries
pyfalog.debug('Importing gamedata queries')
# noinspection PyPep8
from eos.db.gamedata.queries import *
pyfalog.debug('Importing saveddata queries')
# noinspection PyPep8
from eos.db.saveddata.queries import *

View File

@@ -1,2 +1,2 @@
__all__ = ["attribute", "category", "effect", "group", "metaData", "dynamicAttributes",
"item", "marketGroup", "metaGroup", "unit", "alphaClones"]
"item", "marketGroup", "metaGroup", "unit", "alphaClones", "implantSet"]

View File

@@ -17,26 +17,17 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from logbook import Logger
from sqlalchemy import Column, String, Integer, Table
from sqlalchemy.orm import mapper, synonym
from eos.graph import Graph
from eos.utils.spoolSupport import SpoolType, SpoolOptions
from eos.db import gamedata_meta
from eos.gamedata import ImplantSet
implant_set_table = Table("implantsets", gamedata_meta,
Column("setID", Integer, primary_key=True),
Column("setName", String),
Column("gradeName", String),
Column("implants", String))
pyfalog = Logger(__name__)
class FitDpsTimeGraph(Graph):
defaults = {"time": 0}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults)
self.fit = fit
def calcDps(self, data):
fit = self.fit
time = data["time"]
dps = fit.getTotalDps(spoolOptions=SpoolOptions(SpoolType.TIME, time, True)).total
return dps
mapper(ImplantSet, implant_set_table,
properties={"ID": synonym("setID")})

View File

@@ -25,7 +25,7 @@ from sqlalchemy.orm.collections import attribute_mapped_collection
from eos.db import gamedata_meta
from eos.db.gamedata.dynamicAttributes import dynamicApplicable_table
from eos.db.gamedata.effect import typeeffects_table
from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, MetaType, Traits
from eos.gamedata import Attribute, DynamicItem, Effect, Group, Item, Traits, MetaGroup
items_table = Table("invtypes", gamedata_meta,
Column("typeID", Integer, primary_key=True),
@@ -33,17 +33,18 @@ items_table = Table("invtypes", gamedata_meta,
Column("description", String),
Column("raceID", Integer),
Column("factionID", Integer),
Column("volume", Float),
Column("mass", Float),
Column("capacity", Float),
Column("published", Boolean),
Column("marketGroupID", Integer, ForeignKey("invmarketgroups.marketGroupID")),
Column("iconID", Integer),
Column("graphicID", Integer),
Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True),
Column("replacements", String))
Column("metaLevel", Integer),
Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID"), index=True),
Column("variationParentTypeID", Integer, ForeignKey("invtypes.typeID"), index=True),
Column("replacements", String),
Column("reqskills", String),
Column("requiredfor", String))
from .metaGroup import metatypes_table # noqa
from .traits import traits_table # noqa
mapper(Item, items_table,
@@ -51,9 +52,8 @@ mapper(Item, items_table,
"group" : relation(Group, backref=backref("items", cascade="all,delete")),
"_Item__attributes": relation(Attribute, cascade='all, delete, delete-orphan', collection_class=attribute_mapped_collection('name')),
"effects": relation(Effect, secondary=typeeffects_table, collection_class=attribute_mapped_collection('name')),
"metaGroup" : relation(MetaType,
primaryjoin=metatypes_table.c.typeID == items_table.c.typeID,
uselist=False),
"metaGroup" : relation(MetaGroup, backref=backref("items", cascade="all,delete")),
"varParent" : relation(Item, backref=backref("varChildren", cascade="all,delete"), remote_side=items_table.c.typeID),
"ID" : synonym("typeID"),
"name" : synonym("typeName"),
"description" : deferred(items_table.c.description),
@@ -64,7 +64,6 @@ mapper(Item, items_table,
primaryjoin=dynamicApplicable_table.c.applicableTypeID == items_table.c.typeID,
secondaryjoin=dynamicApplicable_table.c.typeID == DynamicItem.typeID,
secondary=dynamicApplicable_table,
backref="applicableItems")
})
backref="applicableItems")})
Item.category = association_proxy("group", "category")

View File

@@ -17,35 +17,17 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relation, mapper, synonym
from sqlalchemy import Table, Column, Integer, String
from sqlalchemy.orm import mapper, synonym
from eos.db import gamedata_meta
from eos.db.gamedata.item import items_table
from eos.gamedata import Item, MetaGroup, MetaType
from eos.gamedata import MetaGroup
metagroups_table = Table("invmetagroups", gamedata_meta,
Column("metaGroupID", Integer, primary_key=True),
Column("metaGroupName", String))
metatypes_table = Table("invmetatypes", gamedata_meta,
Column("typeID", Integer, ForeignKey("invtypes.typeID"), primary_key=True),
Column("parentTypeID", Integer, ForeignKey("invtypes.typeID")),
Column("metaGroupID", Integer, ForeignKey("invmetagroups.metaGroupID")))
mapper(MetaGroup, metagroups_table,
properties={
"ID" : synonym("metaGroupID"),
"name": synonym("metaGroupName")
})
mapper(MetaType, metatypes_table,
properties={
"ID" : synonym("metaGroupID"),
"parent": relation(Item, primaryjoin=metatypes_table.c.parentTypeID == items_table.c.typeID),
"items" : relation(Item, primaryjoin=metatypes_table.c.typeID == items_table.c.typeID),
"info" : relation(MetaGroup, lazy=False)
})
MetaType.name = association_proxy("info", "name")
"name": synonym("metaGroupName")})

View File

@@ -22,11 +22,11 @@ from sqlalchemy.orm import aliased, exc, join
from sqlalchemy.sql import and_, or_, select
import eos.config
from eos.db import gamedata_session
from eos.db import get_gamedata_session
from eos.db.gamedata.item import items_table
from eos.db.gamedata.group import groups_table
from eos.db.gamedata.metaGroup import items_table, metatypes_table
from eos.db.util import processEager, processWhere
from eos.gamedata import AlphaClone, Attribute, AttributeInfo, Category, DynamicItem, Group, Item, MarketGroup, MetaData, MetaGroup
from eos.gamedata import AlphaClone, Attribute, AttributeInfo, Category, DynamicItem, Group, Item, MarketGroup, MetaData, MetaGroup, ImplantSet
cache = {}
configVal = getattr(eos.config, "gamedataCache", None)
@@ -64,7 +64,7 @@ else:
return deco
def sqlizeString(line):
def sqlizeNormalString(line):
# Escape backslashes first, as they will be as escape symbol in queries
# Then escape percent and underscore signs
# Finally, replace generic wildcards with sql-style wildcards
@@ -79,28 +79,39 @@ itemNameMap = {}
def getItem(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
item = gamedata_session.query(Item).get(lookfor)
item = get_gamedata_session().query(Item).get(lookfor)
else:
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == lookfor).first()
item = get_gamedata_session().query(Item).options(*processEager(eager)).filter(Item.ID == lookfor).first()
elif isinstance(lookfor, str):
if lookfor in itemNameMap:
id = itemNameMap[lookfor]
if eager is None:
item = gamedata_session.query(Item).get(id)
item = get_gamedata_session().query(Item).get(id)
else:
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.ID == id).first()
item = get_gamedata_session().query(Item).options(*processEager(eager)).filter(Item.ID == id).first()
else:
# Item names are unique, so we can use first() instead of one()
item = gamedata_session.query(Item).options(*processEager(eager)).filter(Item.name == lookfor).first()
itemNameMap[lookfor] = item.ID
item = get_gamedata_session().query(Item).options(*processEager(eager)).filter(Item.name == lookfor).first()
if item is not None:
itemNameMap[lookfor] = item.ID
else:
raise TypeError("Need integer or string as argument")
return item
@cachedQuery(1, "itemIDs")
def getItems(itemIDs, eager=None):
if not isinstance(itemIDs, (tuple, list, set)) or not all(isinstance(t, int) for t in itemIDs):
raise TypeError("Need iterable of integers as argument")
if eager is None:
items = get_gamedata_session().query(Item).filter(Item.ID.in_(itemIDs)).all()
else:
items = get_gamedata_session().query(Item).options(*processEager(eager)).filter(Item.ID.in_(itemIDs)).all()
return items
def getMutaplasmid(lookfor, eager=None):
if isinstance(lookfor, int):
item = gamedata_session.query(DynamicItem).filter(DynamicItem.ID == lookfor).first()
item = get_gamedata_session().query(DynamicItem).filter(DynamicItem.ID == lookfor).first()
else:
raise TypeError("Need integer as argument")
return item
@@ -108,7 +119,7 @@ def getMutaplasmid(lookfor, eager=None):
def getItemWithBaseItemAttribute(lookfor, baseItemID, eager=None):
# A lot of this is described in more detail in #1597
item = gamedata_session.query(Item).get(lookfor)
item = get_gamedata_session().query(Item).get(lookfor)
base = getItem(baseItemID)
# we have to load all attributes for this object, otherwise we'll lose access to them when we expunge.
@@ -124,7 +135,7 @@ def getItemWithBaseItemAttribute(lookfor, baseItemID, eager=None):
# Expunge the item form the session. This is required to have different Abyssal / Base combinations loaded in memory.
# Without expunging it, once one Abyssal Web is created, SQLAlchmey will use it for all others. We don't want this,
# we want to generate a completely new object to work with
gamedata_session.expunge(item)
get_gamedata_session().expunge(item)
return item
@@ -147,7 +158,7 @@ def getItems(lookfor, eager=None):
if len(toGet) > 0:
# Get items that aren't currently cached, and store them in the cache
items = gamedata_session.query(Item).filter(Item.ID.in_(toGet)).all()
items = get_gamedata_session().query(Item).filter(Item.ID.in_(toGet)).all()
for item in items:
cache[(item.ID, None)] = item
results += items
@@ -161,9 +172,9 @@ def getItems(lookfor, eager=None):
def getAlphaClone(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
item = gamedata_session.query(AlphaClone).get(lookfor)
item = get_gamedata_session().query(AlphaClone).get(lookfor)
else:
item = gamedata_session.query(AlphaClone).options(*processEager(eager)).filter(AlphaClone.ID == lookfor).first()
item = get_gamedata_session().query(AlphaClone).options(*processEager(eager)).filter(AlphaClone.ID == lookfor).first()
else:
raise TypeError("Need integer as argument")
return item
@@ -171,7 +182,7 @@ def getAlphaClone(lookfor, eager=None):
def getAlphaCloneList(eager=None):
eager = processEager(eager)
clones = gamedata_session.query(AlphaClone).options(*eager).all()
clones = get_gamedata_session().query(AlphaClone).options(*eager).all()
return clones
@@ -182,20 +193,21 @@ groupNameMap = {}
def getGroup(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
group = gamedata_session.query(Group).get(lookfor)
group = get_gamedata_session().query(Group).get(lookfor)
else:
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == lookfor).first()
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.ID == lookfor).first()
elif isinstance(lookfor, str):
if lookfor in groupNameMap:
id = groupNameMap[lookfor]
if eager is None:
group = gamedata_session.query(Group).get(id)
group = get_gamedata_session().query(Group).get(id)
else:
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.ID == id).first()
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.ID == id).first()
else:
# Group names are unique, so we can use first() instead of one()
group = gamedata_session.query(Group).options(*processEager(eager)).filter(Group.name == lookfor).first()
groupNameMap[lookfor] = group.ID
group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.name == lookfor).first()
if group is not None:
groupNameMap[lookfor] = group.ID
else:
raise TypeError("Need integer or string as argument")
return group
@@ -208,23 +220,24 @@ categoryNameMap = {}
def getCategory(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
category = gamedata_session.query(Category).get(lookfor)
category = get_gamedata_session().query(Category).get(lookfor)
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
category = get_gamedata_session().query(Category).options(*processEager(eager)).filter(
Category.ID == lookfor).first()
elif isinstance(lookfor, str):
if lookfor in categoryNameMap:
id = categoryNameMap[lookfor]
if eager is None:
category = gamedata_session.query(Category).get(id)
category = get_gamedata_session().query(Category).get(id)
else:
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
category = get_gamedata_session().query(Category).options(*processEager(eager)).filter(
Category.ID == id).first()
else:
# Category names are unique, so we can use first() instead of one()
category = gamedata_session.query(Category).options(*processEager(eager)).filter(
category = get_gamedata_session().query(Category).options(*processEager(eager)).filter(
Category.name == lookfor).first()
categoryNameMap[lookfor] = category.ID
if category is not None:
categoryNameMap[lookfor] = category.ID
else:
raise TypeError("Need integer or string as argument")
return category
@@ -237,35 +250,40 @@ metaGroupNameMap = {}
def getMetaGroup(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
metaGroup = gamedata_session.query(MetaGroup).get(lookfor)
metaGroup = get_gamedata_session().query(MetaGroup).get(lookfor)
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
metaGroup = get_gamedata_session().query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == lookfor).first()
elif isinstance(lookfor, str):
if lookfor in metaGroupNameMap:
id = metaGroupNameMap[lookfor]
if eager is None:
metaGroup = gamedata_session.query(MetaGroup).get(id)
metaGroup = get_gamedata_session().query(MetaGroup).get(id)
else:
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
metaGroup = get_gamedata_session().query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.ID == id).first()
else:
# MetaGroup names are unique, so we can use first() instead of one()
metaGroup = gamedata_session.query(MetaGroup).options(*processEager(eager)).filter(
metaGroup = get_gamedata_session().query(MetaGroup).options(*processEager(eager)).filter(
MetaGroup.name == lookfor).first()
metaGroupNameMap[lookfor] = metaGroup.ID
if metaGroup is not None:
metaGroupNameMap[lookfor] = metaGroup.ID
else:
raise TypeError("Need integer or string as argument")
return metaGroup
def getMetaGroups():
return get_gamedata_session().query(MetaGroup).all()
@cachedQuery(1, "lookfor")
def getMarketGroup(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
marketGroup = gamedata_session.query(MarketGroup).get(lookfor)
marketGroup = get_gamedata_session().query(MarketGroup).get(lookfor)
else:
marketGroup = gamedata_session.query(MarketGroup).options(*processEager(eager)).filter(
marketGroup = get_gamedata_session().query(MarketGroup).options(*processEager(eager)).filter(
MarketGroup.ID == lookfor).first()
else:
raise TypeError("Need integer as argument")
@@ -277,7 +295,7 @@ def getMarketTreeNodeIds(rootNodeIds):
addedIds = set(rootNodeIds)
while addedIds:
allIds.update(addedIds)
addedIds = {mg.ID for mg in gamedata_session.query(MarketGroup).filter(MarketGroup.parentGroupID.in_(addedIds))}
addedIds = {mg.ID for mg in get_gamedata_session().query(MarketGroup).filter(MarketGroup.parentGroupID.in_(addedIds))}
return allIds
@@ -291,7 +309,7 @@ def getItemsByCategory(filter, where=None, eager=None):
raise TypeError("Need integer or string as argument")
filter = processWhere(filter, where)
return gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter(
return get_gamedata_session().query(Item).options(*processEager(eager)).join(Item.group, Group.category).filter(
filter).all()
@@ -306,9 +324,9 @@ def searchItems(nameLike, where=None, join=None, eager=None):
if not hasattr(join, "__iter__"):
join = (join,)
items = gamedata_session.query(Item).options(*processEager(eager)).join(*join)
items = get_gamedata_session().query(Item).options(*processEager(eager)).join(*join)
for token in nameLike.split(' '):
token_safe = "%{0}%".format(sqlizeString(token))
token_safe = "%{0}%".format(sqlizeNormalString(token))
if where is not None:
items = items.filter(and_(Item.name.like(token_safe, escape="\\"), where))
else:
@@ -317,14 +335,35 @@ def searchItems(nameLike, where=None, join=None, eager=None):
return items
@cachedQuery(3, "tokens", "where", "join")
def searchItemsRegex(tokens, where=None, join=None, eager=None):
if not isinstance(tokens, (tuple, list)) or not all(isinstance(t, str) for t in tokens):
raise TypeError("Need tuple or list of strings as argument")
if join is None:
join = tuple()
if not hasattr(join, "__iter__"):
join = (join,)
items = get_gamedata_session().query(Item).options(*processEager(eager)).join(*join)
for token in tokens:
if where is not None:
items = items.filter(and_(Item.name.op('regexp')(token), where))
else:
items = items.filter(Item.name.op('regexp')(token))
items = items.limit(100).all()
return items
@cachedQuery(3, "where", "nameLike", "join")
def searchSkills(nameLike, where=None, eager=None):
if not isinstance(nameLike, str):
raise TypeError("Need string as argument")
items = gamedata_session.query(Item).options(*processEager(eager)).join(Item.group, Group.category)
items = get_gamedata_session().query(Item).options(*processEager(eager)).join(Item.group, Group.category)
for token in nameLike.split(' '):
token_safe = "%{0}%".format(sqlizeString(token))
token_safe = "%{0}%".format(sqlizeNormalString(token))
if where is not None:
items = items.filter(and_(Item.name.like(token_safe, escape="\\"), Category.ID == 16, where))
else:
@@ -342,11 +381,9 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None):
if len(itemids) == 0:
return []
itemfilter = or_(*(metatypes_table.c.parentTypeID == itemid for itemid in itemids))
itemfilter = or_(*(items_table.c.variationParentTypeID == itemid for itemid in itemids))
filter = processWhere(itemfilter, where)
joinon = items_table.c.typeID == metatypes_table.c.typeID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((metatypes_table, joinon)).filter(
filter).all()
vars = get_gamedata_session().query(Item).options(*processEager(eager)).filter(filter).all()
if vars:
return vars
@@ -354,7 +391,7 @@ def getVariations(itemids, groupIDs=None, where=None, eager=None):
itemfilter = or_(*(groups_table.c.groupID == groupID for groupID in groupIDs))
filter = processWhere(itemfilter, where)
joinon = items_table.c.groupID == groups_table.c.groupID
vars = gamedata_session.query(Item).options(*processEager(eager)).join((groups_table, joinon)).filter(
vars = get_gamedata_session().query(Item).options(*processEager(eager)).join((groups_table, joinon)).filter(
filter).all()
return vars
@@ -369,7 +406,7 @@ def getAttributeInfo(attr, eager=None):
else:
raise TypeError("Need integer or string as argument")
try:
result = gamedata_session.query(AttributeInfo).options(*processEager(eager)).filter(filter).one()
result = get_gamedata_session().query(AttributeInfo).options(*processEager(eager)).filter(filter).one()
except exc.NoResultFound:
result = None
return result
@@ -378,7 +415,7 @@ def getAttributeInfo(attr, eager=None):
@cachedQuery(1, "field")
def getMetaData(field):
if isinstance(field, str):
data = gamedata_session.query(MetaData).get(field)
data = get_gamedata_session().query(MetaData).get(field)
else:
raise TypeError("Need string as argument")
return data
@@ -397,12 +434,12 @@ def directAttributeRequest(itemIDs, attrIDs):
and_(Attribute.attributeID.in_(attrIDs), Item.typeID.in_(itemIDs)),
from_obj=[join(Attribute, Item)])
result = gamedata_session.execute(q).fetchall()
result = get_gamedata_session().execute(q).fetchall()
return result
def getAbyssalTypes():
return set([r.resultingTypeID for r in gamedata_session.query(DynamicItem.resultingTypeID).distinct()])
return set([r.resultingTypeID for r in get_gamedata_session().query(DynamicItem.resultingTypeID).distinct()])
@cachedQuery(1, "itemID")
@@ -410,9 +447,9 @@ def getDynamicItem(itemID, eager=None):
try:
if isinstance(itemID, int):
if eager is None:
result = gamedata_session.query(DynamicItem).filter(DynamicItem.ID == itemID).one()
result = get_gamedata_session().query(DynamicItem).filter(DynamicItem.ID == itemID).one()
else:
result = gamedata_session.query(DynamicItem).options(*processEager(eager)).filter(DynamicItem.ID == itemID).one()
result = get_gamedata_session().query(DynamicItem).options(*processEager(eager)).filter(DynamicItem.ID == itemID).one()
else:
raise TypeError("Need integer as argument")
except exc.NoResultFound:
@@ -420,23 +457,7 @@ def getDynamicItem(itemID, eager=None):
return result
def getRequiredFor(itemID, attrMapping):
Attribute1 = aliased(Attribute)
Attribute2 = aliased(Attribute)
skillToLevelClauses = []
for attrSkill, attrLevel in attrMapping.items():
skillToLevelClauses.append(and_(Attribute1.attributeID == attrSkill, Attribute2.attributeID == attrLevel))
queryOr = or_(*skillToLevelClauses)
q = select((Attribute2.typeID, Attribute2.value),
and_(Attribute1.value == itemID, queryOr),
from_obj=[
join(Attribute1, Attribute2, Attribute1.typeID == Attribute2.typeID)
])
result = gamedata_session.execute(q).fetchall()
return result
@cachedQuery(1, "lookfor")
def getAllImplantSets():
implantSets = get_gamedata_session().query(ImplantSet).all()
return implantSets

View File

@@ -8,43 +8,25 @@ many upgrade files as there are database versions (version 5 would include
upgrade files 1-5)
"""
import pkgutil
import re
from eos.utils.pyinst_support import iterNamespace
updates = {}
appVersion = 0
prefix = __name__ + "."
# load modules to work based with and without pyinstaller
# from: https://github.com/webcomics/dosage/blob/master/dosagelib/loader.py
# see: https://github.com/pyinstaller/pyinstaller/issues/1905
# load modules using iter_modules()
# (should find all filters in normal build, but not pyinstaller)
module_names = [m[1] for m in pkgutil.iter_modules(__path__, prefix)]
# special handling for PyInstaller
importers = map(pkgutil.get_importer, __path__)
toc = set()
for i in importers:
if hasattr(i, 'toc'):
toc |= i.toc
for elm in toc:
if elm.startswith(prefix):
module_names.append(elm)
for modname in module_names:
for modName in iterNamespace(__name__, __path__):
# loop through python files, extracting update number and function, and
# adding it to a list
modname_tail = modname.rsplit('.', 1)[-1]
module = __import__(modname, fromlist=True)
modname_tail = modName.rsplit('.', 1)[-1]
m = re.match("^upgrade(?P<index>\d+)$", modname_tail)
if not m:
continue
index = int(m.group("index"))
appVersion = max(appVersion, index)
module = __import__(modName, fromlist=True)
upgrade = getattr(module, "upgrade", False)
if upgrade:
updates[index] = upgrade

View File

@@ -33,9 +33,13 @@ def upgrade(saveddata_engine):
try:
saveddata_session.execute(commandFits_table.insert(),
{"boosterID": value, "boostedID": boosted, "active": 1})
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
pass
saveddata_session.commit()
except (KeyboardInterrupt, SystemExit):
raise
except:
# Shouldn't fail unless you have updated database without the old fleet schema and manually modify the database version
# If it does, simply fail. Fleet data migration isn't critically important here

View File

@@ -4235,6 +4235,8 @@ def upgrade(saveddata_engine):
# And last but not least, delete the last subsystem
saveddata_engine.execute("DELETE FROM modules WHERE ID = ?", (oldModules[4][0],))
except (KeyboardInterrupt, SystemExit):
raise
except:
# if something fails, fuck it, we tried. It'll default to the generic conversion below
continue

View File

@@ -0,0 +1,16 @@
"""
Migration 32
- added speed, sig and radius columns to targetResists table
"""
import sqlalchemy
def upgrade(saveddata_engine):
for column in ('maxVelocity', 'signatureRadius', 'radius'):
try:
saveddata_engine.execute("SELECT {} FROM targetResists LIMIT 1;".format(column))
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE targetResists ADD COLUMN {} FLOAT;".format(column))

View File

@@ -0,0 +1,30 @@
"""
Migration 33
Allow use of floats in damage pattern values
"""
tmpTable = """
CREATE TABLE "damagePatternsTemp" (
"ID" INTEGER NOT NULL,
"name" VARCHAR,
"emAmount" FLOAT,
"thermalAmount" FLOAT,
"kineticAmount" FLOAT,
"explosiveAmount" FLOAT,
"ownerID" INTEGER,
"created" DATETIME,
"modified" DATETIME,
PRIMARY KEY ("ID"),
FOREIGN KEY("ownerID") REFERENCES users ("ID")
)
"""
def upgrade(saveddata_engine):
saveddata_engine.execute(tmpTable)
saveddata_engine.execute(
'INSERT INTO damagePatternsTemp (ID, name, emAmount, thermalAmount, kineticAmount, explosiveAmount, ownerID, created, modified) '
'SELECT ID, name, emAmount, thermalAmount, kineticAmount, explosiveAmount, ownerID, created, modified FROM damagePatterns')
saveddata_engine.execute('DROP TABLE damagePatterns')
saveddata_engine.execute('ALTER TABLE damagePatternsTemp RENAME TO damagePatterns')

View File

@@ -0,0 +1,25 @@
"""
Migration 34
- Adds projection range columns to projectable entities
"""
import sqlalchemy
def upgrade(saveddata_engine):
try:
saveddata_engine.execute("SELECT projectionRange FROM projectedFits LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE projectedFits ADD COLUMN projectionRange FLOAT;")
try:
saveddata_engine.execute("SELECT projectionRange FROM modules LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE modules ADD COLUMN projectionRange FLOAT;")
try:
saveddata_engine.execute("SELECT projectionRange FROM drones LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE drones ADD COLUMN projectionRange FLOAT;")
try:
saveddata_engine.execute("SELECT projectionRange FROM fighters LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE fighters ADD COLUMN projectionRange FLOAT;")

View File

@@ -0,0 +1,166 @@
"""
Migration 35
- Remove builtin damage patterns and target profiles from the database
"""
import sqlalchemy
dmgPatterns = (
'Uniform',
'[Bombs]Concussion Bomb',
'[Bombs]Electron Bomb',
'[Bombs]Scorch Bomb',
'[Bombs]Shrapnel Bomb',
'[Exotic Plasma]Baryon',
'[Exotic Plasma]Meson',
'[Exotic Plasma]Tetryon',
'[Exotic Plasma][T2] Mystic',
'[Exotic Plasma][T2] Occult',
'[Frequency Crystals]Gamma',
'[Frequency Crystals]Infrared',
'[Frequency Crystals]Microwave',
'[Frequency Crystals]Multifrequency',
'[Frequency Crystals]Radio',
'[Frequency Crystals]Standard',
'[Frequency Crystals]Ultraviolet',
'[Frequency Crystals]Xray',
'[Frequency Crystals][T2] Aurora',
'[Frequency Crystals][T2] Conflagration',
'[Frequency Crystals][T2] Gleam',
'[Frequency Crystals][T2] Scorch',
'[Generic]EM',
'[Generic]Explosive',
'[Generic]Kinetic',
'[Generic]Thermal',
'[Hybrid Charges]Antimatter',
'[Hybrid Charges]Iridium',
'[Hybrid Charges]Iron',
'[Hybrid Charges]Lead',
'[Hybrid Charges]Plutonium',
'[Hybrid Charges]Thorium',
'[Hybrid Charges]Tungsten',
'[Hybrid Charges]Uranium',
'[Hybrid Charges][T2] Javelin',
'[Hybrid Charges][T2] Null',
'[Hybrid Charges][T2] Spike',
'[Hybrid Charges][T2] Void',
'[Missiles]Inferno',
'[Missiles]Mjolnir',
'[Missiles]Nova',
'[Missiles]Scourge',
'[Missiles][Structure) Standup Missile',
'[Missiles][Structure] Standup Missile',
'[NPC][Asteroid] Angel Cartel',
'[NPC][Asteroid] Blood Raiders',
'[NPC][Asteroid] Guristas',
'[NPC][Asteroid] Rogue Drone',
'[NPC][Asteroid] Sanshas Nation',
'[NPC][Asteroid] Serpentis',
'[NPC][Burner] Ashimmu (Blood Raiders)',
'[NPC][Burner] Cruor (Blood Raiders)',
'[NPC][Burner] Daredevil (Serpentis)',
'[NPC][Burner] Dramiel (Angel)',
'[NPC][Burner] Enyo',
'[NPC][Burner] Hawk',
'[NPC][Burner] Jaguar',
'[NPC][Burner] Sentinel',
'[NPC][Burner] Succubus (Sanshas Nation)',
'[NPC][Burner] Talos',
'[NPC][Burner] Vengeance',
'[NPC][Burner] Worm (Guristas)',
'[NPC][Deadspace] Angel Cartel',
'[NPC][Deadspace] Blood Raiders',
'[NPC][Deadspace] Guristas',
'[NPC][Deadspace] Rogue Drone',
'[NPC][Deadspace] Sanshas Nation',
'[NPC][Deadspace] Serpentis',
'[NPC][Mission] Amarr Empire',
'[NPC][Mission] CONCORD',
'[NPC][Mission] Caldari State',
'[NPC][Mission] Gallente Federation',
'[NPC][Mission] Khanid',
'[NPC][Mission] Minmatar Republic',
'[NPC][Mission] Mordus Legion',
'[NPC][Mission] Thukker',
'[NPC][Other] Sansha Incursion',
'[NPC][Other] Sleepers',
'[Projectile Ammo]Carbonized Lead',
'[Projectile Ammo]Depleted Uranium',
'[Projectile Ammo]EMP',
'[Projectile Ammo]Fusion',
'[Projectile Ammo]Nuclear',
'[Projectile Ammo]Phased Plasma',
'[Projectile Ammo]Proton',
'[Projectile Ammo]Titanium Sabot',
'[Projectile Ammo][T2] Barrage',
'[Projectile Ammo][T2] Hail',
'[Projectile Ammo][T2] Quake',
'[Projectile Ammo][T2] Tremor')
tgtProfiles = (
'Uniform (25%)',
'Uniform (50%)',
'Uniform (75%)',
'Uniform (90%)',
'[NPC][Asteroid] Angel Cartel',
'[NPC][Asteroid] Blood Raiders',
'[NPC][Asteroid] Guristas',
'[NPC][Asteroid] Rogue Drones',
'[NPC][Asteroid] Sanshas Nation',
'[NPC][Asteroid] Serpentis',
'[NPC][Burner] Ashimmu (Blood Raiders)',
'[NPC][Burner] Cruor (Blood Raiders)',
'[NPC][Burner] Daredevil (Serpentis)',
'[NPC][Burner] Dramiel (Angel)',
'[NPC][Burner] Enyo',
'[NPC][Burner] Hawk',
'[NPC][Burner] Jaguar',
'[NPC][Burner] Sentinel',
'[NPC][Burner] Succubus (Sanshas Nation)',
'[NPC][Burner] Talos',
'[NPC][Burner] Vengeance',
'[NPC][Burner] Worm (Guristas)',
'[NPC][Deadspace] Angel Cartel',
'[NPC][Deadspace] Blood Raiders',
'[NPC][Deadspace] Guristas',
'[NPC][Deadspace] Rogue Drones',
'[NPC][Deadspace] Sanshas Nation',
'[NPC][Deadspace] Serpentis',
'[NPC][Mission] Amarr Empire',
'[NPC][Mission] CONCORD',
'[NPC][Mission] Caldari State',
'[NPC][Mission] Gallente Federation',
'[NPC][Mission] Khanid',
'[NPC][Mission] Minmatar Republic',
'[NPC][Mission] Mordus Legion',
'[NPC][Other] Sansha Incursion',
'[NPC][Other] Sleeper',
'[T1 Resist]Armor',
'[T1 Resist]Armor (+T2 DCU)',
'[T1 Resist]Hull',
'[T1 Resist]Hull (+T2 DCU)',
'[T1 Resist]Shield',
'[T1 Resist]Shield (+T2 DCU)',
'[T2 Resist]Amarr (Armor)',
'[T2 Resist]Amarr (Shield)',
'[T2 Resist]Caldari (Armor)',
'[T2 Resist]Caldari (Shield)',
'[T2 Resist]Gallente (Armor)',
'[T2 Resist]Gallente (Shield)',
'[T2 Resist]Minmatar (Armor)',
'[T2 Resist]Minmatar (Shield)')
def upgrade(saveddata_engine):
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name in ({});'.format(', '.join('\'{}\''.format(n) for n in dmgPatterns)))
saveddata_engine.execute('DELETE FROM targetResists WHERE name in ({});'.format(', '.join('\'{}\''.format(n) for n in tgtProfiles)))
try:
saveddata_engine.execute("SELECT builtinDamagePatternID FROM fits LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN builtinDamagePatternID INT;")
try:
saveddata_engine.execute("SELECT builtinTargetResistsID FROM fits LIMIT 1")
except sqlalchemy.exc.DatabaseError:
saveddata_engine.execute("ALTER TABLE fits ADD COLUMN builtinTargetResistsID INT;")

View File

@@ -0,0 +1,84 @@
"""
Migration 36
- Shield Booster, Armor Repairer and Capacitor Transfer tiericide
"""
CONVERSIONS = {
6441: ( # Small Clarity Ward Enduring Shield Booster
6443, # Small Converse Deflection Catalyzer
),
6437: ( # Small C5-L Compact Shield Booster
6439, # Small Neutron Saturation Injector I
),
10868: ( # Medium Clarity Ward Enduring Shield Booster
10870, # Medium Converse Deflection Catalyzer
),
10872: ( # Medium C5-L Compact Shield Booster
10866, # Medium Neutron Saturation Injector I
),
10876: ( # Large Clarity Ward Enduring Shield Booster
10878, # Large Converse Deflection Catalyzer
),
10880: ( # Large C5-L Compact Shield Booster
10874, # Large Neutron Saturation Injector I
),
10884: ( # X-Large Clarity Ward Enduring Shield Booster
10886, # X-Large Converse Deflection Catalyzer
),
10888: ( # X-Large C5-L Compact Shield Booster
10882, # X-Large Neutron Saturation Injector I
),
4533: ( # Small ACM Compact Armor Repairer
4531, # Small Inefficient Armor Repair Unit
),
4529: ( # Small I-a Enduring Armor Repairer
4535, # Small Automated Carapace Restoration
),
4573: ( # Medium ACM Compact Armor Repairer
4571, # Medium Inefficient Armor Repair Unit
),
4569: ( # Medium I-a Enduring Armor Repairer
4575, # Medium Automated Carapace Restoration
),
22889: ( # 'Meditation' Medium Armor Repairer I
4579, # Medium Nano Armor Repair Unit I
),
4613: ( # Large ACM Compact Armor Repairer
4611, # Large Inefficient Armor Repair Unit
),
4609: ( # Large I-a Enduring Armor Repairer
4615, # Large Automated Carapace Restoration
),
22891: ( # 'Protest' Large Armor Repairer I
4621, # Large 'Reprieve' Vestment Reconstructer I
),
5093: ( # Small Radiative Scoped Remote Capacitor Transmitter
5087, # Small Partial E95a Remote Capacitor Transmitter
),
5091: ( # Small Inductive Compact Remote Capacitor Transmitter
5089, # Small Murky Remote Capacitor Transmitter
),
16489: ( # Medium Radiative Scoped Remote Capacitor Transmitter
16493, # Medium Partial E95b Remote Capacitor Transmitter
),
16495: ( # Medium Inductive Compact Remote Capacitor Transmitter
16491, # Medium Murky Remote Capacitor Transmitter
),
16481: ( # Large Radiative Scoped Remote Capacitor Transmitter
16485, # Large Partial E95c Remote Capacitor Transmitter
),
16487: ( # Large Inductive Compact Remote Capacitor Transmitter
16483, # Large Murky Remote Capacitor Transmitter
)
}
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -0,0 +1,44 @@
"""
Migration 37
- Capacitor Booster tiericide
"""
CONVERSIONS = {
4959: ( # 'Seed' Micro Capacitor Booster I
4957, # Micro Brief Capacitor Overcharge I
4961, # Micro Tapered Capacitor Infusion I
4955, # Micro F-RX Prototype Capacitor Boost
3556, # Micro Capacitor Booster I
3558, # Micro Capacitor Booster II
15774, # Ammatar Navy Micro Capacitor Booster
14180, # Dark Blood Micro Capacitor Booster
14182, # True Sansha Micro Capacitor Booster
15782, # Imperial Navy Micro Capacitor Booster
),
5011: ( # Small F-RX Compact Capacitor Booster
5009, # Small Brief Capacitor Overcharge I
5013, # Small Tapered Capacitor Infusion I
5007, # Small F-RX Prototype Capacitor Boost
),
4833: ( # Medium F-RX Compact Capacitor Booster
4831, # Medium Brief Capacitor Overcharge I
4835, # Medium Tapered Capacitor Infusion I
4829, # Medium F-RX Prototype Capacitor Boost
),
5051: ( # Heavy F-RX Compact Capacitor Booster
5049, # Heavy Brief Capacitor Overcharge I
5053, # Heavy Tapered Capacitor Infusion I
5047, # Heavy F-RX Prototype Capacitor Boost
)
}
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -0,0 +1,42 @@
"""
Migration 38
- Armor hardener tiericide
"""
CONVERSIONS = {
16357: ( # Experimental Enduring EM Armor Hardener I
16353, # Upgraded Armor EM Hardener I
),
16365: ( # Experimental Enduring Explosive Armor Hardener I
16361, # Upgraded Armor Explosive Hardener I
),
16373: ( # Experimental Enduring Kinetic Armor Hardener I
16369, # Upgraded Armor Kinetic Hardener I
),
16381: ( # Experimental Enduring Thermal Armor Hardener I
16377, # Upgraded Armor Thermal Hardener I
),
16359: ( # Prototype Compact EM Armor Hardener I
16355, # Limited Armor EM Hardener I
),
16367: ( # Prototype Compact Explosive Armor Hardener I
16363, # Limited Armor Explosive Hardener I
),
16375: ( # Prototype Compact Kinetic Armor Hardener I
16371, # Limited Armor Kinetic Hardener I
),
16383: ( # Prototype Compact Thermal Armor Hardener I
16379, # Limited Armor Thermal Hardener I
)
}
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -0,0 +1,34 @@
"""
Migration 39
- Shield amplifier tiericide
- CCP getting rid of DB TDs due to exploits
"""
CONVERSIONS = {
1798: ( # 'Basic' EM Shield Amplifier
9562, # Supplemental EM Ward Amplifier
),
1804: ( # 'Basic' Explosive Shield Amplifier
9574, # Supplemental Explosive Deflection Amplifier
),
1802: ( # 'Basic' Kinetic Shield Amplifier
9570, # Supplemental Kinetic Deflection Amplifier
),
1800: ( # 'Basic' Thermal Shield Amplifier
9566, # Supplemental Thermal Dissipation Amplifier
),
22933: ( # 'Investor' Tracking Disruptor I
32416, # Dark Blood Tracking Disruptor
)
}
def upgrade(saveddata_engine):
# Convert modules
for replacement_item, list in CONVERSIONS.items():
for retired_item in list:
saveddata_engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))
saveddata_engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
(replacement_item, retired_item))

View File

@@ -11,8 +11,7 @@ __all__ = [
"implant",
"damagePattern",
"miscData",
"targetResists",
"targetProfile",
"override",
"implantSet",
"loadDefaultDatabaseValues"
"implantSet"
]

View File

@@ -17,23 +17,27 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, String, DateTime
from sqlalchemy import Table, Column, Integer, Float, ForeignKey, String, DateTime
from sqlalchemy.orm import mapper
import datetime
from eos.db import saveddata_meta
from eos.saveddata.damagePattern import DamagePattern
damagePatterns_table = Table("damagePatterns", saveddata_meta,
Column("ID", Integer, primary_key=True),
Column("name", String),
Column("emAmount", Integer),
Column("thermalAmount", Integer),
Column("kineticAmount", Integer),
Column("explosiveAmount", Integer),
Column("ownerID", ForeignKey("users.ID"), nullable=True),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
)
damagePatterns_table = Table(
'damagePatterns',
saveddata_meta,
Column('ID', Integer, primary_key=True),
Column('name', String),
Column('emAmount', Float),
Column('thermalAmount', Float),
Column('kineticAmount', Float),
Column('explosiveAmount', Float),
Column('ownerID', ForeignKey('users.ID'), nullable=True),
Column('created', DateTime, nullable=True, default=datetime.datetime.now),
Column('modified', DateTime, nullable=True, onupdate=datetime.datetime.now))
mapper(DamagePattern, damagePatterns_table)
mapper(
DamagePattern,
damagePatterns_table,
properties={'rawName': damagePatterns_table.c.name})

View File

@@ -23,7 +23,7 @@ from logbook import Logger
pyfalog = Logger(__name__)
class DatabaseCleanup(object):
class DatabaseCleanup:
def __init__(self):
pass

View File

@@ -17,7 +17,7 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean, DateTime
from sqlalchemy import Table, Column, Integer, Float, ForeignKey, Boolean, DateTime
from sqlalchemy.orm import mapper, relation
import datetime
@@ -33,7 +33,8 @@ drones_table = Table("drones", saveddata_meta,
Column("amountActive", Integer, nullable=False),
Column("projected", Boolean, default=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now),
Column("projectionRange", Float, nullable=True)
)
mapper(Drone, drones_table,

View File

@@ -17,7 +17,7 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from sqlalchemy import Table, Column, Integer, ForeignKey, Boolean, DateTime
from sqlalchemy import Table, Column, Integer, Float, ForeignKey, Boolean, DateTime
from sqlalchemy.orm import mapper, relation
import datetime
@@ -34,7 +34,8 @@ fighters_table = Table("fighters", saveddata_meta,
Column("amount", Integer, nullable=False),
Column("projected", Boolean, default=False),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now),
Column("projectionRange", Float, nullable=True),
)
fighter_abilities_table = Table("fightersAbilities", saveddata_meta,
@@ -46,6 +47,7 @@ fighter_abilities_table = Table("fightersAbilities", saveddata_meta,
mapper(Fighter, fighters_table,
properties={
"owner" : relation(Fit),
"_amount" : fighters_table.c.amount,
"_Fighter__abilities": relation(
FighterAbility,
backref="fighter",

View File

@@ -19,7 +19,7 @@
import datetime
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, Table
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, Float, String, Table
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import mapper, reconstructor, relation, relationship
from sqlalchemy.orm.collections import attribute_mapped_collection
@@ -41,7 +41,7 @@ from eos.saveddata.fighter import Fighter
from eos.saveddata.fit import Fit as es_Fit
from eos.saveddata.implant import Implant
from eos.saveddata.module import Module
from eos.saveddata.targetResists import TargetResists
from eos.saveddata.targetProfile import TargetProfile
from eos.saveddata.user import User
@@ -53,8 +53,10 @@ fits_table = Table("fits", saveddata_meta,
Column("timestamp", Integer, nullable=False),
Column("characterID", ForeignKey("characters.ID"), nullable=True),
Column("damagePatternID", ForeignKey("damagePatterns.ID"), nullable=True),
Column("builtinDamagePatternID", Integer, nullable=True),
Column("booster", Boolean, nullable=False, index=True, default=0),
Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True),
Column("builtinTargetResistsID", Integer, nullable=True),
Column("modeID", Integer, nullable=True),
Column("implantLocation", Integer, nullable=False),
Column("notes", String, nullable=True),
@@ -70,7 +72,8 @@ projectedFits_table = Table("projectedFits", saveddata_meta,
Column("amount", Integer, nullable=False, default=1),
Column("active", Boolean, nullable=False, default=1),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now),
Column("projectionRange", Float, nullable=True),
)
commandFits_table = Table("commandFits", saveddata_meta,
@@ -82,7 +85,8 @@ commandFits_table = Table("commandFits", saveddata_meta,
)
class ProjectedFit(object):
class ProjectedFit:
def __init__(self, sourceID, source_fit, amount=1, active=True):
self.sourceID = sourceID
self.source_fit = source_fit
@@ -113,7 +117,7 @@ class ProjectedFit(object):
)
class CommandFit(object):
class CommandFit:
def __init__(self, boosterID, booster_fit, active=True):
self.boosterID = boosterID
self.booster_fit = booster_fit
@@ -231,8 +235,10 @@ mapper(es_Fit, fits_table,
"_Fit__character": relation(
Character,
backref="fits"),
"_Fit__damagePattern": relation(DamagePattern),
"_Fit__targetResists": relation(TargetResists),
"_Fit__userDamagePattern": relation(DamagePattern),
"_Fit__builtinDamagePatternID": fits_table.c.builtinDamagePatternID,
"_Fit__userTargetProfile": relation(TargetProfile),
"_Fit__builtinTargetProfileID": fits_table.c.builtinTargetResistsID,
"projectedOnto": projectedFitSourceRel,
"victimOf": relationship(
ProjectedFit,

View File

@@ -1,207 +0,0 @@
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import eos.db
from eos.saveddata.damagePattern import DamagePattern as es_DamagePattern
from eos.saveddata.targetResists import TargetResists as es_TargetResists
class ImportError(Exception):
pass
class DefaultDatabaseValues(object):
def __init__(self):
pass
instance = None
@classmethod
def importDamageProfileDefaults(cls):
damageProfileList = [["Uniform", "25", "25", "25", "25"], ["[Generic]EM", "100", "0", "0", "0"],
["[Generic]Thermal", "0", "100", "0", "0"], ["[Generic]Kinetic", "0", "0", "100", "0"],
["[Generic]Explosive", "0", "0", "0", "100"],
["[NPC][Asteroid] Blood Raiders", "5067", "4214", "0", "0"],
["[Bombs]Electron Bomb", "6400", "0", "0", "0"],
["[Bombs]Scorch Bomb", "0", "6400", "0", "0"],
["[Bombs]Concussion Bomb", "0", "0", "6400", "0"],
["[Bombs]Shrapnel Bomb", "0", "0", "0", "6400"],
["[Frequency Crystals][T2] Conflagration", "61.6", "61.6", "0", "0"],
["[Frequency Crystals][T2] Scorch", "72", "16", "0", "0"],
["[Frequency Crystals][T2] Gleam", "56", "56", "0", "0"],
["[Frequency Crystals][T2] Aurora", "40", "24", "0", "0"],
["[Frequency Crystals]Multifrequency", "61.6", "44", "0", "0"],
["[Frequency Crystals]Gamma", "61.6", "35.2", "0", "0"],
["[Frequency Crystals]Xray", "52.8", "35.2", "0", "0"],
["[Frequency Crystals]Ultraviolet", "52.8", "26.4", "0", "0"],
["[Frequency Crystals]Standard", "44", "26.4", "0", "0"],
["[Frequency Crystals]Infrared", "44", "17.6", "0", "0"],
["[Frequency Crystals]Microwave", "35.2", "17.6", "0", "0"],
["[Frequency Crystals]Radio", "44", "0", "0", "0"],
["[Hybrid Charges][T2] Void", "0", "61.6", "61.6", "0"],
["[Hybrid Charges][T2] Null", "0", "48", "40", "0"],
["[Hybrid Charges][T2] Javelin", "0", "64", "48", "0"],
["[Hybrid Charges][T2] Spike", "0", "32", "32", "0"],
["[Hybrid Charges]Antimatter", "0", "48", "67.2", "0"],
["[Hybrid Charges]Plutonium", "0", "48", "57.6", "0"],
["[Hybrid Charges]Uranium", "0", "38.4", "57.6", "0"],
["[Hybrid Charges]Thorium", "0", "38.4", "48", "0"],
["[Hybrid Charges]Lead", "0", "28.8", "48", "0"],
["[Hybrid Charges]Iridium", "0", "28.8", "38.4", "0"],
["[Hybrid Charges]Tungsten", "0", "19.2", "38.4", "0"],
["[Hybrid Charges]Iron", "0", "19.2", "28.8", "0"],
["[Missiles]Mjolnir", "100", "0", "0", "0"],
["[Missiles]Inferno", "0", "100", "0", "0"],
["[Missiles]Scourge", "0", "0", "100", "0"],
["[Missiles]Nova", "0", "0", "0", "100"],
["[Missiles][Structure] Standup Missile", "100", "100", "100", "100"],
["[Projectile Ammo][T2] Hail", "0", "0", "26.4", "96.8"],
["[Projectile Ammo][T2] Barrage", "0", "0", "40", "48"],
["[Projectile Ammo][T2] Quake", "0", "0", "40", "72"],
["[Projectile Ammo][T2] Tremor", "0", "0", "24", "40"],
["[Projectile Ammo]EMP", "79.2", "0", "8.8", "17.6"],
["[Projectile Ammo]Phased Plasma", "0", "88", "17.6", "0"],
["[Projectile Ammo]Fusion", "0", "0", "17.6", "88"],
["[Projectile Ammo]Depleted Uranium", "0", "26.4", "17.6", "26.4"],
["[Projectile Ammo]Titanium Sabot", "0", "0", "52.8", "176"],
["[Projectile Ammo]Proton", "26.4", "0", "17.6", "0"],
["[Projectile Ammo]Carbonized Lead", "0", "0", "35.2", "8.8"],
["[Projectile Ammo]Nuclear", "0", "0", "8.8", "35.2"],
# Different sizes of plasma do different damage, the values here are
# average of proportions across sizes
["[Exotic Plasma][T2] Occult", "0", "55863", "0", "44137"],
["[Exotic Plasma][T2] Mystic", "0", "66319", "0", "33681"],
["[Exotic Plasma]Tetryon", "0", "69208", "0", "30792"],
["[Exotic Plasma]Baryon", "0", "59737", "0", "40263"],
["[Exotic Plasma]Meson", "0", "60519", "0", "39481"],
["[NPC][Burner] Cruor (Blood Raiders)", "90", "90", "0", "0"],
["[NPC][Burner] Dramiel (Angel)", "55", "0", "20", "96"],
["[NPC][Burner] Daredevil (Serpentis)", "0", "110", "154", "0"],
["[NPC][Burner] Succubus (Sanshas Nation)", "135", "30", "0", "0"],
["[NPC][Burner] Worm (Guristas)", "0", "0", "228", "0"],
["[NPC][Burner] Enyo", "0", "147", "147", "0"],
["[NPC][Burner] Hawk", "0", "0", "247", "0"],
["[NPC][Burner] Jaguar", "36", "0", "50", "182"],
["[NPC][Burner] Vengeance", "232", "0", "0", "0"],
["[NPC][Burner] Ashimmu (Blood Raiders)", "260", "100", "0", "0"],
["[NPC][Burner] Talos", "0", "413", "413", "0"],
["[NPC][Burner] Sentinel", "0", "75", "0", "90"],
["[NPC][Asteroid] Angel Cartel", "1838", "562", "2215", "3838"],
["[NPC][Deadspace] Angel Cartel", "369", "533", "1395", "3302"],
["[NPC][Deadspace] Blood Raiders", "6040", "5052", "10", "15"],
["[NPC][Asteroid] Guristas", "0", "1828", "7413", "0"],
["[NPC][Deadspace] Guristas", "0", "1531", "9680", "0"],
["[NPC][Asteroid] Rogue Drone", "394", "666", "1090", "1687"],
["[NPC][Deadspace] Rogue Drone", "276", "1071", "1069", "871"],
["[NPC][Asteroid] Sanshas Nation", "5586", "4112", "0", "0"],
["[NPC][Deadspace] Sanshas Nation", "3009", "2237", "0", "0"],
["[NPC][Asteroid] Serpentis", "0", "5373", "4813", "0"],
["[NPC][Deadspace] Serpentis", "0", "3110", "1929", "0"],
["[NPC][Mission] Amarr Empire", "4464", "3546", "97", "0"],
["[NPC][Mission] Caldari State", "0", "2139", "4867", "0"],
["[NPC][Mission] CONCORD", "336", "134", "212", "412"],
["[NPC][Mission] Gallente Federation", "9", "3712", "2758", "0"],
["[NPC][Mission] Khanid", "612", "483", "43", "6"],
["[NPC][Mission] Minmatar Republic", "1024", "388", "1655", "4285"],
["[NPC][Mission] Mordus Legion", "25", "262", "625", "0"],
["[NPC][Mission] Thukker", "0", "52", "10", "79"],
["[NPC][Other] Sleepers", "1472", "1472", "1384", "1384"],
["[NPC][Other] Sansha Incursion", "1682", "1347", "3678", "3678"]]
for damageProfileRow in damageProfileList:
name, em, therm, kin, exp = damageProfileRow
damageProfile = eos.db.getDamagePattern(name)
if damageProfile is None:
damageProfile = es_DamagePattern(em, therm, kin, exp)
damageProfile.name = name
eos.db.save(damageProfile)
@classmethod
def importResistProfileDefaults(cls):
targetResistProfileList = [["Uniform (25%)", "0.25", "0.25", "0.25", "0.25"],
["Uniform (50%)", "0.50", "0.50", "0.50", "0.50"],
["Uniform (75%)", "0.75", "0.75", "0.75", "0.75"],
["Uniform (90%)", "0.90", "0.90", "0.90", "0.90"],
["[T1 Resist]Shield", "0.0", "0.20", "0.40", "0.50"],
["[T1 Resist]Armor", "0.50", "0.45", "0.25", "0.10"],
["[T1 Resist]Hull", "0.33", "0.33", "0.33", "0.33"],
["[T1 Resist]Shield (+T2 DCU)", "0.125", "0.30", "0.475", "0.562"],
["[T1 Resist]Armor (+T2 DCU)", "0.575", "0.532", "0.363", "0.235"],
["[T1 Resist]Hull (+T2 DCU)", "0.598", "0.598", "0.598", "0.598"],
["[T2 Resist]Amarr (Shield)", "0.0", "0.20", "0.70", "0.875"],
["[T2 Resist]Amarr (Armor)", "0.50", "0.35", "0.625", "0.80"],
["[T2 Resist]Caldari (Shield)", "0.20", "0.84", "0.76", "0.60"],
["[T2 Resist]Caldari (Armor)", "0.50", "0.8625", "0.625", "0.10"],
["[T2 Resist]Gallente (Shield)", "0.0", "0.60", "0.85", "0.50"],
["[T2 Resist]Gallente (Armor)", "0.50", "0.675", "0.8375", "0.10"],
["[T2 Resist]Minmatar (Shield)", "0.75", "0.60", "0.40", "0.50"],
["[T2 Resist]Minmatar (Armor)", "0.90", "0.675", "0.25", "0.10"],
["[NPC][Asteroid] Angel Cartel", "0.54", "0.42", "0.37", "0.32"],
["[NPC][Asteroid] Blood Raiders", "0.34", "0.39", "0.45", "0.52"],
["[NPC][Asteroid] Guristas", "0.55", "0.35", "0.3", "0.48"],
["[NPC][Asteroid] Rogue Drones", "0.35", "0.38", "0.44", "0.49"],
["[NPC][Asteroid] Sanshas Nation", "0.35", "0.4", "0.47", "0.53"],
["[NPC][Asteroid] Serpentis", "0.49", "0.38", "0.29", "0.51"],
["[NPC][Deadspace] Angel Cartel", "0.59", "0.48", "0.4", "0.32"],
["[NPC][Deadspace] Blood Raiders", "0.31", "0.39", "0.47", "0.56"],
["[NPC][Deadspace] Guristas", "0.57", "0.39", "0.31", "0.5"],
["[NPC][Deadspace] Rogue Drones", "0.42", "0.42", "0.47", "0.49"],
["[NPC][Deadspace] Sanshas Nation", "0.31", "0.39", "0.47", "0.56"],
["[NPC][Deadspace] Serpentis", "0.49", "0.38", "0.29", "0.56"],
["[NPC][Mission] Amarr Empire", "0.34", "0.38", "0.42", "0.46"],
["[NPC][Mission] Caldari State", "0.51", "0.38", "0.3", "0.51"],
["[NPC][Mission] CONCORD", "0.47", "0.46", "0.47", "0.47"],
["[NPC][Mission] Gallente Federation", "0.51", "0.38", "0.31", "0.52"],
["[NPC][Mission] Khanid", "0.51", "0.42", "0.36", "0.4"],
["[NPC][Mission] Minmatar Republic", "0.51", "0.46", "0.41", "0.35"],
["[NPC][Mission] Mordus Legion", "0.32", "0.48", "0.4", "0.62"],
["[NPC][Other] Sleeper", "0.61", "0.61", "0.61", "0.61"],
["[NPC][Other] Sansha Incursion", "0.65", "0.63", "0.64", "0.65"],
["[NPC][Burner] Cruor (Blood Raiders)", "0.8", "0.73", "0.69", "0.67"],
["[NPC][Burner] Dramiel (Angel)", "0.35", "0.48", "0.61", "0.68"],
["[NPC][Burner] Daredevil (Serpentis)", "0.69", "0.59", "0.59", "0.43"],
["[NPC][Burner] Succubus (Sanshas Nation)", "0.35", "0.48", "0.61", "0.68"],
["[NPC][Burner] Worm (Guristas)", "0.48", "0.58", "0.69", "0.74"],
["[NPC][Burner] Enyo", "0.58", "0.72", "0.86", "0.24"],
["[NPC][Burner] Hawk", "0.3", "0.86", "0.79", "0.65"],
["[NPC][Burner] Jaguar", "0.78", "0.65", "0.48", "0.56"],
["[NPC][Burner] Vengeance", "0.66", "0.56", "0.75", "0.86"],
["[NPC][Burner] Ashimmu (Blood Raiders)", "0.8", "0.76", "0.68", "0.7"],
["[NPC][Burner] Talos", "0.68", "0.59", "0.59", "0.43"],
["[NPC][Burner] Sentinel", "0.58", "0.45", "0.52", "0.66"]]
for targetResistProfileRow in targetResistProfileList:
name, em, therm, kin, exp = targetResistProfileRow
resistsProfile = eos.db.eos.db.getTargetResists(name)
if resistsProfile is None:
resistsProfile = es_TargetResists(em, therm, kin, exp)
resistsProfile.name = name
eos.db.save(resistsProfile)
@classmethod
def importRequiredDefaults(cls):
damageProfileList = [["Uniform", "25", "25", "25", "25"]]
for damageProfileRow in damageProfileList:
name, em, therm, kin, exp = damageProfileRow
damageProfile = eos.db.getDamagePattern(name)
if damageProfile is None:
damageProfile = es_DamagePattern(em, therm, kin, exp)
damageProfile.name = name
eos.db.save(damageProfile)

View File

@@ -42,6 +42,7 @@ modules_table = Table("modules", saveddata_meta,
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now),
Column("spoolType", Integer, nullable=True),
Column("spoolAmount", Float, nullable=True),
Column("projectionRange", Float, nullable=True),
CheckConstraint('("dummySlot" = NULL OR "itemID" = NULL) AND "dummySlot" != "itemID"'))
mapper(Module, modules_table,

View File

@@ -24,16 +24,16 @@ from sqlalchemy import desc, select
from sqlalchemy import func
from eos.db import saveddata_session, sd_lock
from eos.db.saveddata.fit import projectedFits_table
from eos.db.saveddata.fit import fits_table, projectedFits_table
from eos.db.util import processEager, processWhere
from eos.saveddata.price import Price
from eos.saveddata.user import User
from eos.saveddata.ssocharacter import SsoCharacter
from eos.saveddata.damagePattern import DamagePattern
from eos.saveddata.targetResists import TargetResists
from eos.saveddata.targetProfile import TargetProfile
from eos.saveddata.character import Character
from eos.saveddata.implantSet import ImplantSet
from eos.saveddata.fit import Fit
from eos.saveddata.fit import Fit, FitLite
from eos.saveddata.module import Module
from eos.saveddata.miscData import MiscData
from eos.saveddata.override import Override
@@ -326,6 +326,17 @@ def getFitList(eager=None):
return fits
def getFitListLite():
with sd_lock:
stmt = select([fits_table.c.ID, fits_table.c.name, fits_table.c.shipID])
data = eos.db.saveddata_session.execute(stmt).fetchall()
fits = []
for fitID, fitName, shipID in data:
fit = FitLite(id=fitID, name=fitName, shipID=shipID)
fits.append(fit)
return fits
@cachedQuery(Price, 1, "typeID")
def getPrice(typeID):
if isinstance(typeID, int):
@@ -366,16 +377,16 @@ def clearDamagePatterns():
return deleted_rows
def getTargetResistsList(eager=None):
def getTargetProfileList(eager=None):
eager = processEager(eager)
with sd_lock:
patterns = saveddata_session.query(TargetResists).options(*eager).all()
patterns = saveddata_session.query(TargetProfile).options(*eager).all()
return patterns
def clearTargetResists():
def clearTargetProfiles():
with sd_lock:
deleted_rows = saveddata_session.query(TargetResists).delete()
deleted_rows = saveddata_session.query(TargetProfile).delete()
commit()
return deleted_rows
@@ -402,28 +413,28 @@ def getDamagePattern(lookfor, eager=None):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(DamagePattern).options(*eager).filter(
DamagePattern.name == lookfor).first()
DamagePattern.rawName == lookfor).first()
else:
raise TypeError("Need integer or string as argument")
return pattern
@cachedQuery(TargetResists, 1, "lookfor")
def getTargetResists(lookfor, eager=None):
@cachedQuery(TargetProfile, 1, "lookfor")
def getTargetProfile(lookfor, eager=None):
if isinstance(lookfor, int):
if eager is None:
with sd_lock:
pattern = saveddata_session.query(TargetResists).get(lookfor)
pattern = saveddata_session.query(TargetProfile).get(lookfor)
else:
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
TargetResists.ID == lookfor).first()
pattern = saveddata_session.query(TargetProfile).options(*eager).filter(
TargetProfile.ID == lookfor).first()
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(TargetResists).options(*eager).filter(
TargetResists.name == lookfor).first()
pattern = saveddata_session.query(TargetProfile).options(*eager).filter(
TargetProfile.rawName == lookfor).first()
else:
raise TypeError("Need integer or string as argument")
return pattern
@@ -439,11 +450,11 @@ def getImplantSet(lookfor, eager=None):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(
TargetResists.ID == lookfor).first()
TargetProfile.ID == lookfor).first()
elif isinstance(lookfor, str):
eager = processEager(eager)
with sd_lock:
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(TargetResists.name == lookfor).first()
pattern = saveddata_session.query(ImplantSet).options(*eager).filter(TargetProfile.name == lookfor).first()
else:
raise TypeError("Improper argument")
return pattern
@@ -459,7 +470,7 @@ def searchFits(nameLike, where=None, eager=None):
filter = processWhere(Fit.name.like(nameLike, escape="\\"), where)
eager = processEager(eager)
with sd_lock:
fits = removeInvalid(saveddata_session.query(Fit).options(*eager).filter(filter).all())
fits = removeInvalid(saveddata_session.query(Fit).options(*eager).filter(filter).limit(100).all())
return fits
@@ -549,6 +560,8 @@ def commit():
with sd_lock:
try:
saveddata_session.commit()
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
saveddata_session.rollback()
exc_info = sys.exc_info()
@@ -559,6 +572,8 @@ def flush():
with sd_lock:
try:
saveddata_session.flush()
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
saveddata_session.rollback()
exc_info = sys.exc_info()

View File

@@ -22,18 +22,30 @@ from sqlalchemy.orm import mapper
import datetime
from eos.db import saveddata_meta
from eos.saveddata.targetResists import TargetResists
from eos.saveddata.targetProfile import TargetProfile
targetResists_table = Table("targetResists", saveddata_meta,
Column("ID", Integer, primary_key=True),
Column("name", String),
Column("emAmount", Float),
Column("thermalAmount", Float),
Column("kineticAmount", Float),
Column("explosiveAmount", Float),
Column("ownerID", ForeignKey("users.ID"), nullable=True),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),
Column("modified", DateTime, nullable=True, onupdate=datetime.datetime.now)
)
mapper(TargetResists, targetResists_table)
targetProfiles_table = Table(
'targetResists',
saveddata_meta,
Column('ID', Integer, primary_key=True),
Column('name', String),
Column('emAmount', Float),
Column('thermalAmount', Float),
Column('kineticAmount', Float),
Column('explosiveAmount', Float),
Column('maxVelocity', Float, nullable=True),
Column('signatureRadius', Float, nullable=True),
Column('radius', Float, nullable=True),
Column('ownerID', ForeignKey('users.ID'), nullable=True),
Column('created', DateTime, nullable=True, default=datetime.datetime.now),
Column('modified', DateTime, nullable=True, onupdate=datetime.datetime.now))
mapper(
TargetProfile,
targetProfiles_table,
properties={
'rawName': targetProfiles_table.c.name,
'_maxVelocity': targetProfiles_table.c.maxVelocity,
'_signatureRadius': targetProfiles_table.c.signatureRadius,
'_radius': targetProfiles_table.c.radius})

View File

@@ -19,6 +19,7 @@
from logbook import Logger
from sqlalchemy.orm.collections import collection
pyfalog = Logger(__name__)
@@ -138,9 +139,10 @@ class HandledModuleList(HandledList):
else:
self.appendIgnoreEmpty(mod)
@collection.appender
def appendIgnoreEmpty(self, mod):
mod.position = len(self)
HandledList.append(self, mod)
super().append(mod)
if mod.isInvalid:
self.remove(mod)
@@ -394,7 +396,7 @@ class HandledProjectedDroneList(HandledDroneCargoList):
proj.projected = False
class HandledItem(object):
class HandledItem:
def preAssignItemAttr(self, *args, **kwargs):
self.itemModifiedAttributes.preAssign(*args, **kwargs)
@@ -411,7 +413,7 @@ class HandledItem(object):
self.itemModifiedAttributes.force(*args, **kwargs)
class HandledCharge(object):
class HandledCharge:
def preAssignChargeAttr(self, *args, **kwargs):
self.chargeModifiedAttributes.preAssign(*args, **kwargs)

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@
# ===============================================================================
class EqBase(object):
class EqBase:
ID = None
def __eq__(self, other):

View File

@@ -18,6 +18,7 @@
# ===============================================================================
import json
from collections import OrderedDict
from logbook import Logger
@@ -145,6 +146,12 @@ class Effect(EqBase):
return self.__effectDef is not None
@property
def dealsDamage(self):
if not self.__generated:
self.__generateHandler()
return self.__dealsDamage
def isType(self, type):
"""
Check if this effect is of the passed type
@@ -166,6 +173,7 @@ class Effect(EqBase):
self.__handler = getattr(effectDef, "handler", eos.effects.BaseEffect.handler)
self.__runTime = getattr(effectDef, "runTime", "normal")
self.__activeByDefault = getattr(effectDef, "activeByDefault", True)
self.__dealsDamage = effectDef.dealsDamage
effectType = getattr(effectDef, "type", None)
effectType = effectType if isinstance(effectType, tuple) or effectType is None else (effectType,)
self.__type = effectType
@@ -174,6 +182,7 @@ class Effect(EqBase):
self.__handler = eos.effects.DummyEffect.handler
self.__runTime = "normal"
self.__activeByDefault = True
self.__dealsDamage = False
self.__type = None
pyfalog.debug("ImportError generating handler: {0}", e)
except AttributeError as e:
@@ -181,12 +190,16 @@ class Effect(EqBase):
self.__handler = eos.effects.DummyEffect.handler
self.__runTime = "normal"
self.__activeByDefault = True
self.__dealsDamage = False
self.__type = None
pyfalog.error("AttributeError generating handler: {0}", e)
except (KeyboardInterrupt, SystemExit):
raise
except Exception as e:
self.__handler = eos.effects.DummyEffect.handler
self.__runTime = "normal"
self.__activeByDefault = True
self.__dealsDamage = False
self.__type = None
pyfalog.critical("Exception generating handler:")
pyfalog.critical(e)
@@ -199,55 +212,41 @@ class Effect(EqBase):
try:
return self.__effectDef.get(key, None)
except (KeyboardInterrupt, SystemExit):
raise
except:
return getattr(self.__effectDef, key, None)
class Item(EqBase):
MOVE_ATTRS = (4, # Mass
38, # Capacity
161) # Volume
MOVE_ATTR_INFO = None
ABYSSAL_TYPES = None
@classmethod
def getMoveAttrInfo(cls):
info = getattr(cls, "MOVE_ATTR_INFO", None)
if info is None:
cls.MOVE_ATTR_INFO = info = []
for id in cls.MOVE_ATTRS:
info.append(eos.db.getAttributeInfo(id))
return info
def moveAttrs(self):
self.__moved = True
for info in self.getMoveAttrInfo():
val = getattr(self, info.name, 0)
if val != 0:
attr = Attribute()
attr.info = info
attr.value = val
self.__attributes[info.name] = attr
@reconstructor
def init(self):
self.__race = None
self.__requiredSkills = None
self.__requiredFor = None
self.__moved = False
self.__offensive = None
self.__assistive = None
self.__overrides = None
self.__priceObj = None
def getShortName(self, charLimit=12):
if len(self.name) <= charLimit:
return self.name
splitName = self.name.strip().split(' ')
if len(splitName) == 1:
return self.name
shortName = ''
for word in splitName:
try:
shortName += word[0].capitalize()
except IndexError:
pass
return shortName
@property
def attributes(self):
if not self.__moved:
self.moveAttrs()
return self.__attributes
@property
@@ -300,50 +299,26 @@ class Item(EqBase):
eos.db.saveddata_session.delete(override)
eos.db.commit()
srqIDMap = {182: 277, 183: 278, 184: 279, 1285: 1286, 1289: 1287, 1290: 1288}
@property
def requiredSkills(self):
if self.__requiredSkills is None:
requiredSkills = OrderedDict()
self.__requiredSkills = requiredSkills
# Map containing attribute IDs we may need for required skills
# { requiredSkillX : requiredSkillXLevel }
combinedAttrIDs = set(self.srqIDMap.keys()).union(set(self.srqIDMap.values()))
# Map containing result of the request
# { attributeID : attributeValue }
skillAttrs = {}
# Get relevant attribute values from db (required skill IDs and levels) for our item
for attrInfo in eos.db.directAttributeRequest((self.ID,), tuple(combinedAttrIDs)):
attrID = attrInfo[1]
attrVal = attrInfo[2]
skillAttrs[attrID] = attrVal
# Go through all attributeID pairs
for srqIDAtrr, srqLvlAttr in self.srqIDMap.items():
# Check if we have both in returned result
if srqIDAtrr in skillAttrs and srqLvlAttr in skillAttrs:
skillID = int(skillAttrs[srqIDAtrr])
skillLvl = skillAttrs[srqLvlAttr]
# Fetch item from database and fill map
item = eos.db.getItem(skillID)
requiredSkills[item] = skillLvl
self.__requiredSkills = {}
if self.reqskills:
for skillTypeID, skillLevel in json.loads(self.reqskills).items():
skillItem = eos.db.getItem(int(skillTypeID))
if skillItem:
self.__requiredSkills[skillItem] = skillLevel
return self.__requiredSkills
@property
def requiredFor(self):
if self.__requiredFor is None:
self.__requiredFor = dict()
# Map containing attribute IDs we may need for required skills
# Get relevant attribute values from db (required skill IDs and levels) for our item
q = eos.db.getRequiredFor(self.ID, self.srqIDMap)
for itemID, lvl in q:
# Fetch item from database and fill map
item = eos.db.getItem(itemID)
self.__requiredFor[item] = lvl
self.__requiredFor = {}
if self.requiredfor:
for typeID, skillLevel in json.loads(self.requiredfor).items():
requiredForItem = eos.db.getItem(int(typeID))
if requiredForItem:
self.__requiredFor[requiredForItem] = skillLevel
return self.__requiredFor
factionMap = {
@@ -359,7 +334,8 @@ class Item(EqBase):
500016: "sisters",
500018: "mordu",
500019: "sansha",
500020: "serpentis"
500020: "serpentis",
500026: "triglavian"
}
@property
@@ -367,7 +343,11 @@ class Item(EqBase):
if self.__race is None:
try:
if self.category.categoryName == 'Structure':
if (
self.category.categoryName == 'Structure' or
# Here until CCP puts their shit together
self.name in ("Thunderchild", "Stormbringer", "Skybreaker")
):
self.__race = "upwell"
else:
self.__race = self.factionMap[self.factionID]
@@ -385,6 +365,7 @@ class Item(EqBase):
9 : "guristas", # Caldari + Gallente
10 : "angelserp", # Minmatar + Gallente, final race depends on the order of skills
12 : "sisters", # Amarr + Gallente
15 : "concord",
16 : "jove",
32 : "sansha", # Incrusion Sansha
128: "ore",
@@ -516,6 +497,14 @@ class Item(EqBase):
def isBooster(self):
return self.group.name == 'Booster' and self.category.name == 'Implant'
@property
def isStandup(self):
if self.category.name == "Structure Module":
return True
if self.isFighter and {'fighterSquadronIsStandupLight', 'fighterSquadronIsStandupHeavy', 'fighterSquadronIsStandupSupport'}.intersection(self.attributes):
return True
return False
def __repr__(self):
return "Item(ID={}, name={}) at {}".format(
self.ID, self.name, hex(id(self))
@@ -580,18 +569,13 @@ class DynamicItemItem(EqBase):
class MarketGroup(EqBase):
def __repr__(self):
return "MarketGroup(ID={}, name={}, parent={}) at {}".format(
self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self))
)
self.ID, self.name, getattr(self.parent, "name", None), hex(id(self)))
class MetaGroup(EqBase):
pass
class MetaType(EqBase):
pass
class Unit(EqBase):
def __init__(self):
@@ -723,5 +707,15 @@ class Unit(EqBase):
return value
class Traits(EqBase):
pass
class ImplantSet(EqBase):
@property
def fullName(self):
if not self.gradeName:
return self.setName
return '{} {}'.format(self.gradeName, self.setName)

View File

@@ -1,121 +0,0 @@
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import itertools
class Graph(object):
def __init__(self, fit, function, data=None):
self.fit = fit
self.data = {}
if data is not None:
for name, d in data.items():
self.setData(Data(name, d))
self.function = function
def clearData(self):
self.data.clear()
def setData(self, data):
self.data[data.name] = data
def getIterator(self):
pointNames = []
pointIterators = []
for data in self.data.values():
pointNames.append(data.name)
pointIterators.append(data)
return self._iterator(pointNames, pointIterators)
def _iterator(self, pointNames, pointIterators):
for pointValues in itertools.product(*pointIterators):
point = {}
for i in range(len(pointValues)):
point[pointNames[i]] = pointValues[i]
yield point, self.function(point)
class Data(object):
def __init__(self, name, dataString, step=None):
self.name = name
self.step = step
self.data = self.parseString(dataString)
def parseString(self, dataString):
if not isinstance(dataString, str):
return Constant(dataString),
dataList = []
for data in dataString.split(";"):
if isinstance(data, str) and "-" in data:
# Dealing with a range
dataList.append(Range(data, self.step))
else:
dataList.append(Constant(data))
return dataList
def __iter__(self):
for data in self.data:
for value in data:
yield value
def isConstant(self):
return len(self.data) == 1 and self.data[0].isConstant()
class Constant(object):
def __init__(self, const):
if isinstance(const, str):
self.value = None if const == "" else float(const)
else:
self.value = const
def __iter__(self):
yield self.value
@staticmethod
def isConstant():
return True
class Range(object):
def __init__(self, string, step):
start, end = string.split("-")
self.start = float(start)
self.end = float(end)
self.step = step
def __iter__(self):
current = start = self.start
end = self.end
step = self.step or (end - start) / 50.0
i = 1
while current < end:
current = start + i * step
i += 1
yield current
@staticmethod
def isConstant():
return False

View File

@@ -1,43 +0,0 @@
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from logbook import Logger
from eos.graph import Graph
from eos.utils.spoolSupport import SpoolType, SpoolOptions
pyfalog = Logger(__name__)
class FitDmgTimeGraph(Graph):
defaults = {"time": 0}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults)
self.fit = fit
def calcDps(self, data):
fit = self.fit
time = data["time"]
dmg = 0
for i in range(round(time) + 1):
dmg += fit.getTotalDps(spoolOptions=SpoolOptions(SpoolType.TIME, i, True)).total
return dmg

View File

@@ -1,200 +0,0 @@
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from math import exp, log, radians, sin
from logbook import Logger
from eos.const import FittingHardpoint, FittingModuleState
from eos.graph import Graph
pyfalog = Logger(__name__)
class FitDpsRangeGraph(Graph):
defaults = {
"angle" : 0,
"distance" : 0,
"signatureRadius": None,
"velocity" : 0
}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcDps, data if data is not None else self.defaults)
self.fit = fit
def calcDps(self, data):
ew = {'signatureRadius': [], 'velocity': []}
fit = self.fit
total = 0
distance = data["distance"] * 1000
abssort = lambda _val: -abs(_val - 1)
for mod in fit.modules:
if not mod.isEmpty and mod.state >= FittingModuleState.ACTIVE:
if "remoteTargetPaintFalloff" in mod.item.effects or "structureModuleEffectTargetPainter" in mod.item.effects:
ew['signatureRadius'].append(
1 + (mod.getModifiedItemAttr("signatureRadiusBonus") / 100) * self.calculateModuleMultiplier(
mod, data))
if "remoteWebifierFalloff" in mod.item.effects or "structureModuleEffectStasisWebifier" in mod.item.effects:
if distance <= mod.getModifiedItemAttr("maxRange"):
ew['velocity'].append(1 + (mod.getModifiedItemAttr("speedFactor") / 100))
elif mod.getModifiedItemAttr("falloffEffectiveness") > 0:
# I am affected by falloff
ew['velocity'].append(
1 + (mod.getModifiedItemAttr("speedFactor") / 100) * self.calculateModuleMultiplier(mod,
data))
ew['signatureRadius'].sort(key=abssort)
ew['velocity'].sort(key=abssort)
for attr, values in ew.items():
val = data[attr]
try:
for i in range(len(values)):
bonus = values[i]
val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289)
data[attr] = val
except Exception as e:
pyfalog.critical("Caught exception in calcDPS.")
pyfalog.critical(e)
for mod in fit.modules:
dps = mod.getDps(targetResists=fit.targetResists).total
if mod.hardpoint == FittingHardpoint.TURRET:
if mod.state >= FittingModuleState.ACTIVE:
total += dps * self.calculateTurretMultiplier(mod, data)
elif mod.hardpoint == FittingHardpoint.MISSILE:
if mod.state >= FittingModuleState.ACTIVE and mod.maxRange is not None and mod.maxRange >= distance:
total += dps * self.calculateMissileMultiplier(mod, data)
if distance <= fit.extraAttributes["droneControlRange"]:
for drone in fit.drones:
multiplier = 1 if drone.getModifiedItemAttr("maxVelocity") > 1 else self.calculateTurretMultiplier(
drone, data)
dps = drone.getDps(targetResists=fit.targetResists).total
total += dps * multiplier
# this is janky as fuck
for fighter in fit.fighters:
if not fighter.active:
continue
fighterDpsMap = fighter.getDpsPerEffect(targetResists=fit.targetResists)
for ability in fighter.abilities:
if ability.dealsDamage and ability.active:
if ability.effectID not in fighterDpsMap:
continue
multiplier = self.calculateFighterMissileMultiplier(ability, data)
dps = fighterDpsMap[ability.effectID].total
total += dps * multiplier
return total
@staticmethod
def calculateMissileMultiplier(mod, data):
targetSigRad = data["signatureRadius"]
targetVelocity = data["velocity"]
explosionRadius = mod.getModifiedChargeAttr("aoeCloudSize")
targetSigRad = explosionRadius if targetSigRad is None else targetSigRad
explosionVelocity = mod.getModifiedChargeAttr("aoeVelocity")
damageReductionFactor = mod.getModifiedChargeAttr("aoeDamageReductionFactor")
sigRadiusFactor = targetSigRad / explosionRadius
if targetVelocity:
velocityFactor = (explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** damageReductionFactor
else:
velocityFactor = 1
return min(sigRadiusFactor, velocityFactor, 1)
def calculateTurretMultiplier(self, mod, data):
# Source for most of turret calculation info: http://wiki.eveonline.com/en/wiki/Falloff
chanceToHit = self.calculateTurretChanceToHit(mod, data)
if chanceToHit > 0.01:
# AvgDPS = Base Damage * [ ( ChanceToHit^2 + ChanceToHit + 0.0499 ) / 2 ]
multiplier = (chanceToHit ** 2 + chanceToHit + 0.0499) / 2
else:
# All hits are wreckings
multiplier = chanceToHit * 3
dmgScaling = mod.getModifiedItemAttr("turretDamageScalingRadius")
if dmgScaling:
targetSigRad = data["signatureRadius"]
multiplier = min(1, (float(targetSigRad) / dmgScaling) ** 2)
return multiplier
@staticmethod
def calculateFighterMissileMultiplier(ability, data):
prefix = ability.attrPrefix
targetSigRad = data["signatureRadius"]
targetVelocity = data["velocity"]
explosionRadius = ability.fighter.getModifiedItemAttr("{}ExplosionRadius".format(prefix))
explosionVelocity = ability.fighter.getModifiedItemAttr("{}ExplosionVelocity".format(prefix))
damageReductionFactor = ability.fighter.getModifiedItemAttr("{}ReductionFactor".format(prefix), None)
# the following conditionals are because CCP can't keep a decent naming convention, as if fighter implementation
# wasn't already fucked.
if damageReductionFactor is None:
damageReductionFactor = ability.fighter.getModifiedItemAttr("{}DamageReductionFactor".format(prefix))
damageReductionSensitivity = ability.fighter.getModifiedItemAttr("{}ReductionSensitivity".format(prefix), None)
if damageReductionSensitivity is None:
damageReductionSensitivity = ability.fighter.getModifiedItemAttr(
"{}DamageReductionSensitivity".format(prefix))
targetSigRad = explosionRadius if targetSigRad is None else targetSigRad
sigRadiusFactor = targetSigRad / explosionRadius
if targetVelocity:
velocityFactor = (explosionVelocity / explosionRadius * targetSigRad / targetVelocity) ** (
log(damageReductionFactor) / log(damageReductionSensitivity))
else:
velocityFactor = 1
return min(sigRadiusFactor, velocityFactor, 1)
@staticmethod
def calculateTurretChanceToHit(mod, data):
distance = data["distance"] * 1000
tracking = mod.getModifiedItemAttr("trackingSpeed")
turretOptimal = mod.maxRange
turretFalloff = mod.falloff
turretSigRes = mod.getModifiedItemAttr("optimalSigRadius")
targetSigRad = data["signatureRadius"]
targetSigRad = turretSigRes if targetSigRad is None else targetSigRad
transversal = sin(radians(data["angle"])) * data["velocity"]
trackingEq = (((transversal / (distance * tracking)) *
(turretSigRes / targetSigRad)) ** 2)
rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2
return 0.5 ** (trackingEq + rangeEq)
@staticmethod
def calculateModuleMultiplier(mod, data):
# Simplified formula, we make some assumptions about the module
# This is basically the calculateTurretChanceToHit without tracking values
distance = data["distance"] * 1000
turretOptimal = mod.maxRange
turretFalloff = mod.falloff
rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2
return 0.5 ** rangeEq

View File

@@ -17,50 +17,90 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import collections
from collections.abc import MutableMapping
from copy import copy
from math import exp
from eos.const import Operator
# TODO: This needs to be moved out, we shouldn't have *ANY* dependencies back to other modules/methods inside eos.
# This also breaks writing any tests. :(
from eos.db.gamedata.queries import getAttributeInfo
defaultValuesCache = {}
cappingAttrKeyCache = {}
resistanceCache = {}
class ItemAttrShortcut(object):
def getAttrDefault(key, fallback=None):
try:
default = defaultValuesCache[key]
except KeyError:
attrInfo = getAttributeInfo(key)
if attrInfo is None:
default = defaultValuesCache[key] = None
else:
default = defaultValuesCache[key] = attrInfo.defaultValue
if default is None:
default = fallback
return default
def getResistanceAttrID(modifyingItem, effect):
# If it doesn't exist on the effect, check the modifying module's attributes.
# If it's there, cache it and return
if effect.resistanceID:
return effect.resistanceID
cacheKey = (modifyingItem.item.ID, effect.ID)
try:
return resistanceCache[cacheKey]
except KeyError:
attrPrefix = effect.getattr('prefix')
if attrPrefix:
resistanceID = int(modifyingItem.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))) or None
if not resistanceID:
resistanceID = int(modifyingItem.getModifiedItemAttr('{}RemoteResistanceID'.format(attrPrefix))) or None
else:
resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None
resistanceCache[cacheKey] = resistanceID
return resistanceID
class ItemAttrShortcut:
def getModifiedItemAttr(self, key, default=0):
return_value = self.itemModifiedAttributes.get(key)
return return_value or default
def getModifiedItemAttrExtended(self, key, extraMultipliers=None, ignoreAfflictors=(), default=0):
return_value = self.itemModifiedAttributes.getExtended(key, extraMultipliers=extraMultipliers, ignoreAfflictors=ignoreAfflictors)
return return_value or default
def getItemBaseAttrValue(self, key, default=0):
"""
Gets base value in this order:
Mutated value > override value > attribute value
"""
return_value = self.itemModifiedAttributes.getOriginal(key)
return return_value or default
class ChargeAttrShortcut:
def getModifiedChargeAttr(self, key, default=0):
return_value = self.chargeModifiedAttributes.get(key)
return return_value or default
def getModifiedChargeAttrExtended(self, key, extraMultipliers=None, ignoreAfflictors=(), default=0):
return_value = self.chargeModifiedAttributes.getExtended(key, extraMultipliers=extraMultipliers, ignoreAfflictors=ignoreAfflictors)
return return_value or default
def getChargeBaseAttrValue(self, key, default=0):
"""
Gets base value in this order:
Mutated value > override value > attribute value
"""
return_value = self.chargeModifiedAttributes.getOriginal(key)
return return_value or default
class ChargeAttrShortcut(object):
def getModifiedChargeAttr(self, key, default=0):
return_value = self.chargeModifiedAttributes.get(key)
return return_value or default
class ModifiedAttributeDict(collections.MutableMapping):
class ModifiedAttributeDict(MutableMapping):
overrides_enabled = False
class CalculationPlaceholder(object):
class CalculationPlaceholder:
def __init__(self):
pass
@@ -74,6 +114,10 @@ class ModifiedAttributeDict(collections.MutableMapping):
# Final modified values
self.__modified = {}
# Affected by entities
# Format:
# {attr name: {modifying fit: (
# modifying item, operation, stacking group, pre-resist amount,
# post-resist amount, affects result or not)}}
self.__affectedBy = {}
# Overrides (per item)
self.__overrides = {}
@@ -144,24 +188,74 @@ class ModifiedAttributeDict(collections.MutableMapping):
def __getitem__(self, key):
# Check if we have final calculated value
key_value = self.__modified.get(key)
if key_value is self.CalculationPlaceholder:
key_value = self.__modified[key] = self.__calculateValue(key)
if key_value is not None:
return key_value
val = self.__modified.get(key)
if val is self.CalculationPlaceholder:
val = self.__modified[key] = self.__calculateValue(key)
if val is not None:
return val
# Then in values which are not yet calculated
if self.__intermediary:
val = self.__intermediary.get(key)
else:
val = None
if val is not None:
return val
# Original value is the least priority
return self.getOriginal(key)
def getExtended(self, key, extraMultipliers=None, ignoreAfflictors=None, default=0):
"""
Here we consider couple of parameters. If they affect final result, we do
not store result, and if they are - we do.
"""
# Here we do not have support for preAssigns/forceds, as doing them would
# mean that we have to store all of them in a list which increases memory use,
# and we do not actually need those operators atm
preIncreaseAdjustment = 0
multiplierAdjustment = 1
ignorePenalizedMultipliers = {}
postIncreaseAdjustment = 0
for fit, afflictors in self.getAfflictions(key).items():
for afflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors:
if afflictor in ignoreAfflictors:
if operator == Operator.MULTIPLY:
if stackingGroup is None:
multiplierAdjustment /= postResAmount
else:
ignorePenalizedMultipliers.setdefault(stackingGroup, []).append(postResAmount)
elif operator == Operator.PREINCREASE:
preIncreaseAdjustment -= postResAmount
elif operator == Operator.POSTINCREASE:
postIncreaseAdjustment -= postResAmount
# If we apply no customizations - use regular getter
if (
not extraMultipliers and
preIncreaseAdjustment == 0 and multiplierAdjustment == 1 and
postIncreaseAdjustment == 0 and len(ignorePenalizedMultipliers) == 0
):
return self.get(key, default=default)
# Try to calculate custom values
val = self.__calculateValue(
key, extraMultipliers=extraMultipliers, preIncAdj=preIncreaseAdjustment, multAdj=multiplierAdjustment,
postIncAdj=postIncreaseAdjustment, ignorePenMult=ignorePenalizedMultipliers)
if val is not None:
return val
# Then the same fallbacks as in regular getter
if self.__intermediary:
val = self.__intermediary.get(key)
else:
# Original value is the least priority
return self.getOriginal(key)
val = None
if val is not None:
return val
val = self.getOriginal(key)
if val is not None:
return val
return default
def __delitem__(self, key):
if key in self.__modified:
@@ -181,6 +275,9 @@ class ModifiedAttributeDict(collections.MutableMapping):
if self.original:
val = self.original.get(key, val)
if val is None:
val = getAttrDefault(key, fallback=None)
if val is None and val != default:
val = default
@@ -208,7 +305,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
keys.update(iter(self.__intermediary.keys()))
return len(keys)
def __calculateValue(self, key):
def __calculateValue(self, key, extraMultipliers=None, preIncAdj=None, multAdj=None, postIncAdj=None, ignorePenMult=None):
# It's possible that various attributes are capped by other attributes,
# it's defined by reference maxAttributeID
try:
@@ -245,29 +342,52 @@ class ModifiedAttributeDict(collections.MutableMapping):
preIncrease = self.__preIncreases.get(key, 0)
multiplier = self.__multipliers.get(key, 1)
penalizedMultiplierGroups = self.__penalizedMultipliers.get(key, {})
# Add extra multipliers to the group, not modifying initial data source
if extraMultipliers is not None:
penalizedMultiplierGroups = copy(penalizedMultiplierGroups)
for stackGroup, operationsData in extraMultipliers.items():
multipliers = []
for mult, resAttrID in operationsData:
if not resAttrID:
multipliers.append(mult)
continue
resAttrInfo = getAttributeInfo(resAttrID)
if not resAttrInfo:
multipliers.append(mult)
continue
resMult = self.fit.ship.itemModifiedAttributes[resAttrInfo.attributeName]
if resMult is None or resMult == 1:
multipliers.append(mult)
continue
mult = (mult - 1) * resMult + 1
multipliers.append(mult)
penalizedMultiplierGroups[stackGroup] = penalizedMultiplierGroups.get(stackGroup, []) + multipliers
postIncrease = self.__postIncreases.get(key, 0)
# Grab initial value, priorities are:
# Results of ongoing calculation > preAssign > original > 0
try:
default = defaultValuesCache[key]
except KeyError:
attrInfo = getAttributeInfo(key)
if attrInfo is None:
default = defaultValuesCache[key] = 0.0
else:
dv = attrInfo.defaultValue
default = defaultValuesCache[key] = dv if dv is not None else 0.0
default = getAttrDefault(key, fallback=0.0)
val = self.__intermediary.get(key, self.__preAssigns.get(key, self.getOriginal(key, default)))
# We'll do stuff in the following order:
# preIncrease > multiplier > stacking penalized multipliers > postIncrease
val += preIncrease
if preIncAdj is not None:
val += preIncAdj
val *= multiplier
if multAdj is not None:
val *= multAdj
# Each group is penalized independently
# Things in different groups will not be stack penalized between each other
for penalizedMultipliers in penalizedMultiplierGroups.values():
for penaltyGroup, penalizedMultipliers in penalizedMultiplierGroups.items():
if ignorePenMult is not None and penaltyGroup in ignorePenMult:
# Avoid modifying source and remove multipliers we were asked to remove for this calc
penalizedMultipliers = penalizedMultipliers[:]
for ignoreMult in ignorePenMult[penaltyGroup]:
try:
penalizedMultipliers.remove(ignoreMult)
except ValueError:
pass
# A quick explanation of how this works:
# 1: Bonuses and penalties are calculated seperately, so we'll have to filter each of them
l1 = [_val for _val in penalizedMultipliers if _val > 1]
@@ -285,6 +405,8 @@ class ModifiedAttributeDict(collections.MutableMapping):
bonus = l[i]
val *= 1 + (bonus - 1) * exp(- i ** 2 / 7.1289)
val += postIncrease
if postIncAdj is not None:
val += postIncAdj
# Cap value if we have cap defined
if cappingValue is not None:
@@ -311,7 +433,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
def iterAfflictions(self):
return self.__affectedBy.__iter__()
def __afflict(self, attributeName, operation, bonus, used=True):
def __afflict(self, attributeName, operator, stackingGroup, preResAmount, postResAmount, used=True):
"""Add modifier to list of things affecting current item"""
# Do nothing if no fit is assigned
fit = self.fit
@@ -337,13 +459,13 @@ class ModifiedAttributeDict(collections.MutableMapping):
modifier = fit.getModifier()
# Add current affliction to list
affs.append((modifier, operation, bonus, used))
affs.append((modifier, operator, stackingGroup, preResAmount, postResAmount, used))
def preAssign(self, attributeName, value):
def preAssign(self, attributeName, value, **kwargs):
"""Overwrites original value of the entity with given one, allowing further modification"""
self.__preAssigns[attributeName] = value
self.__placehold(attributeName)
self.__afflict(attributeName, "=", value, value != self.getOriginal(attributeName))
self.__afflict(attributeName, Operator.PREASSIGN, None, value, value, value != self.getOriginal(attributeName))
def increase(self, attributeName, increase, position="pre", skill=None, **kwargs):
"""Increase value of given attribute by given number"""
@@ -356,8 +478,10 @@ class ModifiedAttributeDict(collections.MutableMapping):
# Increases applied before multiplications and after them are
# written in separate maps
if position == "pre":
operator = Operator.PREINCREASE
tbl = self.__preIncreases
elif position == "post":
operator = Operator.POSTINCREASE
tbl = self.__postIncreases
else:
raise ValueError("position should be either pre or post")
@@ -365,9 +489,9 @@ class ModifiedAttributeDict(collections.MutableMapping):
tbl[attributeName] = 0
tbl[attributeName] += increase
self.__placehold(attributeName)
self.__afflict(attributeName, "+", increase, increase != 0)
self.__afflict(attributeName, operator, None, increase, increase, increase != 0)
def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, resist=True, *args, **kwargs):
def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, **kwargs):
"""Multiply value of given attribute by given factor"""
if multiplier is None: # See GH issue 397
return
@@ -375,6 +499,15 @@ class ModifiedAttributeDict(collections.MutableMapping):
if skill:
multiplier *= self.__handleSkill(skill)
preResMultiplier = multiplier
resisted = False
# Goddammit CCP, make up your mind where you want this information >.< See #1139
if 'effect' in kwargs:
resistFactor = ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1
if resistFactor != 1:
resisted = True
multiplier = (multiplier - 1) * resistFactor + 1
# If we're asked to do stacking penalized multiplication, append values
# to per penalty group lists
if stackingPenalties:
@@ -395,53 +528,46 @@ class ModifiedAttributeDict(collections.MutableMapping):
afflictPenal = ""
if stackingPenalties:
afflictPenal += "s"
if resist:
if resisted:
afflictPenal += "r"
self.__afflict(attributeName, "%s*" % afflictPenal, multiplier, multiplier != 1)
self.__afflict(
attributeName, Operator.MULTIPLY, penaltyGroup if stackingPenalties else None,
preResMultiplier, multiplier, multiplier != 1)
def boost(self, attributeName, boostFactor, skill=None, *args, **kwargs):
def boost(self, attributeName, boostFactor, skill=None, **kwargs):
"""Boost value by some percentage"""
if skill:
boostFactor *= self.__handleSkill(skill)
resist = None
# Goddammit CCP, make up your mind where you want this information >.< See #1139
if 'effect' in kwargs:
resist = ModifiedAttributeDict.getResistance(self.fit, kwargs['effect']) or 1
boostFactor *= resist
# We just transform percentage boost into multiplication factor
self.multiply(attributeName, 1 + boostFactor / 100.0, resist=(True if resist else False), *args, **kwargs)
self.multiply(attributeName, 1 + boostFactor / 100.0, **kwargs)
def force(self, attributeName, value):
def force(self, attributeName, value, **kwargs):
"""Force value to attribute and prohibit any changes to it"""
self.__forced[attributeName] = value
self.__placehold(attributeName)
self.__afflict(attributeName, "\u2263", value)
self.__afflict(attributeName, Operator.FORCE, None, value, value)
@staticmethod
def getResistance(fit, effect):
remoteResistID = effect.resistanceID
# If it doesn't exist on the effect, check the modifying modules attributes. If it's there, set it on the
# effect for this session so that we don't have to look here again (won't always work when it's None, but
# will catch most)
# Resistances are applicable only to projected effects
if isinstance(effect.type, (tuple, list)):
effectType = effect.type
else:
effectType = (effect.type,)
if 'projected' not in effectType:
return 1
remoteResistID = getResistanceAttrID(modifyingItem=fit.getModifier(), effect=effect)
if not remoteResistID:
mod = fit.getModifier()
effect.resistanceID = int(mod.getModifiedItemAttr("remoteResistanceID")) or None
remoteResistID = effect.resistanceID
return 1
attrInfo = getAttributeInfo(remoteResistID)
# Get the attribute of the resist
resist = fit.ship.itemModifiedAttributes[attrInfo.attributeName] or None
return resist or 1.0
return resist or 1
class Affliction(object):
class Affliction:
def __init__(self, affliction_type, amount):
self.type = affliction_type
self.amount = amount

View File

@@ -122,7 +122,7 @@ class Booster(HandledItem, ItemAttrShortcut):
(effect.isType("passive") or effect.isType("boosterSideEffect")):
if effect.isType("boosterSideEffect") and effect not in self.activeSideEffectEffects:
continue
effect.handler(fit, self, ("booster",))
effect.handler(fit, self, ("booster",), None, effect=effect)
@validates("ID", "itemID", "ammoID", "active")
def validator(self, key, val):

View File

@@ -21,10 +21,13 @@ from logbook import Logger
from sqlalchemy.orm import reconstructor
from eos.utils.round import roundToPrec
pyfalog = Logger(__name__)
class BoosterSideEffect(object):
class BoosterSideEffect:
def __init__(self, effect):
"""Initialize from the program"""
@@ -56,9 +59,8 @@ class BoosterSideEffect(object):
@property
def name(self):
return "{0}% {1}".format(
self.booster.getModifiedItemAttr(self.attr),
self.__effect.getattr('displayName') or self.__effect.name,
)
roundToPrec(self.booster.getModifiedItemAttr(self.attr), 5),
self.__effect.getattr('displayName') or self.__effect.name)
@property
def attr(self):

View File

@@ -32,7 +32,7 @@ from eos.effectHandlerHelpers import HandledItem, HandledImplantList
pyfalog = Logger(__name__)
class Character(object):
class Character:
__itemList = None
__itemIDMap = None
__itemNameMap = None
@@ -422,7 +422,7 @@ class Skill(HandledItem):
(not fit.isStructure or effect.isType("structure")) and \
effect.activeByDefault:
try:
effect.handler(fit, self, ("skill",))
effect.handler(fit, self, ("skill",), None, effect=effect)
except AttributeError:
continue

View File

@@ -18,21 +18,174 @@
# ===============================================================================
import re
from collections import OrderedDict
from sqlalchemy.orm import reconstructor
import eos.db
class DamagePattern(object):
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
# Order is significant here - UI uses order as-is for built-in patterns
BUILTINS = OrderedDict([
(-1, ('Uniform', 25, 25, 25, 25)),
(-2, ('[Generic]EM', 1, 0, 0, 0)),
(-3, ('[Generic]Thermal', 0, 1, 0, 0)),
(-4, ('[Generic]Kinetic', 0, 0, 1, 0)),
(-5, ('[Generic]Explosive', 0, 0, 0, 1)),
(-6, ('[Frequency Crystals]|[T2] Aurora', 5, 3, 0, 0)),
(-7, ('[Frequency Crystals]|[T2] Scorch', 9, 2, 0, 0)),
(-8, ('[Frequency Crystals]Radio', 5, 0, 0, 0)),
(-9, ('[Frequency Crystals]Microwave', 4, 2, 0, 0)),
(-10, ('[Frequency Crystals]Infrared', 5, 2, 0, 0)),
(-11, ('[Frequency Crystals]Standard', 5, 3, 0, 0)),
(-12, ('[Frequency Crystals]Ultraviolet', 6, 3, 0, 0)),
(-13, ('[Frequency Crystals]Xray', 6, 4, 0, 0)),
(-14, ('[Frequency Crystals]Gamma', 7, 4, 0, 0)),
(-15, ('[Frequency Crystals]Multifrequency', 7, 5, 0, 0)),
(-16, ('[Frequency Crystals]|[T2] Gleam', 7, 7, 0, 0)),
(-17, ('[Frequency Crystals]|[T2] Conflagration', 7.7, 7.7, 0, 0)),
# Different sizes of plasma do different damage ratios, the values here
# are average of ratios across sizes
(-18, ('[Exotic Plasma]|[T2] Mystic', 0, 66319, 0, 33681)),
(-19, ('[Exotic Plasma]Meson', 0, 60519, 0, 39481)),
(-20, ('[Exotic Plasma]Baryon', 0, 59737, 0, 40263)),
(-21, ('[Exotic Plasma]Tetryon', 0, 69208, 0, 30792)),
(-22, ('[Exotic Plasma]|[T2] Occult', 0, 55863, 0, 44137)),
(-23, ('[Hybrid Charges]|[T2] Spike', 0, 4, 4, 0)),
(-24, ('[Hybrid Charges]|[T2] Null', 0, 6, 5, 0)),
(-25, ('[Hybrid Charges]Iron', 0, 2, 3, 0)),
(-26, ('[Hybrid Charges]Tungsten', 0, 2, 4, 0)),
(-27, ('[Hybrid Charges]Iridium', 0, 3, 4, 0)),
(-28, ('[Hybrid Charges]Lead', 0, 3, 5, 0)),
(-29, ('[Hybrid Charges]Thorium', 0, 4, 5, 0)),
(-30, ('[Hybrid Charges]Uranium', 0, 4, 6, 0)),
(-31, ('[Hybrid Charges]Plutonium', 0, 5, 6, 0)),
(-32, ('[Hybrid Charges]Antimatter', 0, 5, 7, 0)),
(-33, ('[Hybrid Charges]|[T2] Javelin', 0, 8, 6, 0)),
(-34, ('[Hybrid Charges]|[T2] Void', 0, 7.7, 7.7, 0)),
(-35, ('[Projectile Ammo]|[T2] Tremor', 0, 0, 3, 5)),
(-36, ('[Projectile Ammo]|[T2] Barrage', 0, 0, 5, 6)),
(-37, ('[Projectile Ammo]Carbonized Lead', 0, 0, 4, 1)),
(-38, ('[Projectile Ammo]Nuclear', 0, 0, 1, 4)),
(-39, ('[Projectile Ammo]Proton', 3, 0, 2, 0)),
(-40, ('[Projectile Ammo]Depleted Uranium', 0, 3, 2, 3)),
(-41, ('[Projectile Ammo]Titanium Sabot', 0, 0, 6, 2)),
(-42, ('[Projectile Ammo]EMP', 9, 0, 1, 2)),
(-43, ('[Projectile Ammo]Phased Plasma', 0, 10, 2, 0)),
(-44, ('[Projectile Ammo]Fusion', 0, 0, 2, 10)),
(-45, ('[Projectile Ammo]|[T2] Quake', 0, 0, 5, 9)),
(-46, ('[Projectile Ammo]|[T2] Hail', 0, 0, 3.3, 12.1)),
(-47, ('[Missiles]Mjolnir', 1, 0, 0, 0)),
(-48, ('[Missiles]Inferno', 0, 1, 0, 0)),
(-49, ('[Missiles]Scourge', 0, 0, 1, 0)),
(-50, ('[Missiles]Nova', 0, 0, 0, 1)),
(-51, ('[Bombs]Electron Bomb', 6400, 0, 0, 0)),
(-52, ('[Bombs]Scorch Bomb', 0, 6400, 0, 0)),
(-53, ('[Bombs]Concussion Bomb', 0, 0, 6400, 0)),
(-54, ('[Bombs]Shrapnel Bomb', 0, 0, 0, 6400)),
# Source: ticket #2067
(-55, ('[NPC][Abyssal]All', 130, 396, 258, 216)),
(-56, ('[NPC][Abyssal]Drifter', 250, 250, 250, 250)),
(-57, ('[NPC][Abyssal]Drones', 250, 250, 250, 250)),
(-58, ('[NPC][Abyssal]Overmind', 0, 408, 592, 0)),
(-59, ('[NPC][Abyssal]Seeker', 406, 406, 94, 94)),
(-60, ('[NPC][Abyssal]Sleeper', 313, 313, 187, 187)),
(-61, ('[NPC][Abyssal]Triglavian', 0, 610, 0, 390)),
(-62, ('[NPC][Asteroid]Angel Cartel', 1838, 562, 2215, 3838)),
(-63, ('[NPC][Asteroid]Blood Raiders', 5067, 4214, 0, 0)),
(-64, ('[NPC][Asteroid]Guristas', 0, 1828, 7413, 0)),
(-65, ('[NPC][Asteroid]Rogue Drone', 394, 666, 1090, 1687)),
(-66, ('[NPC][Asteroid]Sanshas Nation', 5586, 4112, 0, 0)),
(-67, ('[NPC][Asteroid]Serpentis', 0, 5373, 4813, 0)),
(-68, ('[NPC][Burner]Cruor (Blood Raiders)', 90, 90, 0, 0)),
(-69, ('[NPC][Burner]Dramiel (Angel)', 55, 0, 20, 96)),
(-70, ('[NPC][Burner]Daredevil (Serpentis)', 0, 110, 154, 0)),
(-71, ('[NPC][Burner]Succubus (Sanshas Nation)', 135, 30, 0, 0)),
(-72, ('[NPC][Burner]Worm (Guristas)', 0, 0, 228, 0)),
(-73, ('[NPC][Burner]Enyo', 0, 147, 147, 0)),
(-74, ('[NPC][Burner]Hawk', 0, 0, 247, 0)),
(-75, ('[NPC][Burner]Jaguar', 36, 0, 50, 182)),
(-76, ('[NPC][Burner]Vengeance', 232, 0, 0, 0)),
(-77, ('[NPC][Burner]Ashimmu (Blood Raiders)', 260, 100, 0, 0)),
(-78, ('[NPC][Burner]Talos', 0, 413, 413, 0)),
(-79, ('[NPC][Burner]Sentinel', 0, 75, 0, 90)),
(-80, ('[NPC][Deadspace]Angel Cartel', 369, 533, 1395, 3302)),
(-81, ('[NPC][Deadspace]Blood Raiders', 6040, 5052, 10, 15)),
(-82, ('[NPC][Deadspace]Guristas', 0, 1531, 9680, 0)),
(-83, ('[NPC][Deadspace]Rogue Drone', 276, 1071, 1069, 871)),
(-84, ('[NPC][Deadspace]Sanshas Nation', 3009, 2237, 0, 0)),
(-85, ('[NPC][Deadspace]Serpentis', 0, 3110, 1929, 0)),
# Source: ticket #2067
(-86, ('[NPC][Invasion][Invading Precursor Entities]Dread', 0, 417, 0, 583)),
(-87, ('[NPC][Invasion][Invading Precursor Entities]Normal Subcaps', 0, 610, 0, 390)),
(-88, ('[NPC][Invasion][Invading Precursor Entities]Subcaps w/missiles 0% spool up', 367, 155, 367, 112)),
(-89, ('[NPC][Invasion][Invading Precursor Entities]Subcaps w/missiles 50% spool up', 291, 243, 291, 175)),
(-90, ('[NPC][Invasion][Invading Precursor Entities]Subcaps w/missiles 100% spool up', 241, 301, 241, 217)),
(-91, ('[NPC][Invasion][Retaliating Amarr Entities]Dread/Subcaps', 583, 417, 0, 0)),
(-92, ('[NPC][Invasion][Retaliating Caldari Entities]Dread', 1000, 0, 0, 0)),
(-93, ('[NPC][Invasion][Retaliating Caldari Entities]Subcaps', 511, 21, 29, 440)),
(-94, ('[NPC][Invasion][Retaliating Gallente Entities]Dread/Subcaps', 0, 417, 583, 0)),
(-95, ('[NPC][Invasion][Retaliating Minmatar Entities]Dread', 0, 0, 583, 417)),
(-96, ('[NPC][Invasion][Retaliating Minmatar Entities]Subcaps', 302, 136, 328, 234)),
(-97, ('[NPC][Mission]Amarr Empire', 4464, 3546, 97, 0)),
(-98, ('[NPC][Mission]Caldari State', 0, 2139, 4867, 0)),
(-99, ('[NPC][Mission]CONCORD', 336, 134, 212, 412)),
(-100, ('[NPC][Mission]Gallente Federation', 9, 3712, 2758, 0)),
(-101, ('[NPC][Mission]Khanid', 612, 483, 43, 6)),
(-102, ('[NPC][Mission]Minmatar Republic', 1024, 388, 1655, 4285)),
(-103, ('[NPC][Mission]Mordus Legion', 25, 262, 625, 0)),
(-104, ('[NPC][Mission]Thukker', 0, 52, 10, 79)),
(-105, ('[NPC]Sansha Incursion', 1682, 1347, 3678, 3678)),
(-106, ('[NPC]Sleepers', 1472, 1472, 1384, 1384))])
class DamagePattern:
DAMAGE_TYPES = ('em', 'thermal', 'kinetic', 'explosive')
_builtins = None
def __init__(self, *args, **kwargs):
self.builtin = False
self.update(*args, **kwargs)
@reconstructor
def init(self):
self.builtin = False
def update(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25):
self.emAmount = emAmount
self.thermalAmount = thermalAmount
self.kineticAmount = kineticAmount
self.explosiveAmount = explosiveAmount
@classmethod
def getBuiltinList(cls):
if cls._builtins is None:
cls.__generateBuiltins()
return list(cls._builtins.values())
@classmethod
def getBuiltinById(cls, id):
if cls._builtins is None:
cls.__generateBuiltins()
return cls._builtins.get(id)
@classmethod
def getDefaultBuiltin(cls):
if cls._builtins is None:
cls.__generateBuiltins()
return cls._builtins.get(-1)
@classmethod
def __generateBuiltins(cls):
cls._builtins = OrderedDict()
for id, (rawName, em, therm, kin, explo) in BUILTINS.items():
pattern = DamagePattern(emAmount=em, thermalAmount=therm, kineticAmount=kin, explosiveAmount=explo)
pattern.ID = id
pattern.rawName = rawName
pattern.builtin = True
cls._builtins[id] = pattern
def calculateEhp(self, fit):
ehp = {}
for (type, attr) in (('shield', 'shieldCapacity'), ('armor', 'armorHP'), ('hull', 'hp')):
@@ -78,6 +231,15 @@ class DamagePattern(object):
"exp" : "explosive"
}
@classmethod
def oneType(cls, damageType, amount=100):
pattern = DamagePattern()
pattern.update(amount if damageType == "em" else 0,
amount if damageType == "thermal" else 0,
amount if damageType == "kinetic" else 0,
amount if damageType == "explosive" else 0)
return pattern
@classmethod
def importPatterns(cls, text):
lines = re.split('[\n\r]+', text)
@@ -89,7 +251,7 @@ class DamagePattern(object):
lookup = {}
current = eos.db.getDamagePatternList()
for pattern in current:
lookup[pattern.name] = pattern
lookup[pattern.rawName] = pattern
for line in lines:
try:
@@ -98,6 +260,8 @@ class DamagePattern(object):
line = line.split('#', 1)[0] # allows for comments
type, data = line.rsplit('=', 1)
type, data = type.strip(), data.split(',')
except (KeyboardInterrupt, SystemExit):
raise
except:
# Data isn't in correct format, continue to next line
continue
@@ -112,6 +276,8 @@ class DamagePattern(object):
for index, val in enumerate(data):
try:
fields["%sAmount" % cls.DAMAGE_TYPES[index]] = int(val)
except (KeyboardInterrupt, SystemExit):
raise
except:
continue
@@ -122,7 +288,7 @@ class DamagePattern(object):
eos.db.save(pattern)
else:
pattern = DamagePattern(**fields)
pattern.name = name.strip()
pattern.rawName = name.strip()
eos.db.save(pattern)
patterns.append(pattern)
@@ -138,11 +304,41 @@ class DamagePattern(object):
out += "# Values are in following format:\n"
out += "# DamageProfile = [name],[EM amount],[Thermal amount],[Kinetic amount],[Explosive amount]\n\n"
for dp in patterns:
out += cls.EXPORT_FORMAT % (dp.name, dp.emAmount, dp.thermalAmount, dp.kineticAmount, dp.explosiveAmount)
out += cls.EXPORT_FORMAT % (dp.rawName, dp.emAmount, dp.thermalAmount, dp.kineticAmount, dp.explosiveAmount)
return out.strip()
@property
def name(self):
return self.rawName
@property
def fullName(self):
categories, tail = self.__parseRawName()
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
@property
def shortName(self):
return self.__parseRawName()[1]
@property
def hierarchy(self):
return self.__parseRawName()[0]
def __parseRawName(self):
categories = []
remainingName = self.rawName.strip() if self.rawName else ''
while True:
start, end = remainingName.find('['), remainingName.find(']')
if start == -1 or end == -1:
return categories, remainingName
splitter = remainingName.find('|')
if splitter != -1 and splitter == start - 1:
return categories, remainingName[1:]
categories.append(remainingName[start + 1:end])
remainingName = remainingName[end + 1:].strip()
def __deepcopy__(self, memo):
p = DamagePattern(self.emAmount, self.thermalAmount, self.kineticAmount, self.explosiveAmount)
p.name = "%s copy" % self.name
p.rawName = "%s copy" % self.rawName
return p

View File

@@ -17,14 +17,17 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from logbook import Logger
import math
from sqlalchemy.orm import validates, reconstructor
from logbook import Logger
from sqlalchemy.orm import reconstructor, validates
import eos.db
from eos.effectHandlerHelpers import HandledItem, HandledCharge
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut
from eos.utils.stats import DmgTypes
from eos.effectHandlerHelpers import HandledCharge, HandledItem
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
from eos.utils.cycles import CycleInfo
from eos.utils.default import DEFAULT
from eos.utils.stats import DmgTypes, RRTypes
pyfalog = Logger(__name__)
@@ -44,6 +47,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.amount = 0
self.amountActive = 0
self.projected = False
self.projectionRange = None
self.build()
@reconstructor
@@ -67,7 +71,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
""" Build object. Assumes proper and valid item already set """
self.__charge = None
self.__baseVolley = None
self.__baseRemoteReps = None
self.__baseRRAmount = None
self.__miningyield = None
self.__itemModifiedAttributes = ModifiedAttributeDict()
self.__itemModifiedAttributes.original = self.__item.attributes
@@ -104,7 +108,16 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
@property
def cycleTime(self):
return max(self.getModifiedItemAttr("duration", 0), 0)
if self.hasAmmo:
cycleTime = self.getModifiedItemAttr("missileLaunchDuration", 0)
else:
for attr in ("speed", "duration"):
cycleTime = self.getModifiedItemAttr(attr, None)
if cycleTime is not None:
break
if cycleTime is None:
return 0
return max(cycleTime, 0)
@property
def dealsDamage(self):
@@ -121,9 +134,16 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def hasAmmo(self):
return self.charge is not None
def getVolley(self, targetResists=None):
def isDealingDamage(self):
volleyParams = self.getVolleyParameters()
for volley in volleyParams.values():
if volley.total > 0:
return True
return False
def getVolleyParameters(self, targetProfile=None):
if not self.dealsDamage or self.amountActive <= 0:
return DmgTypes(0, 0, 0, 0)
return {0: DmgTypes(0, 0, 0, 0)}
if self.__baseVolley is None:
dmgGetter = self.getModifiedChargeAttr if self.hasAmmo else self.getModifiedItemAttr
dmgMult = self.amountActive * (self.getModifiedItemAttr("damageMultiplier", 1))
@@ -133,19 +153,23 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
kinetic=(dmgGetter("kineticDamage", 0)) * dmgMult,
explosive=(dmgGetter("explosiveDamage", 0)) * dmgMult)
volley = DmgTypes(
em=self.__baseVolley.em * (1 - getattr(targetResists, "emAmount", 0)),
thermal=self.__baseVolley.thermal * (1 - getattr(targetResists, "thermalAmount", 0)),
kinetic=self.__baseVolley.kinetic * (1 - getattr(targetResists, "kineticAmount", 0)),
explosive=self.__baseVolley.explosive * (1 - getattr(targetResists, "explosiveAmount", 0)))
return volley
em=self.__baseVolley.em * (1 - getattr(targetProfile, "emAmount", 0)),
thermal=self.__baseVolley.thermal * (1 - getattr(targetProfile, "thermalAmount", 0)),
kinetic=self.__baseVolley.kinetic * (1 - getattr(targetProfile, "kineticAmount", 0)),
explosive=self.__baseVolley.explosive * (1 - getattr(targetProfile, "explosiveAmount", 0)))
return {0: volley}
def getDps(self, targetResists=None):
volley = self.getVolley(targetResists=targetResists)
def getVolley(self, targetProfile=None):
return self.getVolleyParameters(targetProfile=targetProfile)[0]
def getDps(self, targetProfile=None):
volley = self.getVolley(targetProfile=targetProfile)
if not volley:
return DmgTypes(0, 0, 0, 0)
cycleAttr = "missileLaunchDuration" if self.hasAmmo else "speed"
cycleTime = self.getModifiedItemAttr(cycleAttr)
dpsFactor = 1 / (cycleTime / 1000)
cycleParams = self.getCycleParameters()
if cycleParams is None:
return DmgTypes(0, 0, 0, 0)
dpsFactor = 1 / (cycleParams.averageTime / 1000)
dps = DmgTypes(
em=volley.em * dpsFactor,
thermal=volley.thermal * dpsFactor,
@@ -153,41 +177,65 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
explosive=volley.explosive * dpsFactor)
return dps
def isRemoteRepping(self, ignoreState=False):
repParams = self.getRepAmountParameters(ignoreState=ignoreState)
for rrData in repParams.values():
if rrData:
return True
return False
def getRepAmountParameters(self, ignoreState=False):
amount = self.amount if ignoreState else self.amountActive
if amount <= 0:
return {}
if self.__baseRRAmount is None:
self.__baseRRAmount = {}
hullAmount = self.getModifiedItemAttr("structureDamageAmount", 0)
armorAmount = self.getModifiedItemAttr("armorDamageAmount", 0)
shieldAmount = self.getModifiedItemAttr("shieldBonus", 0)
if shieldAmount:
self.__baseRRAmount[0] = RRTypes(
shield=shieldAmount * amount,
armor=0, hull=0, capacitor=0)
if armorAmount or hullAmount:
self.__baseRRAmount[self.cycleTime] = RRTypes(
shield=0, armor=armorAmount * amount,
hull=hullAmount * amount, capacitor=0)
return self.__baseRRAmount
def getRemoteReps(self, ignoreState=False):
if self.amountActive <= 0 and not ignoreState:
return (None, 0)
if self.__baseRemoteReps is None:
rrShield = self.getModifiedItemAttr("shieldBonus", 0)
rrArmor = self.getModifiedItemAttr("armorDamageAmount", 0)
rrHull = self.getModifiedItemAttr("structureDamageAmount", 0)
if rrShield:
rrType = "Shield"
rrAmount = rrShield
elif rrArmor:
rrType = "Armor"
rrAmount = rrArmor
elif rrHull:
rrType = "Hull"
rrAmount = rrHull
else:
rrType = None
rrAmount = 0
if rrAmount:
droneAmount = self.amount if ignoreState else self.amountActive
rrAmount *= droneAmount / (self.cycleTime / 1000)
self.__baseRemoteReps = (rrType, rrAmount)
return self.__baseRemoteReps
rrDuringCycle = RRTypes(0, 0, 0, 0)
cycleParams = self.getCycleParameters()
if cycleParams is None:
return rrDuringCycle
repAmountParams = self.getRepAmountParameters(ignoreState=ignoreState)
avgCycleTime = cycleParams.averageTime
if len(repAmountParams) == 0 or avgCycleTime == 0:
return rrDuringCycle
for rrAmount in repAmountParams.values():
rrDuringCycle += rrAmount
rrFactor = 1 / (avgCycleTime / 1000)
rrDuringCycle *= rrFactor
return rrDuringCycle
def getCycleParameters(self, reloadOverride=None):
cycleTime = self.cycleTime
if cycleTime == 0:
return None
return CycleInfo(self.cycleTime, 0, math.inf, False)
@property
def miningStats(self):
if self.__miningyield is None:
if self.mines is True and self.amountActive > 0:
attr = "duration"
getter = self.getModifiedItemAttr
cycleTime = self.getModifiedItemAttr(attr)
volley = sum([getter(d) for d in self.MINING_ATTRIBUTES]) * self.amountActive
self.__miningyield = volley / (cycleTime / 1000.0)
cycleParams = self.getCycleParameters()
if cycleParams is None:
self.__miningyield = 0
else:
cycleTime = cycleParams.averageTime
volley = sum([getter(d) for d in self.MINING_ATTRIBUTES]) * self.amountActive
self.__miningyield = volley / (cycleTime / 1000.0)
else:
self.__miningyield = 0
@@ -236,7 +284,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def clear(self):
self.__baseVolley = None
self.__baseRemoteReps = None
self.__baseRRAmount = None
self.__miningyield = None
self.itemModifiedAttributes.clear()
self.chargeModifiedAttributes.clear()
@@ -259,7 +307,7 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
else:
return True
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, forcedProjRange=DEFAULT):
if self.projected or forceProjected:
context = "projected", "drone"
projected = True
@@ -267,6 +315,8 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
context = ("drone",)
projected = False
projectionRange = self.projectionRange if forcedProjRange is DEFAULT else forcedProjRange
for effect in self.item.effects.values():
if effect.runTime == runTime and \
effect.activeByDefault and \
@@ -274,30 +324,34 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
projected is False and effect.isType("passive")):
# See GH issue #765
if effect.getattr('grouped'):
effect.handler(fit, self, context)
effect.handler(fit, self, context, projectionRange, effect=effect)
else:
i = 0
while i != self.amountActive:
effect.handler(fit, self, context)
effect.handler(fit, self, context, projectionRange, effect=effect)
i += 1
if self.charge:
for effect in self.charge.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, ("droneCharge",))
effect.handler(fit, self, ("droneCharge",), projectionRange, effect=effect)
def __deepcopy__(self, memo):
copy = Drone(self.item)
copy.amount = self.amount
copy.amountActive = self.amountActive
copy.projectionRange = self.projectionRange
return copy
def rebase(self, item):
amount = self.amount
amountActive = self.amountActive
projectionRange = self.projectionRange
Drone.__init__(self, item)
self.amount = amount
self.amountActive = amountActive
self.projectionRange = projectionRange
def fits(self, fit):
fitDroneGroupLimits = set()
@@ -310,3 +364,11 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if self.item.groupID in fitDroneGroupLimits:
return True
return False
def canDealDamage(self, ignoreState=False):
if self.item is None:
return False
for effect in self.item.effects.values():
if effect.dealsDamage and (ignoreState or self.amountActive > 0):
return True
return False

View File

@@ -17,16 +17,21 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from logbook import Logger
import math
from sqlalchemy.orm import validates, reconstructor
from logbook import Logger
from sqlalchemy.orm import reconstructor, validates
import eos.db
from eos.effectHandlerHelpers import HandledItem, HandledCharge
from eos.modifiedAttributeDict import ModifiedAttributeDict, ItemAttrShortcut, ChargeAttrShortcut
from eos.saveddata.fighterAbility import FighterAbility
from eos.utils.stats import DmgTypes
from eos.const import FittingSlot
from eos.effectHandlerHelpers import HandledCharge, HandledItem
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
from eos.saveddata.fighterAbility import FighterAbility
from eos.utils.cycles import CycleInfo, CycleSequence
from eos.utils.default import DEFAULT
from eos.utils.float import floatUnerr
from eos.utils.stats import DmgTypes
pyfalog = Logger(__name__)
@@ -44,11 +49,12 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.itemID = item.ID if item is not None else None
self.projected = False
self.projectionRange = None
self.active = True
# -1 is a placeholder that represents max squadron size, which we may not know yet as ships may modify this with
# their effects. If user changes this, it is then overridden with user value.
self.amount = -1
self._amount = -1
self.__abilities = self.__getAbilities()
@@ -93,7 +99,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.__itemModifiedAttributes = ModifiedAttributeDict()
self.__chargeModifiedAttributes = ModifiedAttributeDict()
if len(self.abilities) != len(self.item.effects):
if {a.effectID for a in self.abilities} != {e.ID for e in self.item.effects.values()}:
self.__abilities = []
for ability in self.__getAbilities():
self.__abilities.append(ability)
@@ -133,12 +139,15 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return self.__slot
@property
def amountActive(self):
return int(self.getModifiedItemAttr("fighterSquadronMaxSize")) if self.amount == -1 else self.amount
def amount(self):
return int(self.getModifiedItemAttr("fighterSquadronMaxSize")) if self._amount == -1 else self._amount
@amountActive.setter
def amountActive(self, i):
self.amount = int(max(min(i, self.getModifiedItemAttr("fighterSquadronMaxSize")), 0))
@amount.setter
def amount(self, amount):
amount = max(0, int(amount))
if amount >= self.getModifiedItemAttr("fighterSquadronMaxSize"):
amount = -1
self._amount = amount
@property
def fighterSquadronMaxSize(self):
@@ -172,79 +181,143 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def hasAmmo(self):
return self.charge is not None
def getVolley(self, targetResists=None):
if not self.active or self.amountActive <= 0:
return DmgTypes(0, 0, 0, 0)
def isDealingDamage(self):
volleyParams = self.getVolleyParametersPerEffect()
for effectData in volleyParams.values():
for volley in effectData.values():
if volley.total > 0:
return True
return False
def getVolleyParametersPerEffect(self, targetProfile=None):
if not self.active or self.amount <= 0:
return {}
if self.__baseVolley is None:
em = 0
therm = 0
kin = 0
exp = 0
self.__baseVolley = {}
for ability in self.abilities:
# Not passing resists here as we want to calculate and store base volley
abilityVolley = ability.getVolley()
em += abilityVolley.em
therm += abilityVolley.thermal
kin += abilityVolley.kinetic
exp += abilityVolley.explosive
self.__baseVolley = DmgTypes(em, therm, kin, exp)
volley = DmgTypes(
em=self.__baseVolley.em * (1 - getattr(targetResists, "emAmount", 0)),
thermal=self.__baseVolley.thermal * (1 - getattr(targetResists, "thermalAmount", 0)),
kinetic=self.__baseVolley.kinetic * (1 - getattr(targetResists, "kineticAmount", 0)),
explosive=self.__baseVolley.explosive * (1 - getattr(targetResists, "explosiveAmount", 0)))
return volley
self.__baseVolley[ability.effectID] = {0: ability.getVolley()}
adjustedVolley = {}
for effectID, effectData in self.__baseVolley.items():
adjustedVolley[effectID] = {}
for volleyTime, volleyValue in effectData.items():
adjustedVolley[effectID][volleyTime] = DmgTypes(
em=volleyValue.em * (1 - getattr(targetProfile, "emAmount", 0)),
thermal=volleyValue.thermal * (1 - getattr(targetProfile, "thermalAmount", 0)),
kinetic=volleyValue.kinetic * (1 - getattr(targetProfile, "kineticAmount", 0)),
explosive=volleyValue.explosive * (1 - getattr(targetProfile, "explosiveAmount", 0)))
return adjustedVolley
def getDps(self, targetResists=None):
def getVolleyPerEffect(self, targetProfile=None):
volleyParams = self.getVolleyParametersPerEffect(targetProfile=targetProfile)
volleyMap = {}
for effectID, volleyData in volleyParams.items():
volleyMap[effectID] = volleyData[0]
return volleyMap
def getVolley(self, targetProfile=None):
volleyParams = self.getVolleyParametersPerEffect(targetProfile=targetProfile)
em = 0
therm = 0
kin = 0
exp = 0
for volleyData in volleyParams.values():
em += volleyData[0].em
therm += volleyData[0].thermal
kin += volleyData[0].kinetic
exp += volleyData[0].explosive
return DmgTypes(em, therm, kin, exp)
def getDps(self, targetProfile=None):
em = 0
thermal = 0
kinetic = 0
explosive = 0
for dps in self.getDpsPerEffect(targetResists=targetResists).values():
for dps in self.getDpsPerEffect(targetProfile=targetProfile).values():
em += dps.em
thermal += dps.thermal
kinetic += dps.kinetic
explosive += dps.explosive
return DmgTypes(em=em, thermal=thermal, kinetic=kinetic, explosive=explosive)
def getUptime(self):
if not self.owner.factorReload:
return 1
activeTimes = []
reloadTimes = []
for ability in self.abilities:
if ability.numShots > 0:
activeTimes.append(ability.numShots * ability.cycleTime)
reloadTimes.append(ability.reloadTime)
if not activeTimes:
return 1
shortestActive = sorted(activeTimes)[0]
longestReload = sorted(reloadTimes, reverse=True)[0]
uptime = shortestActive / (shortestActive + longestReload)
return uptime
def getDpsPerEffect(self, targetResists=None):
if not self.active or self.amountActive <= 0:
def getDpsPerEffect(self, targetProfile=None):
if not self.active or self.amount <= 0:
return {}
uptime = self.getUptime()
if uptime == 1:
return {a.effectID: a.getDps(targetResists=targetResists) for a in self.abilities}
# Decide if it's better to keep steady dps up and never reload or reload from time to time
dpsMapSteady = {}
dpsMapPeakAdjusted = {}
cycleParams = self.getCycleParametersPerEffectOptimizedDps(targetProfile=targetProfile)
dpsMap = {}
for ability in self.abilities:
abilityDps = ability.getDps(targetResists=targetResists)
dpsMapPeakAdjusted[ability.effectID] = DmgTypes(
em=abilityDps.em * uptime,
thermal=abilityDps.thermal * uptime,
kinetic=abilityDps.kinetic * uptime,
explosive=abilityDps.explosive * uptime)
# Infinite use - add to steady dps
if ability.numShots == 0:
dpsMapSteady[ability.effectID] = abilityDps
totalSteady = sum(i.total for i in dpsMapSteady.values())
totalPeakAdjusted = sum(i.total for i in dpsMapPeakAdjusted.values())
return dpsMapSteady if totalSteady >= totalPeakAdjusted else dpsMapPeakAdjusted
if ability.effectID in cycleParams:
cycleTime = cycleParams[ability.effectID].averageTime
dpsMap[ability.effectID] = ability.getDps(targetProfile=targetProfile, cycleTimeOverride=cycleTime)
return dpsMap
def getCycleParametersPerEffectOptimizedDps(self, targetProfile=None, reloadOverride=None):
cycleParamsInfinite = self.getCycleParametersPerEffectInfinite()
cycleParamsReload = self.getCycleParametersPerEffect(reloadOverride=reloadOverride)
dpsMapOnlyInfinite = {}
dpsMapAllWithReloads = {}
# Decide if it's better to keep steady dps up and never reload or reload from time to time
for ability in self.abilities:
if ability.effectID in cycleParamsInfinite:
cycleTime = cycleParamsInfinite[ability.effectID].averageTime
dpsMapOnlyInfinite[ability.effectID] = ability.getDps(targetProfile=targetProfile, cycleTimeOverride=cycleTime)
if ability.effectID in cycleParamsReload:
cycleTime = cycleParamsReload[ability.effectID].averageTime
dpsMapAllWithReloads[ability.effectID] = ability.getDps(targetProfile=targetProfile, cycleTimeOverride=cycleTime)
totalOnlyInfinite = sum(i.total for i in dpsMapOnlyInfinite.values())
totalAllWithReloads = sum(i.total for i in dpsMapAllWithReloads.values())
return cycleParamsInfinite if totalOnlyInfinite >= totalAllWithReloads else cycleParamsReload
def getCycleParametersPerEffectInfinite(self):
return {
a.effectID: CycleInfo(a.cycleTime, 0, math.inf, False)
for a in self.abilities
if a.numShots == 0 and a.cycleTime > 0}
def getCycleParametersPerEffect(self, reloadOverride=None):
factorReload = reloadOverride if reloadOverride is not None else self.owner.factorReload
# Assume it can cycle infinitely
if not factorReload:
return {a.effectID: CycleInfo(a.cycleTime, 0, math.inf, False) for a in self.abilities if a.cycleTime > 0}
limitedAbilities = [a for a in self.abilities if a.numShots > 0 and a.cycleTime > 0]
if len(limitedAbilities) == 0:
return {a.effectID: CycleInfo(a.cycleTime, 0, math.inf, False) for a in self.abilities if a.cycleTime > 0}
validAbilities = [a for a in self.abilities if a.cycleTime > 0]
if len(validAbilities) == 0:
return {}
mostLimitedAbility = min(limitedAbilities, key=lambda a: a.cycleTime * a.numShots)
durationToRefuel = mostLimitedAbility.cycleTime * mostLimitedAbility.numShots
# find out how many shots various abilities will do until reload, and how much time
# "extra" cycle will last (None for no extra cycle)
cyclesUntilRefuel = {mostLimitedAbility.effectID: (mostLimitedAbility.numShots, None)}
for ability in (a for a in validAbilities if a is not mostLimitedAbility):
fullCycles = int(floatUnerr(durationToRefuel / ability.cycleTime))
extraShotTime = floatUnerr(durationToRefuel - (fullCycles * ability.cycleTime))
if extraShotTime == 0:
extraShotTime = None
cyclesUntilRefuel[ability.effectID] = (fullCycles, extraShotTime)
refuelTimes = {}
for ability in validAbilities:
spentShots, extraShotTime = cyclesUntilRefuel[ability.effectID]
if extraShotTime is not None:
spentShots += 1
refuelTimes[ability.effectID] = ability.getReloadTime(spentShots)
refuelTime = max(refuelTimes.values())
cycleParams = {}
for ability in validAbilities:
regularShots, extraShotTime = cyclesUntilRefuel[ability.effectID]
sequence = []
if extraShotTime is not None:
if regularShots > 0:
sequence.append(CycleInfo(ability.cycleTime, 0, regularShots, False))
sequence.append(CycleInfo(extraShotTime, refuelTime, 1, True))
else:
regularShotsNonReload = regularShots - 1
if regularShotsNonReload > 0:
sequence.append(CycleInfo(ability.cycleTime, 0, regularShotsNonReload, False))
sequence.append(CycleInfo(ability.cycleTime, refuelTime, 1, True))
cycleParams[ability.effectID] = CycleSequence(sequence, math.inf)
return cycleParams
@property
def maxRange(self):
@@ -272,7 +345,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if falloff is not None:
return falloff
@validates("ID", "itemID", "chargeID", "amount", "amountActive")
@validates("ID", "itemID", "chargeID", "amount")
def validator(self, key, val):
map = {
"ID" : lambda _val: isinstance(_val, int),
@@ -280,7 +353,6 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"chargeID": lambda _val: isinstance(_val, int),
"amount" : lambda _val: isinstance(_val, int) and _val >= -1,
}
if not map[key](val):
raise ValueError(str(val) + " is not a valid value for " + key)
else:
@@ -311,7 +383,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
else:
return True
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, forcedProjRange=DEFAULT):
if not self.active:
return
@@ -322,6 +394,8 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
context = ("fighter",)
projected = False
projectionRange = self.projectionRange if forcedProjRange is DEFAULT else forcedProjRange
for ability in self.abilities:
if not ability.active:
continue
@@ -330,32 +404,36 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if effect.runTime == runTime and effect.activeByDefault and \
((projected and effect.isType("projected")) or not projected):
if ability.grouped:
effect.handler(fit, self, context)
effect.handler(fit, self, context, projectionRange, effect=effect)
else:
i = 0
while i != self.amountActive:
effect.handler(fit, self, context)
while i != self.amount:
effect.handler(fit, self, context, projectionRange, effect=effect)
i += 1
def __deepcopy__(self, memo):
copy = Fighter(self.item)
copy.amount = self.amount
copy._amount = self._amount
copy.active = self.active
for ability in self.abilities:
copyAbility = next(filter(lambda a: a.effectID == ability.effectID, copy.abilities))
copyAbility.active = ability.active
copy.projectionRange = self.projectionRange
return copy
def rebase(self, item):
amount = self.amount
amount = self._amount
active = self.active
abilityEffectStates = {a.effectID: a.active for a in self.abilities}
projectionRange = self.projectionRange
Fighter.__init__(self, item)
self.amount = amount
self._amount = amount
self.active = active
for ability in self.abilities:
if ability.effectID in abilityEffectStates:
ability.active = abilityEffectStates[ability.effectID]
self.projectionRange = projectionRange
def fits(self, fit):
# If ships doesn't support this type of fighter, don't add it
@@ -363,3 +441,15 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return False
return True
def canDealDamage(self, ignoreState=False, ignoreAbilityState=False):
if self.item is None:
return False
if not self.active and not ignoreState:
return False
for ability in self.abilities:
if not ability.active and not ignoreAbilityState:
continue
if ability.effect.dealsDamage:
return True
return False

View File

@@ -26,7 +26,7 @@ from eos.utils.stats import DmgTypes
pyfalog = Logger(__name__)
class FighterAbility(object):
class FighterAbility:
# We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed
# with the fighter squadron role
@@ -95,8 +95,15 @@ class FighterAbility(object):
@property
def reloadTime(self):
return self.getReloadTime()
def getReloadTime(self, spentShots=None):
if spentShots is not None:
spentShots = max(self.numShots, spentShots)
else:
spentShots = self.numShots
rearm_time = (self.REARM_TIME_MAPPING[self.fighter.getModifiedItemAttr("fighterSquadronRole")] or 0 if self.hasCharges else 0)
return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + rearm_time * self.numShots
return self.fighter.getModifiedItemAttr("fighterRefuelingTime") + rearm_time * spentShots
@property
def numShots(self):
@@ -107,7 +114,7 @@ class FighterAbility(object):
speed = self.fighter.getModifiedItemAttr("{}Duration".format(self.attrPrefix))
return speed
def getVolley(self, targetResists=None):
def getVolley(self, targetProfile=None):
if not self.dealsDamage or not self.active:
return DmgTypes(0, 0, 0, 0)
if self.attrPrefix == "fighterAbilityLaunchBomb":
@@ -120,19 +127,20 @@ class FighterAbility(object):
therm = self.fighter.getModifiedItemAttr("{}DamageTherm".format(self.attrPrefix), 0)
kin = self.fighter.getModifiedItemAttr("{}DamageKin".format(self.attrPrefix), 0)
exp = self.fighter.getModifiedItemAttr("{}DamageExp".format(self.attrPrefix), 0)
dmgMult = self.fighter.amountActive * self.fighter.getModifiedItemAttr("{}DamageMultiplier".format(self.attrPrefix), 1)
dmgMult = self.fighter.amount * self.fighter.getModifiedItemAttr("{}DamageMultiplier".format(self.attrPrefix), 1)
volley = DmgTypes(
em=em * dmgMult * (1 - getattr(targetResists, "emAmount", 0)),
thermal=therm * dmgMult * (1 - getattr(targetResists, "thermalAmount", 0)),
kinetic=kin * dmgMult * (1 - getattr(targetResists, "kineticAmount", 0)),
explosive=exp * dmgMult * (1 - getattr(targetResists, "explosiveAmount", 0)))
em=em * dmgMult * (1 - getattr(targetProfile, "emAmount", 0)),
thermal=therm * dmgMult * (1 - getattr(targetProfile, "thermalAmount", 0)),
kinetic=kin * dmgMult * (1 - getattr(targetProfile, "kineticAmount", 0)),
explosive=exp * dmgMult * (1 - getattr(targetProfile, "explosiveAmount", 0)))
return volley
def getDps(self, targetResists=None):
volley = self.getVolley(targetResists=targetResists)
def getDps(self, targetProfile=None, cycleTimeOverride=None):
volley = self.getVolley(targetProfile=targetProfile)
if not volley:
return DmgTypes(0, 0, 0, 0)
dpsFactor = 1 / (self.cycleTime / 1000)
cycleTime = cycleTimeOverride if cycleTimeOverride is not None else self.cycleTime
dpsFactor = 1 / (cycleTime / 1000)
dps = DmgTypes(
em=volley.em * dpsFactor,
thermal=volley.thermal * dpsFactor,
@@ -141,5 +149,4 @@ class FighterAbility(object):
return dps
def clear(self):
self.__dps = None
self.__volley = None
pass

View File

@@ -21,28 +21,45 @@ import datetime
import time
from copy import deepcopy
from itertools import chain
from math import floor, log, sqrt
from logbook import Logger
from math import asinh, log, sqrt
from sqlalchemy.orm import reconstructor, validates
import eos.db
from eos import capSim
from eos.calc import calculateLockTime, calculateMultiplier
from eos.const import CalcType, FitSystemSecurity, FittingHardpoint, FittingModuleState, FittingSlot, ImplantLocation
from eos.effectHandlerHelpers import (
HandledBoosterList, HandledDroneCargoList, HandledImplantList,
HandledModuleList, HandledProjectedDroneList, HandledProjectedModList)
from eos.saveddata.character import Character
from eos.saveddata.citadel import Citadel
from eos.saveddata.damagePattern import DamagePattern
from eos.saveddata.module import Module
from eos.saveddata.ship import Ship
from eos.utils.stats import DmgTypes
from eos.saveddata.targetProfile import TargetProfile
from eos.utils.float import floatUnerr
from eos.utils.stats import DmgTypes, RRTypes
pyfalog = Logger(__name__)
class Fit(object):
class FitLite:
def __init__(self, id=None, name=None, shipID=None, shipName=None, shipNameShort=None):
self.ID = id
self.name = name
self.shipID = shipID
self.shipName = shipName
self.shipNameShort = shipNameShort
def __repr__(self):
return 'FitLite(ID={})'.format(self.ID)
class Fit:
"""Represents a fitting, with modules, ship, implants, etc."""
PEAK_RECHARGE = 0.25
@@ -130,6 +147,7 @@ class Fit(object):
self.__capState = None
self.__capUsed = None
self.__capRecharge = None
self.__savedCapSimData = {}
self.__calculatedTargets = []
self.factorReload = False
self.boostsFits = set()
@@ -137,13 +155,40 @@ class Fit(object):
self.ecmProjectedStr = 1
self.commandBonuses = {}
@property
def targetResists(self):
return self.__targetResists
def clearFactorReloadDependentData(self):
# Here we clear all data known to rely on cycle parameters
# (which, in turn, relies on factor reload flag)
self.__weaponDpsMap.clear()
self.__droneDps = None
self.__remoteRepMap.clear()
self.__capStable = None
self.__capState = None
self.__capUsed = None
self.__capRecharge = None
self.__savedCapSimData.clear()
# Ancillary tank modules affect this
self.__sustainableTank = None
self.__effectiveSustainableTank = None
@targetResists.setter
def targetResists(self, targetResists):
self.__targetResists = targetResists
@property
def targetProfile(self):
if self.__userTargetProfile is not None:
return self.__userTargetProfile
if self.__builtinTargetProfileID is not None:
return TargetProfile.getBuiltinById(self.__builtinTargetProfileID)
return None
@targetProfile.setter
def targetProfile(self, targetProfile):
if targetProfile is None:
self.__userTargetProfile = None
self.__builtinTargetProfileID = None
elif targetProfile.builtin:
self.__userTargetProfile = None
self.__builtinTargetProfileID = targetProfile.ID
else:
self.__userTargetProfile = targetProfile
self.__builtinTargetProfileID = None
self.__weaponDpsMap = {}
self.__weaponVolleyMap = {}
self.__droneDps = None
@@ -151,11 +196,25 @@ class Fit(object):
@property
def damagePattern(self):
return self.__damagePattern
if self.__userDamagePattern is not None:
return self.__userDamagePattern
if self.__builtinDamagePatternID is not None:
pattern = DamagePattern.getBuiltinById(self.__builtinDamagePatternID)
if pattern is not None:
return pattern
return DamagePattern.getDefaultBuiltin()
@damagePattern.setter
def damagePattern(self, damagePattern):
self.__damagePattern = damagePattern
if damagePattern is None:
self.__userDamagePattern = None
self.__builtinDamagePatternID = None
elif damagePattern.builtin:
self.__userDamagePattern = None
self.__builtinDamagePatternID = damagePattern.ID
else:
self.__userDamagePattern = damagePattern
self.__builtinDamagePatternID = None
self.__ehp = None
self.__effectiveTank = None
@@ -320,8 +379,9 @@ class Fit(object):
@property
def maxTargets(self):
return min(self.extraAttributes["maxTargetsLockedFromSkills"],
self.ship.getModifiedItemAttr("maxLockedTargets"))
maxTargets = min(self.extraAttributes["maxTargetsLockedFromSkills"],
self.ship.getModifiedItemAttr("maxLockedTargets"))
return floor(floatUnerr(maxTargets))
@property
def maxTargetRange(self):
@@ -414,10 +474,8 @@ class Fit(object):
return False
# Citadel modules are now under a new category, so we can check this to ensure only structure modules can fit on a citadel
if isinstance(self.ship, Citadel) and item.category.name != "Structure Module" or \
not isinstance(self.ship, Citadel) and item.category.name == "Structure Module":
if isinstance(self.ship, Citadel) is not item.isStandup:
return False
return True
def clear(self, projected=False, command=False):
@@ -437,6 +495,7 @@ class Fit(object):
self.__capState = None
self.__capUsed = None
self.__capRecharge = None
self.__savedCapSimData.clear()
self.ecmProjectedStr = 1
# self.commandBonuses = {}
@@ -519,11 +578,15 @@ class Fit(object):
if warfareBuffID == 11: # Shield Burst: Active Shielding: Repair Duration/Capacitor
self.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill(
"Shield Emission Systems"), "capacitorNeed", value)
lambda mod: mod.item.requiresSkill("Shield Operation") or
mod.item.requiresSkill("Shield Emission Systems") or
mod.item.requiresSkill("Capital Shield Emission Systems"),
"capacitorNeed", value)
self.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Shield Operation") or mod.item.requiresSkill(
"Shield Emission Systems"), "duration", value)
lambda mod: mod.item.requiresSkill("Shield Operation") or
mod.item.requiresSkill("Shield Emission Systems") or
mod.item.requiresSkill("Capital Shield Emission Systems"),
"duration", value)
if warfareBuffID == 12: # Shield Burst: Shield Extension: Shield HP
self.ship.boostItemAttr("shieldCapacity", value, stackingPenalties=True)
@@ -533,12 +596,16 @@ class Fit(object):
self.ship.boostItemAttr("armor%sDamageResonance" % damageType, value, stackingPenalties=True)
if warfareBuffID == 14: # Armor Burst: Rapid Repair: Repair Duration/Capacitor
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or
mod.item.requiresSkill("Repair Systems"),
"capacitorNeed", value)
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or
mod.item.requiresSkill("Repair Systems"),
"duration", value)
self.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or
mod.item.requiresSkill("Repair Systems") or
mod.item.requiresSkill("Capital Remote Armor Repair Systems"),
"capacitorNeed", value)
self.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or
mod.item.requiresSkill("Repair Systems") or
mod.item.requiresSkill("Capital Remote Armor Repair Systems"),
"duration", value)
if warfareBuffID == 15: # Armor Burst: Armor Reinforcement: Armor HP
self.ship.boostItemAttr("armorHP", value, stackingPenalties=True)
@@ -907,13 +974,20 @@ class Fit(object):
To support a simpler way of doing self projections (so that we don't have to make a copy of the fit and
recalculate), this function was developed to be a common source of projected effect application.
"""
c = chain(self.drones, self.fighters, self.modules)
for item in c:
for item in chain(self.drones, self.fighters):
if item is not None:
# apply effects onto target fit x amount of times
for _ in range(projectionInfo.amount):
targetFit.register(item, origin=self)
item.calculateModifiedAttributes(targetFit, runTime, True)
item.calculateModifiedAttributes(
targetFit, runTime, forceProjected=True,
forcedProjRange=0)
for mod in self.modules:
for _ in range(projectionInfo.amount):
targetFit.register(mod, origin=self)
mod.calculateModifiedAttributes(
targetFit, runTime, forceProjected=True,
forcedProjRange=projectionInfo.projectionRange)
def fill(self):
"""
@@ -954,6 +1028,16 @@ class Fit(object):
if mod.isEmpty:
del self.modules[i]
def clearTail(self):
tailPositions = {}
for mod in reversed(self.modules):
if not mod.isEmpty:
break
tailPositions[self.modules.index(mod)] = mod.slot
for pos in sorted(tailPositions, reverse=True):
self.modules.remove(self.modules[pos])
return tailPositions
@property
def modCount(self):
x = 0
@@ -1063,7 +1147,7 @@ class Fit(object):
def droneBayUsed(self):
amount = 0
for d in self.drones:
amount += d.item.volume * d.amount
amount += d.item.attributes['volume'].value * d.amount
return amount
@@ -1071,7 +1155,7 @@ class Fit(object):
def fighterBayUsed(self):
amount = 0
for f in self.fighters:
amount += f.item.volume * f.amountActive
amount += f.item.attributes['volume'].value * f.amount
return amount
@@ -1167,9 +1251,15 @@ class Fit(object):
return self.__capRecharge
def calculateCapRecharge(self, percent=PEAK_RECHARGE):
capacity = self.ship.getModifiedItemAttr("capacitorCapacity")
rechargeRate = self.ship.getModifiedItemAttr("rechargeRate") / 1000.0
@property
def capDelta(self):
return (self.__capRecharge or 0) - (self.__capUsed or 0)
def calculateCapRecharge(self, percent=PEAK_RECHARGE, capacity=None, rechargeRate=None):
if capacity is None:
capacity = self.ship.getModifiedItemAttr("capacitorCapacity")
if rechargeRate is None:
rechargeRate = self.ship.getModifiedItemAttr("rechargeRate") / 1000.0
return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity
def calculateShieldRecharge(self, percent=PEAK_RECHARGE):
@@ -1186,8 +1276,8 @@ class Fit(object):
# Signature reduction, uses the bomb formula as per CCP Larrikin
if energyNeutralizerSignatureResolution:
capNeed = capNeed * min(1, signatureRadius / energyNeutralizerSignatureResolution)
self.__extraDrains.append((cycleTime, capNeed, clipSize, reloadTime))
if capNeed:
self.__extraDrains.append((cycleTime, capNeed, clipSize, reloadTime))
def removeDrain(self, i):
del self.__extraDrains[i]
@@ -1199,29 +1289,39 @@ class Fit(object):
drains = []
capUsed = 0
capAdded = 0
for mod in self.modules:
if mod.state >= FittingModuleState.ACTIVE:
if (mod.getModifiedItemAttr("capacitorNeed") or 0) != 0:
cycleTime = mod.rawCycleTime or 0
reactivationTime = mod.getModifiedItemAttr("moduleReactivationDelay") or 0
fullCycleTime = cycleTime + reactivationTime
reloadTime = mod.reloadTime
if fullCycleTime > 0:
capNeed = mod.capUse
if capNeed > 0:
capUsed += capNeed
else:
capAdded -= capNeed
for mod in self.activeModulesIter():
if (mod.getModifiedItemAttr("capacitorNeed") or 0) != 0:
cycleTime = mod.rawCycleTime or 0
reactivationTime = mod.getModifiedItemAttr("moduleReactivationDelay") or 0
fullCycleTime = cycleTime + reactivationTime
reloadTime = mod.reloadTime
if fullCycleTime > 0:
capNeed = mod.capUse
if capNeed > 0:
capUsed += capNeed
else:
capAdded -= capNeed
# If this is a turret, don't stagger activations
disableStagger = mod.hardpoint == FittingHardpoint.TURRET
# If this is a turret, don't stagger activations
disableStagger = mod.hardpoint == FittingHardpoint.TURRET
drains.append((int(fullCycleTime), mod.getModifiedItemAttr("capacitorNeed") or 0,
mod.numShots or 0, disableStagger, reloadTime))
drains.append((
int(fullCycleTime),
mod.getModifiedItemAttr("capacitorNeed") or 0,
mod.numShots or 0,
disableStagger,
reloadTime,
mod.item.group.name == 'Capacitor Booster'))
for fullCycleTime, capNeed, clipSize, reloadTime in self.iterDrains():
# Stagger incoming effects for cap simulation
drains.append((int(fullCycleTime), capNeed, clipSize, False, reloadTime))
drains.append((
int(fullCycleTime),
capNeed,
clipSize,
# Stagger incoming effects for cap simulation
False,
reloadTime,
False))
if capNeed > 0:
capUsed += capNeed / (fullCycleTime / 1000.0)
else:
@@ -1232,17 +1332,8 @@ class Fit(object):
def simulateCap(self):
drains, self.__capUsed, self.__capRecharge = self.__generateDrain()
self.__capRecharge += self.calculateCapRecharge()
if len(drains) > 0:
sim = capSim.CapSimulator()
sim.init(drains)
sim.capacitorCapacity = self.ship.getModifiedItemAttr("capacitorCapacity")
sim.capacitorRecharge = self.ship.getModifiedItemAttr("rechargeRate")
sim.stagger = True
sim.scale = False
sim.t_max = 6 * 60 * 60 * 1000
sim.reload = self.factorReload
sim.run()
sim = self.__runCapSim(drains=drains)
if sim is not None:
capState = (sim.cap_stable_low + sim.cap_stable_high) / (2 * sim.capacitorCapacity)
self.__capStable = capState > 0
self.__capState = min(100, capState * 100) if self.__capStable else sim.t / 1000.0
@@ -1250,23 +1341,55 @@ class Fit(object):
self.__capStable = True
self.__capState = 100
def getCapSimData(self, startingCap):
if startingCap not in self.__savedCapSimData:
self.__runCapSim(startingCap=startingCap, tMax=3600, optimizeRepeats=False)
return self.__savedCapSimData[startingCap]
def __runCapSim(self, drains=None, startingCap=None, tMax=None, optimizeRepeats=True):
if drains is None:
drains, nil, nil = self.__generateDrain()
if tMax is None:
tMax = 6 * 60 * 60 * 1000
else:
tMax *= 1000
if len(drains) > 0:
sim = capSim.CapSimulator()
sim.init(drains)
sim.capacitorCapacity = self.ship.getModifiedItemAttr("capacitorCapacity")
sim.capacitorRecharge = self.ship.getModifiedItemAttr("rechargeRate")
sim.startingCapacity = startingCap = self.ship.getModifiedItemAttr("capacitorCapacity") if startingCap is None else startingCap
sim.stagger = True
sim.scale = False
sim.t_max = tMax
sim.reload = self.factorReload
sim.optimize_repeats = optimizeRepeats
sim.run()
# We do not want to store partial results
if not sim.result_optimized_repeats:
self.__savedCapSimData[startingCap] = sim.saved_changes
return sim
else:
self.__savedCapSimData[startingCap] = []
return None
def getCapRegenGainFromMod(self, mod):
"""Return how much cap regen do we gain from having this module"""
currentRegen = self.calculateCapRecharge()
nomodRegen = self.calculateCapRecharge(
capacity=self.ship.getModifiedItemAttrExtended("capacitorCapacity", ignoreAfflictors=[mod]),
rechargeRate=self.ship.getModifiedItemAttrExtended("rechargeRate", ignoreAfflictors=[mod]) / 1000.0)
return currentRegen - nomodRegen
def getRemoteReps(self, spoolOptions=None):
if spoolOptions not in self.__remoteRepMap:
remoteReps = {}
remoteReps = RRTypes(0, 0, 0, 0)
for module in self.modules:
rrType, rrAmount = module.getRemoteReps(spoolOptions=spoolOptions)
if rrType:
if rrType not in remoteReps:
remoteReps[rrType] = 0
remoteReps[rrType] += rrAmount
remoteReps += module.getRemoteReps(spoolOptions=spoolOptions)
for drone in self.drones:
rrType, rrAmount = drone.getRemoteReps()
if rrType:
if rrType not in remoteReps:
remoteReps[rrType] = 0
remoteReps[rrType] += rrAmount
remoteReps += drone.getRemoteReps()
self.__remoteRepMap[spoolOptions] = remoteReps
@@ -1361,47 +1484,47 @@ class Fit(object):
for tankType in localAdjustment:
dict = self.extraAttributes.getAfflictions(tankType)
if self in dict:
for mod, _, amount, used in dict[self]:
for afflictor, operator, stackingGroup, preResAmount, postResAmount, used in dict[self]:
if not used:
continue
if mod.projected:
if afflictor.projected:
continue
if mod.item.group.name not in groupAttrMap:
if afflictor.item.group.name not in groupAttrMap:
continue
usesCap = True
try:
if mod.capUse:
capUsed -= mod.capUse
if afflictor.capUse:
capUsed -= afflictor.capUse
else:
usesCap = False
except AttributeError:
usesCap = False
# Normal Repairers
if usesCap and not mod.charge:
cycleTime = mod.rawCycleTime
amount = mod.getModifiedItemAttr(groupAttrMap[mod.item.group.name])
if usesCap and not afflictor.charge:
cycleTime = afflictor.rawCycleTime
amount = afflictor.getModifiedItemAttr(groupAttrMap[afflictor.item.group.name])
localAdjustment[tankType] -= amount / (cycleTime / 1000.0)
repairers.append(mod)
repairers.append(afflictor)
# Ancillary Armor reps etc
elif usesCap and mod.charge:
cycleTime = mod.rawCycleTime
amount = mod.getModifiedItemAttr(groupAttrMap[mod.item.group.name])
if mod.charge.name == "Nanite Repair Paste":
multiplier = mod.getModifiedItemAttr("chargedArmorDamageMultiplier") or 1
elif usesCap and afflictor.charge:
cycleTime = afflictor.rawCycleTime
amount = afflictor.getModifiedItemAttr(groupAttrMap[afflictor.item.group.name])
if afflictor.charge.name == "Nanite Repair Paste":
multiplier = afflictor.getModifiedItemAttr("chargedArmorDamageMultiplier") or 1
else:
multiplier = 1
localAdjustment[tankType] -= amount * multiplier / (cycleTime / 1000.0)
repairers.append(mod)
repairers.append(afflictor)
# Ancillary Shield boosters etc
elif not usesCap and mod.item.group.name in ("Ancillary Shield Booster", "Ancillary Remote Shield Booster"):
cycleTime = mod.rawCycleTime
amount = mod.getModifiedItemAttr(groupAttrMap[mod.item.group.name])
if self.factorReload and mod.charge:
reloadtime = mod.reloadTime
elif not usesCap and afflictor.item.group.name in ("Ancillary Shield Booster", "Ancillary Remote Shield Booster"):
cycleTime = afflictor.rawCycleTime
amount = afflictor.getModifiedItemAttr(groupAttrMap[afflictor.item.group.name])
if self.factorReload and afflictor.charge:
reloadtime = afflictor.reloadTime
else:
reloadtime = 0.0
offdutycycle = reloadtime / ((max(mod.numShots, 1) * cycleTime) + reloadtime)
offdutycycle = reloadtime / ((max(afflictor.numShots, 1) * cycleTime) + reloadtime)
localAdjustment[tankType] -= amount * offdutycycle / (cycleTime / 1000.0)
# Sort repairers by efficiency. We want to use the most efficient repairers first
@@ -1413,35 +1536,35 @@ class Fit(object):
# Most efficient first, as we sorted earlier.
# calculate how much the repper can rep stability & add to total
totalPeakRecharge = self.capRecharge
for mod in repairers:
for afflictor in repairers:
if capUsed > totalPeakRecharge:
break
if self.factorReload and mod.charge:
reloadtime = mod.reloadTime
if self.factorReload and afflictor.charge:
reloadtime = afflictor.reloadTime
else:
reloadtime = 0.0
cycleTime = mod.rawCycleTime
capPerSec = mod.capUse
cycleTime = afflictor.rawCycleTime
capPerSec = afflictor.capUse
if capPerSec is not None and cycleTime is not None:
# Check how much this repper can work
sustainability = min(1, (totalPeakRecharge - capUsed) / capPerSec)
amount = mod.getModifiedItemAttr(groupAttrMap[mod.item.group.name])
amount = afflictor.getModifiedItemAttr(groupAttrMap[afflictor.item.group.name])
# Add the sustainable amount
if not mod.charge:
localAdjustment[groupStoreMap[mod.item.group.name]] += sustainability * amount / (
if not afflictor.charge:
localAdjustment[groupStoreMap[afflictor.item.group.name]] += sustainability * amount / (
cycleTime / 1000.0)
else:
if mod.charge.name == "Nanite Repair Paste":
multiplier = mod.getModifiedItemAttr("chargedArmorDamageMultiplier") or 1
if afflictor.charge.name == "Nanite Repair Paste":
multiplier = afflictor.getModifiedItemAttr("chargedArmorDamageMultiplier") or 1
else:
multiplier = 1
ondutycycle = (max(mod.numShots, 1) * cycleTime) / (
(max(mod.numShots, 1) * cycleTime) + reloadtime)
ondutycycle = (max(afflictor.numShots, 1) * cycleTime) / (
(max(afflictor.numShots, 1) * cycleTime) + reloadtime)
localAdjustment[groupStoreMap[
mod.item.group.name]] += sustainability * amount * ondutycycle * multiplier / (
afflictor.item.group.name]] += sustainability * amount * ondutycycle * multiplier / (
cycleTime / 1000.0)
capUsed += capPerSec
@@ -1458,9 +1581,7 @@ class Fit(object):
def calculateLockTime(self, radius):
scanRes = self.ship.getModifiedItemAttr("scanResolution")
if scanRes is not None and scanRes > 0:
# Yes, this function returns time in seconds, not miliseconds.
# 40,000 is indeed the correct constant here.
return min(40000 / scanRes / asinh(radius) ** 2, 30 * 60)
return calculateLockTime(srcScanRes=scanRes, tgtSigRadius=radius)
else:
return self.ship.getModifiedItemAttr("scanSpeed") / 1000.0
@@ -1482,8 +1603,8 @@ class Fit(object):
weaponDps = DmgTypes(0, 0, 0, 0)
for mod in self.modules:
weaponVolley += mod.getVolley(spoolOptions=spoolOptions, targetResists=self.targetResists)
weaponDps += mod.getDps(spoolOptions=spoolOptions, targetResists=self.targetResists)
weaponVolley += mod.getVolley(spoolOptions=spoolOptions, targetProfile=self.targetProfile)
weaponDps += mod.getDps(spoolOptions=spoolOptions, targetProfile=self.targetProfile)
self.__weaponVolleyMap[spoolOptions] = weaponVolley
self.__weaponDpsMap[spoolOptions] = weaponDps
@@ -1493,12 +1614,12 @@ class Fit(object):
droneDps = DmgTypes(0, 0, 0, 0)
for drone in self.drones:
droneVolley += drone.getVolley(targetResists=self.targetResists)
droneDps += drone.getDps(targetResists=self.targetResists)
droneVolley += drone.getVolley(targetProfile=self.targetProfile)
droneDps += drone.getDps(targetProfile=self.targetProfile)
for fighter in self.fighters:
droneVolley += fighter.getVolley(targetResists=self.targetResists)
droneDps += fighter.getDps(targetResists=self.targetResists)
droneVolley += fighter.getVolley(targetProfile=self.targetProfile)
droneDps += fighter.getDps(targetProfile=self.targetProfile)
self.__droneDps = droneDps
self.__droneVolley = droneVolley
@@ -1533,6 +1654,44 @@ class Fit(object):
secstatus = FitSystemSecurity.NULLSEC
return secstatus
def activeModulesIter(self):
for mod in self.modules:
if mod.state >= FittingModuleState.ACTIVE:
yield mod
def activeDronesIter(self):
for drone in self.drones:
if drone.amountActive > 0:
yield drone
def activeFightersIter(self):
for fighter in self.fighters:
if fighter.active:
yield fighter
def activeFighterAbilityIter(self):
for fighter in self.activeFightersIter():
for ability in fighter.abilities:
if ability.active:
yield fighter, ability
def getDampMultScanRes(self):
damps = []
for mod in self.activeModulesIter():
for effectName in ('remoteSensorDampFalloff', 'structureModuleEffectRemoteSensorDampener'):
if effectName in mod.item.effects:
damps.append((mod.getModifiedItemAttr('scanResolutionBonus'), 'default'))
if 'doomsdayAOEDamp' in mod.item.effects:
damps.append((mod.getModifiedItemAttr('scanResolutionBonus'), 'default'))
for drone in self.activeDronesIter():
if 'remoteSensorDampEntity' in drone.item.effects:
damps.extend(drone.amountActive * ((drone.getModifiedItemAttr('scanResolutionBonus'), 'default'),))
mults = {}
for strength, stackingGroup in damps:
mults.setdefault(stackingGroup, []).append((1 + strength / 100, None))
return calculateMultiplier(mults)
def __deepcopy__(self, memo=None):
fitCopy = Fit()
# Character and owner are not copied
@@ -1542,7 +1701,7 @@ class Fit(object):
fitCopy.mode = deepcopy(self.mode)
fitCopy.name = "%s copy" % self.name
fitCopy.damagePattern = self.damagePattern
fitCopy.targetResists = self.targetResists
fitCopy.targetProfile = self.targetProfile
fitCopy.implantLocation = self.implantLocation
fitCopy.systemSecurity = self.systemSecurity
fitCopy.notes = self.notes
@@ -1583,6 +1742,8 @@ class Fit(object):
copyProjectionInfo = fit.getProjectionInfo(fitCopy.ID)
originalProjectionInfo = fit.getProjectionInfo(self.ID)
copyProjectionInfo.active = originalProjectionInfo.active
copyProjectionInfo.amount = originalProjectionInfo.amount
copyProjectionInfo.projectionRange = originalProjectionInfo.projectionRange
forceUpdateSavedata(fit)
return fitCopy

View File

@@ -95,7 +95,7 @@ class Implant(HandledItem, ItemAttrShortcut):
return
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.isType("passive") and effect.activeByDefault:
effect.handler(fit, self, ("implant",))
effect.handler(fit, self, ("implant",), None, effect=effect)
@validates("fitID", "itemID", "active")
def validator(self, key, val):

View File

@@ -22,7 +22,7 @@ from copy import deepcopy
from eos.effectHandlerHelpers import HandledImplantList
class ImplantSet(object):
class ImplantSet:
def __init__(self, name=None):
self.name = name
self.__implants = HandledImplantList()

View File

@@ -54,7 +54,7 @@ class Mode(ItemAttrShortcut, HandledItem):
if self.item:
for effect in self.item.effects.values():
if effect.runTime == runTime and effect.activeByDefault:
effect.handler(fit, self, context=("module",))
effect.handler(fit, self, ("module",), None, effect=effect)
def __deepcopy__(self, memo):
copy = Mode(self.item)

View File

@@ -17,20 +17,23 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
from math import floor
import math
from logbook import Logger
from sqlalchemy.orm import reconstructor, validates
import eos.db
from eos.const import FittingModuleState, FittingHardpoint, FittingSlot
from eos.const import FittingHardpoint, FittingModuleState, FittingSlot
from eos.effectHandlerHelpers import HandledCharge, HandledItem
from eos.modifiedAttributeDict import ChargeAttrShortcut, ItemAttrShortcut, ModifiedAttributeDict
from eos.saveddata.citadel import Citadel
from eos.saveddata.mutator import Mutator
from eos.utils.cycles import CycleInfo, CycleSequence
from eos.utils.default import DEFAULT
from eos.utils.float import floatUnerr
from eos.utils.spoolSupport import calculateSpoolup, resolveSpoolOptions
from eos.utils.stats import DmgTypes
from eos.utils.stats import DmgTypes, RRTypes
pyfalog = Logger(__name__)
@@ -61,7 +64,9 @@ ProjectedSystem = {
class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"""An instance of this class represents a module together with its charge and modified attributes"""
MINING_ATTRIBUTES = ("miningAmount",)
SYSTEM_GROUPS = ("Effect Beacon", "MassiveEnvironments", "Abyssal Hazards", "Non-Interactable Object")
SYSTEM_GROUPS = (
"Effect Beacon", "MassiveEnvironments", "Abyssal Hazards",
"Non-Interactable Object", "Destructible Effect Beacon")
def __init__(self, item, baseItem=None, mutaplasmid=None):
"""Initialize a module from the program"""
@@ -89,6 +94,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.__charge = None
self.projected = False
self.projectionRange = None
self.state = FittingModuleState.ONLINE
self.build()
@@ -133,7 +139,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.__charge = None
self.__baseVolley = None
self.__baseRemoteReps = None
self.__baseRRAmount = None
self.__miningyield = None
self.__reloadTime = None
self.__reloadForce = None
@@ -210,8 +216,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
if charge is None:
charges = 0
else:
chargeVolume = charge.volume
containerCapacity = self.item.capacity
chargeVolume = charge.attributes['volume'].value
containerCapacity = self.item.attributes['capacity'].value
if chargeVolume is None or containerCapacity is None:
charges = 0
else:
@@ -287,7 +293,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
# numcycles = math.floor(module_capacity / (module_volume * module_chargerate))
chargeRate = self.getModifiedItemAttr("chargeRate")
numCharges = self.numCharges
numShots = floor(numCharges / chargeRate)
numShots = math.floor(numCharges / chargeRate)
else:
numShots = None
return numShots
@@ -300,7 +306,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
chance = self.getModifiedChargeAttr("crystalVolatilityChance")
damage = self.getModifiedChargeAttr("crystalVolatilityDamage")
crystals = self.numCharges
numShots = floor((crystals * hp) / (damage * chance))
numShots = math.floor((crystals * hp) / (damage * chance))
else:
# Set 0 (infinite) for permanent crystals like t1 laser crystals
numShots = 0
@@ -314,31 +320,68 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"energyDestabilizationRange", "empFieldRange",
"ecmBurstRange", "warpScrambleRange", "cargoScanRange",
"shipScanRange", "surveyScanRange")
maxRange = None
for attr in attrs:
maxRange = self.getModifiedItemAttr(attr, None)
if maxRange is not None:
return maxRange
if self.charge is not None:
try:
chargeName = self.charge.group.name
except AttributeError:
pass
else:
if chargeName in ("Scanner Probe", "Survey Probe"):
return None
break
if maxRange is not None:
if 'burst projector' in self.item.name.lower():
maxRange -= self.owner.ship.getModifiedItemAttr("radius")
return maxRange
missileMaxRangeData = self.missileMaxRangeData
if missileMaxRangeData is None:
return None
lowerRange, higherRange, higherChance = missileMaxRangeData
maxRange = lowerRange * (1 - higherChance) + higherRange * higherChance
return maxRange
@property
def missileMaxRangeData(self):
if self.charge is None:
return None
try:
chargeName = self.charge.group.name
except AttributeError:
pass
else:
if chargeName in ("Scanner Probe", "Survey Probe"):
return None
def calculateRange(maxVelocity, mass, agility, flightTime):
# Source: http://www.eveonline.com/ingameboard.asp?a=topic&threadID=1307419&page=1#15
# D_m = V_m * (T_m + T_0*[exp(- T_m/T_0)-1])
maxVelocity = self.getModifiedChargeAttr("maxVelocity")
flightTime = self.getModifiedChargeAttr("explosionDelay") / 1000.0
mass = self.getModifiedChargeAttr("mass")
agility = self.getModifiedChargeAttr("agility")
if maxVelocity and (flightTime or mass or agility):
accelTime = min(flightTime, mass * agility / 1000000)
# Average distance done during acceleration
duringAcceleration = maxVelocity / 2 * accelTime
# Distance done after being at full speed
fullSpeed = maxVelocity * (flightTime - accelTime)
return duringAcceleration + fullSpeed
accelTime = min(flightTime, mass * agility / 1000000)
# Average distance done during acceleration
duringAcceleration = maxVelocity / 2 * accelTime
# Distance done after being at full speed
fullSpeed = maxVelocity * (flightTime - accelTime)
maxRange = duringAcceleration + fullSpeed
return maxRange
maxVelocity = self.getModifiedChargeAttr("maxVelocity")
if not maxVelocity:
return None
shipRadius = self.owner.ship.getModifiedItemAttr("radius")
# Flight time has bonus based on ship radius, see https://github.com/pyfa-org/Pyfa/issues/2083
flightTime = floatUnerr(self.getModifiedChargeAttr("explosionDelay") / 1000 + shipRadius / maxVelocity)
mass = self.getModifiedChargeAttr("mass")
agility = self.getModifiedChargeAttr("agility")
lowerTime = math.floor(flightTime)
higherTime = math.ceil(flightTime)
lowerRange = calculateRange(maxVelocity, mass, agility, lowerTime)
higherRange = calculateRange(maxVelocity, mass, agility, higherTime)
# Fof range limit is supposedly calculated based on overview (surface-to-surface) range
if 'fofMissileLaunching' in self.charge.effects:
rangeLimit = self.getModifiedChargeAttr("maxFOFTargetRange")
if rangeLimit:
lowerRange = min(lowerRange, rangeLimit)
higherRange = min(higherRange, rangeLimit)
# Make range center-to-surface, as missiles spawn in the center of the ship
lowerRange = max(0, lowerRange - shipRadius)
higherRange = max(0, higherRange - shipRadius)
higherChance = flightTime - lowerTime
return lowerRange, higherRange, higherChance
@property
def falloff(self):
@@ -400,8 +443,12 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
volley = self.getModifiedItemAttr("specialtyMiningAmount") or self.getModifiedItemAttr(
"miningAmount") or 0
if volley:
cycleTime = self.cycleTime
self.__miningyield = volley / (cycleTime / 1000.0)
cycleParams = self.getCycleParameters()
if cycleParams is None:
self.__miningyield = 0
else:
cycleTime = cycleParams.averageTime
self.__miningyield = volley / (cycleTime / 1000.0)
else:
self.__miningyield = 0
else:
@@ -409,91 +456,163 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return self.__miningyield
def getVolley(self, spoolOptions=None, targetResists=None, ignoreState=False):
def isDealingDamage(self, ignoreState=False):
volleyParams = self.getVolleyParameters(ignoreState=ignoreState)
for volley in volleyParams.values():
if volley.total > 0:
return True
return False
def canDealDamage(self, ignoreState=False):
if self.isEmpty:
return False
for effect in self.item.effects.values():
if effect.dealsDamage and (
ignoreState or
effect.isType('offline') or
(effect.isType('passive') and self.state >= FittingModuleState.ONLINE) or
(effect.isType('active') and self.state >= FittingModuleState.ACTIVE) or
(effect.isType('overheat') and self.state >= FittingModuleState.OVERHEATED)
):
return True
return False
def getVolleyParameters(self, spoolOptions=None, targetProfile=None, ignoreState=False):
if self.isEmpty or (self.state < FittingModuleState.ACTIVE and not ignoreState):
return DmgTypes(0, 0, 0, 0)
return {0: DmgTypes(0, 0, 0, 0)}
if self.__baseVolley is None:
self.__baseVolley = {}
dmgGetter = self.getModifiedChargeAttr if self.charge else self.getModifiedItemAttr
dmgMult = self.getModifiedItemAttr("damageMultiplier", 1)
self.__baseVolley = DmgTypes(
em=(dmgGetter("emDamage", 0)) * dmgMult,
thermal=(dmgGetter("thermalDamage", 0)) * dmgMult,
kinetic=(dmgGetter("kineticDamage", 0)) * dmgMult,
explosive=(dmgGetter("explosiveDamage", 0)) * dmgMult)
# Some delay attributes have non-0 default value, so we have to pick according to effects
if {'superWeaponAmarr', 'superWeaponCaldari', 'superWeaponGallente', 'superWeaponMinmatar', 'lightningWeapon'}.intersection(self.item.effects):
dmgDelay = self.getModifiedItemAttr("damageDelayDuration", 0)
elif {'doomsdayBeamDOT', 'doomsdaySlash', 'doomsdayConeDOT'}.intersection(self.item.effects):
dmgDelay = self.getModifiedItemAttr("doomsdayWarningDuration", 0)
else:
dmgDelay = 0
dmgDuration = self.getModifiedItemAttr("doomsdayDamageDuration", 0)
dmgSubcycle = self.getModifiedItemAttr("doomsdayDamageCycleTime", 0)
# Reaper DD can damage each target only once
if dmgDuration != 0 and dmgSubcycle != 0 and 'doomsdaySlash' not in self.item.effects:
subcycles = math.floor(floatUnerr(dmgDuration / dmgSubcycle))
else:
subcycles = 1
for i in range(subcycles):
self.__baseVolley[dmgDelay + dmgSubcycle * i] = DmgTypes(
em=(dmgGetter("emDamage", 0)) * dmgMult,
thermal=(dmgGetter("thermalDamage", 0)) * dmgMult,
kinetic=(dmgGetter("kineticDamage", 0)) * dmgMult,
explosive=(dmgGetter("explosiveDamage", 0)) * dmgMult)
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
spoolBoost = calculateSpoolup(
self.getModifiedItemAttr("damageMultiplierBonusMax", 0),
self.getModifiedItemAttr("damageMultiplierBonusPerCycle", 0),
self.rawCycleTime / 1000, spoolType, spoolAmount)[0]
spoolMultiplier = 1 + spoolBoost
volley = DmgTypes(
em=self.__baseVolley.em * spoolMultiplier * (1 - getattr(targetResists, "emAmount", 0)),
thermal=self.__baseVolley.thermal * spoolMultiplier * (1 - getattr(targetResists, "thermalAmount", 0)),
kinetic=self.__baseVolley.kinetic * spoolMultiplier * (1 - getattr(targetResists, "kineticAmount", 0)),
explosive=self.__baseVolley.explosive * spoolMultiplier * (1 - getattr(targetResists, "explosiveAmount", 0)))
return volley
adjustedVolley = {}
for volleyTime, volleyValue in self.__baseVolley.items():
adjustedVolley[volleyTime] = DmgTypes(
em=volleyValue.em * spoolMultiplier * (1 - getattr(targetProfile, "emAmount", 0)),
thermal=volleyValue.thermal * spoolMultiplier * (1 - getattr(targetProfile, "thermalAmount", 0)),
kinetic=volleyValue.kinetic * spoolMultiplier * (1 - getattr(targetProfile, "kineticAmount", 0)),
explosive=volleyValue.explosive * spoolMultiplier * (1 - getattr(targetProfile, "explosiveAmount", 0)))
return adjustedVolley
def getDps(self, spoolOptions=None, targetResists=None, ignoreState=False):
volley = self.getVolley(spoolOptions=spoolOptions, targetResists=targetResists, ignoreState=ignoreState)
if not volley:
def getVolley(self, spoolOptions=None, targetProfile=None, ignoreState=False):
volleyParams = self.getVolleyParameters(spoolOptions=spoolOptions, targetProfile=targetProfile, ignoreState=ignoreState)
if len(volleyParams) == 0:
return DmgTypes(0, 0, 0, 0)
# Some weapons repeat multiple times in one cycle (bosonic doomsdays). Get the number of times it fires off
volleysPerCycle = max(self.getModifiedItemAttr("doomsdayDamageDuration", 1) / self.getModifiedItemAttr("doomsdayDamageCycleTime", 1), 1)
dpsFactor = volleysPerCycle / (self.cycleTime / 1000)
return volleyParams[min(volleyParams)]
def getDps(self, spoolOptions=None, targetProfile=None, ignoreState=False):
dmgDuringCycle = DmgTypes(0, 0, 0, 0)
cycleParams = self.getCycleParameters()
if cycleParams is None:
return dmgDuringCycle
volleyParams = self.getVolleyParameters(spoolOptions=spoolOptions, targetProfile=targetProfile, ignoreState=ignoreState)
avgCycleTime = cycleParams.averageTime
if len(volleyParams) == 0 or avgCycleTime == 0:
return dmgDuringCycle
for volleyValue in volleyParams.values():
dmgDuringCycle += volleyValue
dpsFactor = 1 / (avgCycleTime / 1000)
dps = DmgTypes(
em=volley.em * dpsFactor,
thermal=volley.thermal * dpsFactor,
kinetic=volley.kinetic * dpsFactor,
explosive=volley.explosive * dpsFactor)
em=dmgDuringCycle.em * dpsFactor,
thermal=dmgDuringCycle.thermal * dpsFactor,
kinetic=dmgDuringCycle.kinetic * dpsFactor,
explosive=dmgDuringCycle.explosive * dpsFactor)
return dps
def getRemoteReps(self, spoolOptions=None, ignoreState=False):
def isRemoteRepping(self, ignoreState=False):
repParams = self.getRepAmountParameters(ignoreState=ignoreState)
for rrData in repParams.values():
if rrData:
return True
return False
def getRepAmountParameters(self, spoolOptions=None, ignoreState=False):
if self.isEmpty or (self.state < FittingModuleState.ACTIVE and not ignoreState):
return None, 0
def getBaseRemoteReps(module):
remoteModuleGroups = {
"Remote Armor Repairer": "Armor",
"Ancillary Remote Armor Repairer": "Armor",
"Mutadaptive Remote Armor Repairer": "Armor",
"Remote Hull Repairer": "Hull",
"Remote Shield Booster": "Shield",
"Ancillary Remote Shield Booster": "Shield",
"Remote Capacitor Transmitter": "Capacitor"}
rrType = remoteModuleGroups.get(module.item.group.name, None)
if not rrType:
return None, 0
return {}
remoteModuleGroups = {
"Remote Armor Repairer": "Armor",
"Ancillary Remote Armor Repairer": "Armor",
"Mutadaptive Remote Armor Repairer": "Armor",
"Remote Hull Repairer": "Hull",
"Remote Shield Booster": "Shield",
"Ancillary Remote Shield Booster": "Shield",
"Remote Capacitor Transmitter": "Capacitor"}
rrType = remoteModuleGroups.get(self.item.group.name)
if rrType is None:
return {}
if self.__baseRRAmount is None:
self.__baseRRAmount = {}
shieldAmount = 0
armorAmount = 0
hullAmount = 0
capacitorAmount = 0
if rrType == "Hull":
rrAmount = module.getModifiedItemAttr("structureDamageAmount", 0)
hullAmount += self.getModifiedItemAttr("structureDamageAmount", 0)
elif rrType == "Armor":
rrAmount = module.getModifiedItemAttr("armorDamageAmount", 0)
if self.item.group.name == "Ancillary Remote Armor Repairer" and self.charge:
mult = self.getModifiedItemAttr("chargedArmorDamageMultiplier", 1)
else:
mult = 1
armorAmount += self.getModifiedItemAttr("armorDamageAmount", 0) * mult
elif rrType == "Shield":
rrAmount = module.getModifiedItemAttr("shieldBonus", 0)
shieldAmount += self.getModifiedItemAttr("shieldBonus", 0)
elif rrType == "Capacitor":
rrAmount = module.getModifiedItemAttr("powerTransferAmount", 0)
capacitorAmount += self.getModifiedItemAttr("powerTransferAmount", 0)
rrDelay = 0 if rrType == "Shield" else self.rawCycleTime
self.__baseRRAmount[rrDelay] = RRTypes(shield=shieldAmount, armor=armorAmount, hull=hullAmount, capacitor=capacitorAmount)
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
spoolBoost = calculateSpoolup(
self.getModifiedItemAttr("repairMultiplierBonusMax", 0),
self.getModifiedItemAttr("repairMultiplierBonusPerCycle", 0),
self.rawCycleTime / 1000, spoolType, spoolAmount)[0]
spoolMultiplier = 1 + spoolBoost
adjustedRRAmount = {}
for rrTime, rrAmount in self.__baseRRAmount.items():
if spoolMultiplier == 1:
adjustedRRAmount[rrTime] = rrAmount
else:
return None, 0
if rrAmount:
rrAmount *= 1 / (self.cycleTime / 1000)
if module.item.group.name == "Ancillary Remote Armor Repairer" and module.charge:
rrAmount *= module.getModifiedItemAttr("chargedArmorDamageMultiplier", 1)
adjustedRRAmount[rrTime] = rrAmount * spoolMultiplier
return adjustedRRAmount
return rrType, rrAmount
if self.__baseRemoteReps is None:
self.__baseRemoteReps = getBaseRemoteReps(self)
rrType, rrAmount = self.__baseRemoteReps
if rrType and rrAmount and self.item.group.name == "Mutadaptive Remote Armor Repairer":
spoolType, spoolAmount = resolveSpoolOptions(spoolOptions, self)
spoolBoost = calculateSpoolup(
self.getModifiedItemAttr("repairMultiplierBonusMax", 0),
self.getModifiedItemAttr("repairMultiplierBonusPerCycle", 0),
self.rawCycleTime / 1000, spoolType, spoolAmount)[0]
rrAmount *= (1 + spoolBoost)
return rrType, rrAmount
def getRemoteReps(self, spoolOptions=None, ignoreState=False, reloadOverride=None):
rrDuringCycle = RRTypes(0, 0, 0, 0)
cycleParams = self.getCycleParameters(reloadOverride=reloadOverride)
if cycleParams is None:
return rrDuringCycle
repAmountParams = self.getRepAmountParameters(spoolOptions=spoolOptions, ignoreState=ignoreState)
avgCycleTime = cycleParams.averageTime
if len(repAmountParams) == 0 or avgCycleTime == 0:
return rrDuringCycle
for rrAmount in repAmountParams.values():
rrDuringCycle += rrAmount
rrFactor = 1 / (avgCycleTime / 1000)
rps = rrDuringCycle * rrFactor
return rps
def getSpoolData(self, spoolOptions=None):
weaponMultMax = self.getModifiedItemAttr("damageMultiplierBonusMax", 0)
@@ -593,7 +712,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
# Check this only if we're told to do so
if hardpointLimit:
if fit.getHardpointsFree(self.hardpoint) < 1:
if fit.getHardpointsFree(self.hardpoint) < (1 if self.owner != fit else 0):
return False
return True
@@ -609,6 +728,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return False
elif state == FittingModuleState.OVERHEATED and not self.item.isType("overheat"):
return False
# Some destructible effect beacons contain active effects, hardcap those at online state
elif state > FittingModuleState.ONLINE and self.slot == FittingSlot.SYSTEM:
return False
else:
return True
@@ -620,30 +742,41 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def canHaveState(self, state=None, projectedOnto=None):
"""
Check with other modules if there are restrictions that might not allow this module to be activated
Check with other modules if there are restrictions that might not allow this module to be activated.
Returns True if state is allowed, or max state module can have if current state is invalid.
"""
# If we're going to set module to offline or online for local modules or offline for projected,
# it should be fine for all cases
# If we're going to set module to offline, it should be fine for all cases
item = self.item
if (state <= FittingModuleState.ONLINE and projectedOnto is None) or (state <= FittingModuleState.OFFLINE):
if state <= FittingModuleState.OFFLINE:
return True
# Check if the local module is over it's max limit; if it's not, we're fine
maxGroupOnline = self.getModifiedItemAttr("maxGroupOnline", None)
maxGroupActive = self.getModifiedItemAttr("maxGroupActive", None)
if maxGroupActive is None and projectedOnto is None:
if maxGroupOnline is None and maxGroupActive is None and projectedOnto is None:
return True
# Following is applicable only to local modules, we do not want to limit projected
if projectedOnto is None:
currOnline = 0
currActive = 0
group = item.group.name
maxState = None
for mod in self.owner.modules:
currItem = getattr(mod, "item", None)
if mod.state >= FittingModuleState.ACTIVE and currItem is not None and currItem.group.name == group:
currActive += 1
if currActive > maxGroupActive:
break
return currActive <= maxGroupActive
if currItem is not None and currItem.group.name == group:
if mod.state >= FittingModuleState.ONLINE:
currOnline += 1
if mod.state >= FittingModuleState.ACTIVE:
currActive += 1
if maxGroupOnline is not None and currOnline > maxGroupOnline:
if maxState is None or maxState > FittingModuleState.OFFLINE:
maxState = FittingModuleState.OFFLINE
break
if maxGroupActive is not None and currActive > maxGroupActive:
if maxState is None or maxState > FittingModuleState.ONLINE:
maxState = FittingModuleState.ONLINE
return True if maxState is None else maxState
# For projected, we're checking if ship is vulnerable to given item
else:
# Do not allow to apply offensive modules on ship with offensive module immunite, with few exceptions
@@ -654,18 +787,18 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"energyNosferatuFalloff",
"energyNeutralizerFalloff"}
if not offensiveNonModifiers.intersection(set(item.effects)):
return False
return FittingModuleState.OFFLINE
# If assistive modules are not allowed, do not let to apply these altogether
if item.assistive and projectedOnto.ship.getModifiedItemAttr("disallowAssistance") == 1:
return False
return FittingModuleState.OFFLINE
return True
def isValidCharge(self, charge):
# Check sizes, if 'charge size > module volume' it won't fit
if charge is None:
return True
chargeVolume = charge.volume
moduleCapacity = self.item.capacity
chargeVolume = charge.attributes['volume'].value
moduleCapacity = self.item.attributes['capacity'].value
if chargeVolume is not None and moduleCapacity is not None and chargeVolume > moduleCapacity:
return False
@@ -750,7 +883,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def clear(self):
self.__baseVolley = None
self.__baseRemoteReps = None
self.__baseRRAmount = None
self.__miningyield = None
self.__reloadTime = None
self.__reloadForce = None
@@ -758,7 +891,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
self.itemModifiedAttributes.clear()
self.chargeModifiedAttributes.clear()
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, gang=False):
def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, gang=False, forcedProjRange=DEFAULT):
# We will run the effect when two conditions are met:
# 1: It makes sense to run the effect
# The effect is either offline
@@ -775,6 +908,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
context = ("module",)
projected = False
projectionRange = self.projectionRange if forcedProjRange is DEFAULT else forcedProjRange
if self.charge is not None:
# fix for #82 and it's regression #106
if not projected or (self.projected and not forceProjected) or gang:
@@ -788,13 +923,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
(not gang or (gang and effect.isType("gang")))
):
contexts = ("moduleCharge",)
# For gang effects, we pass in the effect itself as an argument. However, to avoid going through all
# the effect definitions and defining this argument, do a simple try/catch here and be done with it.
# @todo: possibly fix this
try:
effect.handler(fit, self, contexts, effect=effect)
except:
effect.handler(fit, self, contexts)
effect.handler(fit, self, contexts, projectionRange, effect=effect)
if self.item:
if self.state >= FittingModuleState.OVERHEATED:
@@ -804,7 +933,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
and not forceProjected \
and effect.activeByDefault \
and ((gang and effect.isType("gang")) or not gang):
effect.handler(fit, self, context)
effect.handler(fit, self, context, projectionRange, effect=effect)
for effect in self.item.effects.values():
if effect.runTime == runTime and \
@@ -814,54 +943,64 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
(effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) \
and ((projected and effect.isType("projected")) or not projected) \
and ((gang and effect.isType("gang")) or not gang):
try:
effect.handler(fit, self, context, effect=effect)
except:
effect.handler(fit, self, context)
effect.handler(fit, self, context, projectionRange, effect=effect)
@property
def cycleTime(self):
def getCycleParameters(self, reloadOverride=None):
"""Copied from new eos as well"""
# Determine if we'll take into account reload time or not
factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload
numShots = self.numShots
speed = self.rawCycleTime
if factorReload and self.charge:
raw_reload_time = self.reloadTime
if reloadOverride is not None:
factorReload = reloadOverride
else:
raw_reload_time = 0.0
factorReload = self.owner.factorReload if self.forceReload is None else self.forceReload
# Module can only fire one shot at a time, think bomb launchers or defender launchers
if self.disallowRepeatingAction:
if numShots > 0:
"""
The actual mechanics behind this is complex. Behavior will be (for 3 ammo):
fire, reactivation delay, fire, reactivation delay, fire, max(reactivation delay, reload)
so your effective reload time depends on where you are at in the cycle.
cycles_until_reload = self.numShots
if cycles_until_reload == 0:
cycles_until_reload = math.inf
We can't do that, so instead we'll average it out.
Currently would apply to bomb launchers and defender missiles
"""
effective_reload_time = ((self.reactivationDelay * (numShots - 1)) + max(raw_reload_time, self.reactivationDelay, 0))
else:
"""
Applies to MJD/MJFG
"""
effective_reload_time = max(raw_reload_time, self.reactivationDelay, 0)
speed = speed + effective_reload_time
active_time = self.rawCycleTime
if active_time == 0:
return None
forced_inactive_time = self.reactivationDelay
reload_time = self.reloadTime
# Effects which cannot be reloaded have the same processing whether
# caller wants to take reload time into account or not
if reload_time is None and cycles_until_reload < math.inf:
final_cycles = 1
early_cycles = cycles_until_reload - final_cycles
# Single cycle until effect cannot run anymore
if early_cycles == 0:
return CycleInfo(active_time, 0, 1, False)
# Multiple cycles with the same parameters
if forced_inactive_time == 0:
return CycleInfo(active_time, 0, cycles_until_reload, False)
# Multiple cycles with different parameters
return CycleSequence((
CycleInfo(active_time, forced_inactive_time, early_cycles, False),
CycleInfo(active_time, 0, final_cycles, False)
), 1)
# Module cycles the same way all the time in 3 cases:
# 1) caller doesn't want to take into account reload time
# 2) effect does not have to reload anything to keep running
# 3) effect has enough time to reload during inactivity periods
if (
not factorReload or
cycles_until_reload == math.inf or
forced_inactive_time >= reload_time
):
isInactivityReload = factorReload and forced_inactive_time >= reload_time
return CycleInfo(active_time, forced_inactive_time, math.inf, isInactivityReload)
# We've got to take reload into consideration
else:
"""
Currently no other modules would have a reactivation delay, so for sanities sake don't try and account for it.
Okay, technically cloaks do, but they also have 0 cycle time and cap usage so why do you care?
"""
effective_reload_time = raw_reload_time
if numShots > 0 and self.charge:
speed = (speed * numShots + effective_reload_time) / numShots
return speed
final_cycles = 1
early_cycles = cycles_until_reload - final_cycles
# If effect has to reload after each its cycle, then its parameters
# are the same all the time
if early_cycles == 0:
return CycleInfo(active_time, reload_time, math.inf, True)
return CycleSequence((
CycleInfo(active_time, forced_inactive_time, early_cycles, False),
CycleInfo(active_time, reload_time, final_cycles, True)
), math.inf)
@property
def rawCycleTime(self):
@@ -887,7 +1026,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def capUse(self):
capNeed = self.getModifiedItemAttr("capacitorNeed")
if capNeed and self.state >= FittingModuleState.ACTIVE:
cycleTime = self.cycleTime
cycleParams = self.getCycleParameters()
if cycleParams is None:
return 0
cycleTime = cycleParams.averageTime
if cycleTime > 0:
capUsed = capNeed / (cycleTime / 1000.0)
return capUsed
@@ -914,7 +1056,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
elif click == "ctrl":
state = FittingModuleState.OFFLINE
else:
state = transitionMap[currState]
try:
state = transitionMap[currState]
except KeyError:
state = min(transitionMap)
# If passive module tries to transition into online and fails,
# put it to passive instead
if not mod.isValidState(state) and currState == FittingModuleState.ONLINE:
@@ -932,6 +1077,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
copy.state = self.state
copy.spoolType = self.spoolType
copy.spoolAmount = self.spoolAmount
copy.projectionRange = self.projectionRange
for x in self.mutators.values():
Mutator(copy, x.attribute, x.value)
@@ -941,10 +1087,17 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def rebase(self, item):
state = self.state
charge = self.charge
spoolType = self.spoolType
spoolAmount = self.spoolAmount
projectionRange = self.projectionRange
Module.__init__(self, item, self.baseItem, self.mutaplasmid)
self.state = state
if self.isValidCharge(charge):
self.charge = charge
self.spoolType = spoolType
self.spoolAmount = spoolAmount
self.projectionRange = projectionRange
for x in self.mutators.values():
Mutator(self, x.attribute, x.value)

View File

@@ -73,12 +73,16 @@ class Mutator(EqBase):
self.dynamicAttribute = next(a for a in self.module.mutaplasmid.attributes if a.attributeID == self.attrID)
# base attribute links to the base ite's attribute for this mutated definition (contains original, base value)
self.baseAttribute = self.module.item.attributes[self.dynamicAttribute.name]
except (KeyboardInterrupt, SystemExit):
raise
except:
self.module = None
@validates("value")
def validator(self, key, val):
""" Validates values as properly falling within the range of the modules' Mutaplasmid """
if self.baseValue == 0:
return 0
mod = val / self.baseValue
if self.minMod <= mod <= self.maxMod:

View File

@@ -42,7 +42,7 @@ class PriceStatus(IntEnum):
fetchTimeout = 4
class Price(object):
class Price:
def __init__(self, typeID):
self.typeID = typeID
self.time = 0

View File

@@ -98,7 +98,7 @@ class Ship(ItemAttrShortcut, HandledItem):
# skillbook modifiers will use the stale modifier value
# GH issue #351
fit.register(self)
effect.handler(fit, self, ("ship",))
effect.handler(fit, self, ("ship",), None, effect=effect)
def validateModeItem(self, item, owner=None):
""" Checks if provided item is a valid mode """

View File

@@ -24,7 +24,7 @@ import time
# from tomorrow import threads
class SsoCharacter(object):
class SsoCharacter:
def __init__(self, charID, name, client, accessToken=None, refreshToken=None):
self.characterID = charID
self.characterName = name

View File

@@ -0,0 +1,405 @@
# ===============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import math
import re
from collections import OrderedDict
from logbook import Logger
from sqlalchemy.orm import reconstructor
import eos.db
pyfalog = Logger(__name__)
BUILTINS = OrderedDict([
# 0 is taken by ideal target profile, composed manually in one of TargetProfile methods
(-1, ('Uniform (25%)', 0.25, 0.25, 0.25, 0.25)),
(-2, ('Uniform (50%)', 0.50, 0.50, 0.50, 0.50)),
(-3, ('Uniform (75%)', 0.75, 0.75, 0.75, 0.75)),
(-4, ('Uniform (90%)', 0.90, 0.90, 0.90, 0.90)),
(-5, ('[T1 Resist]Shield', 0.0, 0.20, 0.40, 0.50)),
(-6, ('[T1 Resist]Armor', 0.50, 0.45, 0.25, 0.10)),
(-7, ('[T1 Resist]Hull', 0.33, 0.33, 0.33, 0.33)),
(-8, ('[T1 Resist]Shield (+T2 DCU)', 0.125, 0.30, 0.475, 0.562)),
(-9, ('[T1 Resist]Armor (+T2 DCU)', 0.575, 0.532, 0.363, 0.235)),
(-10, ('[T1 Resist]Hull (+T2 DCU)', 0.598, 0.598, 0.598, 0.598)),
(-11, ('[T2 Resist]Amarr (Shield)', 0.0, 0.20, 0.70, 0.875)),
(-12, ('[T2 Resist]Amarr (Armor)', 0.50, 0.35, 0.625, 0.80)),
(-13, ('[T2 Resist]Caldari (Shield)', 0.20, 0.84, 0.76, 0.60)),
(-14, ('[T2 Resist]Caldari (Armor)', 0.50, 0.8625, 0.625, 0.10)),
(-15, ('[T2 Resist]Gallente (Shield)', 0.0, 0.60, 0.85, 0.50)),
(-16, ('[T2 Resist]Gallente (Armor)', 0.50, 0.675, 0.8375, 0.10)),
(-17, ('[T2 Resist]Minmatar (Shield)', 0.75, 0.60, 0.40, 0.50)),
(-18, ('[T2 Resist]Minmatar (Armor)', 0.90, 0.675, 0.25, 0.10)),
(-19, ('[NPC][Asteroid]Angel Cartel', 0.54, 0.42, 0.37, 0.32)),
(-20, ('[NPC][Asteroid]Blood Raiders', 0.34, 0.39, 0.45, 0.52)),
(-21, ('[NPC][Asteroid]Guristas', 0.55, 0.35, 0.3, 0.48)),
(-22, ('[NPC][Asteroid]Rogue Drones', 0.35, 0.38, 0.44, 0.49)),
(-23, ('[NPC][Asteroid]Sanshas Nation', 0.35, 0.4, 0.47, 0.53)),
(-24, ('[NPC][Asteroid]Serpentis', 0.49, 0.38, 0.29, 0.51)),
(-25, ('[NPC][Deadspace]Angel Cartel', 0.59, 0.48, 0.4, 0.32)),
(-26, ('[NPC][Deadspace]Blood Raiders', 0.31, 0.39, 0.47, 0.56)),
(-27, ('[NPC][Deadspace]Guristas', 0.57, 0.39, 0.31, 0.5)),
(-28, ('[NPC][Deadspace]Rogue Drones', 0.42, 0.42, 0.47, 0.49)),
(-29, ('[NPC][Deadspace]Sanshas Nation', 0.31, 0.39, 0.47, 0.56)),
(-30, ('[NPC][Deadspace]Serpentis', 0.49, 0.38, 0.29, 0.56)),
(-31, ('[NPC][Mission]Amarr Empire', 0.34, 0.38, 0.42, 0.46)),
(-32, ('[NPC][Mission]Caldari State', 0.51, 0.38, 0.3, 0.51)),
(-33, ('[NPC][Mission]CONCORD', 0.47, 0.46, 0.47, 0.47)),
(-34, ('[NPC][Mission]Gallente Federation', 0.51, 0.38, 0.31, 0.52)),
(-35, ('[NPC][Mission]Khanid', 0.51, 0.42, 0.36, 0.4)),
(-36, ('[NPC][Mission]Minmatar Republic', 0.51, 0.46, 0.41, 0.35)),
(-37, ('[NPC][Mission]Mordus Legion', 0.32, 0.48, 0.4, 0.62)),
(-38, ('[NPC][Other]Sleeper', 0.61, 0.61, 0.61, 0.61)),
(-39, ('[NPC][Other]Sansha Incursion', 0.65, 0.63, 0.64, 0.65)),
(-40, ('[NPC][Burner]Cruor (Blood Raiders)', 0.8, 0.73, 0.69, 0.67)),
(-41, ('[NPC][Burner]Dramiel (Angel)', 0.35, 0.48, 0.61, 0.68)),
(-42, ('[NPC][Burner]Daredevil (Serpentis)', 0.69, 0.59, 0.59, 0.43)),
(-43, ('[NPC][Burner]Succubus (Sanshas Nation)', 0.35, 0.48, 0.61, 0.68)),
(-44, ('[NPC][Burner]Worm (Guristas)', 0.48, 0.58, 0.69, 0.74)),
(-45, ('[NPC][Burner]Enyo', 0.58, 0.72, 0.86, 0.24)),
(-46, ('[NPC][Burner]Hawk', 0.3, 0.86, 0.79, 0.65)),
(-47, ('[NPC][Burner]Jaguar', 0.78, 0.65, 0.48, 0.56)),
(-48, ('[NPC][Burner]Vengeance', 0.66, 0.56, 0.75, 0.86)),
(-49, ('[NPC][Burner]Ashimmu (Blood Raiders)', 0.8, 0.76, 0.68, 0.7)),
(-50, ('[NPC][Burner]Talos', 0.68, 0.59, 0.59, 0.43)),
(-51, ('[NPC][Burner]Sentinel', 0.58, 0.45, 0.52, 0.66)),
# Source: ticket #2067
(-52, ('[NPC][Invasion]Invading Precursor Entities', 0.422, 0.367, 0.453, 0.411)),
(-53, ('[NPC][Invasion]Retaliating Amarr Entities', 0.360, 0.310, 0.441, 0.602)),
(-54, ('[NPC][Invasion]Retaliating Caldari Entities', 0.287, 0.610, 0.487, 0.401)),
(-55, ('[NPC][Invasion]Retaliating Gallente Entities', 0.383, 0.414, 0.578, 0.513)),
(-56, ('[NPC][Invasion]Retaliating Minmatar Entities', 0.620, 0.422, 0.355, 0.399)),
(-57, ('[NPC][Abyssal][Dark Matter All Tiers]Drones', 0.439, 0.522, 0.529, 0.435)),
(-58, ('[NPC][Abyssal][Dark Matter All Tiers]Overmind', 0.626, 0.576, 0.612, 0.624)),
(-59, ('[NPC][Abyssal][Dark Matter All Tiers]Seeker', 0.082, 0.082, 0.082, 0.082)),
(-60, ('[NPC][Abyssal][Dark Matter All Tiers]Triglavian', 0.477, 0.401, 0.449, 0.37)),
(-61, ('[NPC][Abyssal][Dark Matter All Tiers]Drifter', 0.403, 0.403, 0.403, 0.403)),
(-62, ('[NPC][Abyssal][Dark Matter All Tiers]Sleeper', 0.435, 0.435, 0.435, 0.435)),
(-63, ('[NPC][Abyssal][Dark Matter All Tiers]All', 0.507, 0.477, 0.502, 0.493)),
(-64, ('[NPC][Abyssal][Electrical T1/T2]Drones', 0.323, 0.522, 0.529, 0.435)),
(-65, ('[NPC][Abyssal][Electrical T1/T2]Overmind', 0.521, 0.576, 0.612, 0.624)),
(-66, ('[NPC][Abyssal][Electrical T1/T2]Seeker', 0, 0.082, 0.082, 0.082)),
(-67, ('[NPC][Abyssal][Electrical T1/T2]Triglavian', 0.333, 0.401, 0.449, 0.37)),
(-68, ('[NPC][Abyssal][Electrical T1/T2]Drifter', 0.267, 0.403, 0.403, 0.403)),
(-69, ('[NPC][Abyssal][Electrical T1/T2]Sleeper', 0.329, 0.435, 0.435, 0.435)),
(-70, ('[NPC][Abyssal][Electrical T1/T2]All', 0.385, 0.477, 0.502, 0.493)),
(-71, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Drones', 0.255, 0.522, 0.529, 0.435)),
(-72, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Overmind', 0.457, 0.576, 0.612, 0.624)),
(-73, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Seeker', 0, 0.082, 0.082, 0.082)),
(-74, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Triglavian', 0.241, 0.401, 0.449, 0.37)),
(-75, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Drifter', 0.184, 0.403, 0.403, 0.403)),
(-76, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]Sleeper', 0.268, 0.435, 0.435, 0.435)),
(-77, ('[NPC][Abyssal][Electrical T3 (Some T5 Rooms)]All', 0.313, 0.477, 0.502, 0.493)),
(-78, ('[NPC][Abyssal][Electrical T4/T5]Drones', 0.193, 0.522, 0.529, 0.435)),
(-79, ('[NPC][Abyssal][Electrical T4/T5]Overmind', 0.398, 0.576, 0.612, 0.624)),
(-80, ('[NPC][Abyssal][Electrical T4/T5]Seeker', 0, 0.082, 0.082, 0.082)),
(-81, ('[NPC][Abyssal][Electrical T4/T5]Triglavian', 0.183, 0.401, 0.449, 0.37)),
(-82, ('[NPC][Abyssal][Electrical T4/T5]Drifter', 0.107, 0.403, 0.403, 0.403)),
(-83, ('[NPC][Abyssal][Electrical T4/T5]Sleeper', 0.215, 0.435, 0.435, 0.435)),
(-84, ('[NPC][Abyssal][Electrical T4/T5]All', 0.25, 0.477, 0.502, 0.493)),
(-85, ('[NPC][Abyssal][Firestorm T1/T2]Drones', 0.461, 0.425, 0.541, 0.443)),
(-86, ('[NPC][Abyssal][Firestorm T1/T2]Overmind', 0.65, 0.469, 0.625, 0.633)),
(-87, ('[NPC][Abyssal][Firestorm T1/T2]Seeker', 0.084, 0, 0.084, 0.084)),
(-88, ('[NPC][Abyssal][Firestorm T1/T2]Triglavian', 0.534, 0.266, 0.484, 0.366)),
(-89, ('[NPC][Abyssal][Firestorm T1/T2]Drifter', 0.422, 0.282, 0.422, 0.422)),
(-90, ('[NPC][Abyssal][Firestorm T1/T2]Sleeper', 0.512, 0.402, 0.512, 0.512)),
(-91, ('[NPC][Abyssal][Firestorm T1/T2]All', 0.541, 0.365, 0.524, 0.504)),
(-92, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Drones', 0.461, 0.36, 0.541, 0.443)),
(-93, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Overmind', 0.65, 0.391, 0.625, 0.633)),
(-94, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Seeker', 0.084, 0, 0.084, 0.084)),
(-95, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Triglavian', 0.534, 0.161, 0.484, 0.366)),
(-96, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Drifter', 0.422, 0.196, 0.422, 0.422)),
(-97, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]Sleeper', 0.512, 0.337, 0.512, 0.512)),
(-98, ('[NPC][Abyssal][Firestorm T3 (Some T5 Rooms)]All', 0.541, 0.284, 0.524, 0.504)),
(-99, ('[NPC][Abyssal][Firestorm T4/T5]Drones', 0.461, 0.305, 0.541, 0.443)),
(-100, ('[NPC][Abyssal][Firestorm T4/T5]Overmind', 0.65, 0.323, 0.625, 0.633)),
(-101, ('[NPC][Abyssal][Firestorm T4/T5]Seeker', 0.084, 0, 0.084, 0.084)),
(-102, ('[NPC][Abyssal][Firestorm T4/T5]Triglavian', 0.534, 0.082, 0.484, 0.366)),
(-103, ('[NPC][Abyssal][Firestorm T4/T5]Drifter', 0.422, 0.114, 0.422, 0.422)),
(-104, ('[NPC][Abyssal][Firestorm T4/T5]Sleeper', 0.512, 0.276, 0.512, 0.512)),
(-105, ('[NPC][Abyssal][Firestorm T4/T5]All', 0.541, 0.214, 0.524, 0.504)),
(-106, ('[NPC][Abyssal][Exotic T1/T2]Drones', 0.439, 0.522, 0.417, 0.435)),
(-107, ('[NPC][Abyssal][Exotic T1/T2]Overmind', 0.626, 0.576, 0.496, 0.624)),
(-108, ('[NPC][Abyssal][Exotic T1/T2]Seeker', 0.082, 0.082, 0, 0.082)),
(-109, ('[NPC][Abyssal][Exotic T1/T2]Triglavian', 0.477, 0.401, 0.284, 0.37)),
(-110, ('[NPC][Abyssal][Exotic T1/T2]Drifter', 0.403, 0.403, 0.267, 0.403)),
(-111, ('[NPC][Abyssal][Exotic T1/T2]Sleeper', 0.435, 0.435, 0.329, 0.435)),
(-112, ('[NPC][Abyssal][Exotic T1/T2]All', 0.507, 0.477, 0.373, 0.493)),
(-113, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Drones', 0.439, 0.522, 0.351, 0.435)),
(-114, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Overmind', 0.626, 0.576, 0.419, 0.624)),
(-115, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Seeker', 0.082, 0.082, 0, 0.082)),
(-116, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Triglavian', 0.477, 0.401, 0.176, 0.37)),
(-117, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Drifter', 0.403, 0.403, 0.184, 0.403)),
(-118, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]Sleeper', 0.435, 0.435, 0.268, 0.435)),
(-119, ('[NPC][Abyssal][Exotic T3 (Some T5 Rooms)]All', 0.507, 0.477, 0.293, 0.493)),
(-120, ('[NPC][Abyssal][Exotic T4/T5]Drones', 0.439, 0.522, 0.293, 0.435)),
(-121, ('[NPC][Abyssal][Exotic T4/T5]Overmind', 0.626, 0.576, 0.344, 0.624)),
(-122, ('[NPC][Abyssal][Exotic T4/T5]Seeker', 0.082, 0.082, 0, 0.082)),
(-123, ('[NPC][Abyssal][Exotic T4/T5]Triglavian', 0.477, 0.401, 0.107, 0.37)),
(-124, ('[NPC][Abyssal][Exotic T4/T5]Drifter', 0.403, 0.403, 0.107, 0.403)),
(-125, ('[NPC][Abyssal][Exotic T4/T5]Sleeper', 0.435, 0.435, 0.215, 0.435)),
(-126, ('[NPC][Abyssal][Exotic T4/T5]All', 0.507, 0.477, 0.223, 0.493)),
(-127, ('[NPC][Abyssal][Gamma T1/T2]Drones', 0.449, 0.54, 0.549, 0.336)),
(-128, ('[NPC][Abyssal][Gamma T1/T2]Overmind', 0.6, 0.557, 0.601, 0.504)),
(-129, ('[NPC][Abyssal][Gamma T1/T2]Seeker', 0.085, 0.085, 0.085, 0)),
(-130, ('[NPC][Abyssal][Gamma T1/T2]Triglavian', 0.463, 0.392, 0.447, 0.193)),
(-131, ('[NPC][Abyssal][Gamma T1/T2]Drifter', 0.428, 0.428, 0.428, 0.287)),
(-132, ('[NPC][Abyssal][Gamma T1/T2]Sleeper', 0.435, 0.435, 0.435, 0.329)),
(-133, ('[NPC][Abyssal][Gamma T1/T2]All', 0.493, 0.472, 0.5, 0.362)),
(-134, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Drones', 0.449, 0.54, 0.549, 0.264)),
(-135, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Overmind', 0.6, 0.557, 0.601, 0.428)),
(-136, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Seeker', 0.085, 0.085, 0.085, 0)),
(-137, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Triglavian', 0.463, 0.392, 0.447, 0.071)),
(-138, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Drifter', 0.428, 0.428, 0.428, 0.2)),
(-139, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]Sleeper', 0.435, 0.435, 0.435, 0.268)),
(-140, ('[NPC][Abyssal][Gamma T3 (Some T5 Rooms)]All', 0.493, 0.472, 0.5, 0.28)),
(-141, ('[NPC][Abyssal][Gamma T4/T5]Drones', 0.449, 0.54, 0.549, 0.197)),
(-142, ('[NPC][Abyssal][Gamma T4/T5]Overmind', 0.6, 0.557, 0.601, 0.356)),
(-143, ('[NPC][Abyssal][Gamma T4/T5]Seeker', 0.085, 0.085, 0.085, 0)),
(-144, ('[NPC][Abyssal][Gamma T4/T5]Triglavian', 0.463, 0.392, 0.447, 0.029)),
(-145, ('[NPC][Abyssal][Gamma T4/T5]Drifter', 0.428, 0.428, 0.428, 0.117)),
(-146, ('[NPC][Abyssal][Gamma T4/T5]Sleeper', 0.435, 0.435, 0.435, 0.215)),
(-147, ('[NPC][Abyssal][Gamma T4/T5]All', 0.493, 0.472, 0.5, 0.21))])
class TargetProfile:
# also determined import/export order - VERY IMPORTANT
DAMAGE_TYPES = ('em', 'thermal', 'kinetic', 'explosive')
_idealTarget = None
_builtins = None
def __init__(self, *args, **kwargs):
self.builtin = False
self.update(*args, **kwargs)
@reconstructor
def init(self):
self.builtin = False
def update(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0, maxVelocity=None, signatureRadius=None, radius=None):
self.emAmount = emAmount
self.thermalAmount = thermalAmount
self.kineticAmount = kineticAmount
self.explosiveAmount = explosiveAmount
self._maxVelocity = maxVelocity
self._signatureRadius = signatureRadius
self._radius = radius
@classmethod
def getBuiltinList(cls):
if cls._builtins is None:
cls.__generateBuiltins()
return list(cls._builtins.values())
@classmethod
def getBuiltinById(cls, id):
if cls._builtins is None:
cls.__generateBuiltins()
return cls._builtins.get(id)
@classmethod
def __generateBuiltins(cls):
cls._builtins = OrderedDict()
for id, data in BUILTINS.items():
rawName = data[0]
data = data[1:]
profile = TargetProfile(*data)
profile.ID = id
profile.rawName = rawName
profile.builtin = True
cls._builtins[id] = profile
@classmethod
def getIdeal(cls):
if cls._idealTarget is None:
cls._idealTarget = cls(
emAmount=0,
thermalAmount=0,
kineticAmount=0,
explosiveAmount=0,
maxVelocity=0,
signatureRadius=None,
radius=0)
cls._idealTarget.rawName = 'Ideal Target'
cls._idealTarget.ID = 0
cls._idealTarget.builtin = True
return cls._idealTarget
@property
def maxVelocity(self):
return self._maxVelocity or 0
@maxVelocity.setter
def maxVelocity(self, val):
self._maxVelocity = val
@property
def signatureRadius(self):
if self._signatureRadius is None or self._signatureRadius == -1:
return math.inf
return self._signatureRadius
@signatureRadius.setter
def signatureRadius(self, val):
if val is not None and math.isinf(val):
val = None
self._signatureRadius = val
@property
def radius(self):
return self._radius or 0
@radius.setter
def radius(self, val):
self._radius = val
@classmethod
def importPatterns(cls, text):
lines = re.split('[\n\r]+', text)
patterns = []
numPatterns = 0
# When we import damage profiles, we create new ones and update old ones. To do this, get a list of current
# patterns to allow lookup
lookup = {}
current = eos.db.getTargetProfileList()
for pattern in current:
lookup[pattern.rawName] = pattern
for line in lines:
try:
if line.strip()[0] == "#": # comments
continue
line = line.split('#', 1)[0] # allows for comments
type, data = line.rsplit('=', 1)
type, data = type.strip(), [d.strip() for d in data.split(',')]
except (KeyboardInterrupt, SystemExit):
raise
except:
pyfalog.warning("Data isn't in correct format, continue to next line.")
continue
if type not in ("TargetProfile", "TargetResists"):
continue
numPatterns += 1
name, dataRes, dataMisc = data[0], data[1:5], data[5:8]
fields = {}
for index, val in enumerate(dataRes):
val = float(val) if val else 0
if math.isinf(val):
val = 0
try:
assert 0 <= val <= 100
fields["%sAmount" % cls.DAMAGE_TYPES[index]] = val / 100
except (KeyboardInterrupt, SystemExit):
raise
except:
pyfalog.warning("Caught unhandled exception in import patterns.")
continue
if len(dataMisc) == 3:
for index, val in enumerate(dataMisc):
try:
fieldName = ("maxVelocity", "signatureRadius", "radius")[index]
except IndexError:
break
val = float(val) if val else 0
if fieldName != "signatureRadius" and math.isinf(val):
val = 0
fields[fieldName] = val
if len(fields) in (4, 7): # Avoid possible blank lines
if name.strip() in lookup:
pattern = lookup[name.strip()]
pattern.update(**fields)
eos.db.save(pattern)
else:
pattern = TargetProfile(**fields)
pattern.rawName = name.strip()
eos.db.save(pattern)
patterns.append(pattern)
eos.db.commit()
return patterns, numPatterns
EXPORT_FORMAT = "TargetProfile = %s,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f\n"
@classmethod
def exportPatterns(cls, *patterns):
out = "# Exported from pyfa\n#\n"
out += "# Values are in following format:\n"
out += "# TargetProfile = [name],[EM %],[Thermal %],[Kinetic %],[Explosive %],[Max velocity m/s],[Signature radius m],[Radius m]\n\n"
for dp in patterns:
out += cls.EXPORT_FORMAT % (
dp.rawName,
dp.emAmount * 100,
dp.thermalAmount * 100,
dp.kineticAmount * 100,
dp.explosiveAmount * 100,
dp.maxVelocity,
dp.signatureRadius,
dp.radius
)
return out.strip()
@property
def name(self):
return self.rawName
@property
def fullName(self):
categories, tail = self.__parseRawName()
return '{}{}'.format(''.join('[{}]'.format(c) for c in categories), tail)
@property
def shortName(self):
return self.__parseRawName()[1]
@property
def hierarchy(self):
return self.__parseRawName()[0]
def __parseRawName(self):
hierarchy = []
remainingName = self.rawName.strip() if self.rawName else ''
while True:
start, end = remainingName.find('['), remainingName.find(']')
if start == -1 or end == -1:
return hierarchy, remainingName
splitter = remainingName.find('|')
if splitter != -1 and splitter == start - 1:
return hierarchy, remainingName[1:]
hierarchy.append(remainingName[start + 1:end])
remainingName = remainingName[end + 1:].strip()
def __deepcopy__(self, memo):
p = TargetProfile(
self.emAmount, self.thermalAmount, self.kineticAmount, self.explosiveAmount,
self._maxVelocity, self._signatureRadius, self._radius)
p.rawName = "%s copy" % self.rawName
return p

View File

@@ -1,116 +0,0 @@
# ===============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of eos.
#
# eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# eos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import re
from logbook import Logger
import eos.db
pyfalog = Logger(__name__)
class TargetResists(object):
# also determined import/export order - VERY IMPORTANT
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
def __init__(self, *args, **kwargs):
self.update(*args, **kwargs)
def update(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0):
self.emAmount = emAmount
self.thermalAmount = thermalAmount
self.kineticAmount = kineticAmount
self.explosiveAmount = explosiveAmount
@classmethod
def importPatterns(cls, text):
lines = re.split('[\n\r]+', text)
patterns = []
numPatterns = 0
# When we import damage profiles, we create new ones and update old ones. To do this, get a list of current
# patterns to allow lookup
lookup = {}
current = eos.db.getTargetResistsList()
for pattern in current:
lookup[pattern.name] = pattern
for line in lines:
try:
if line.strip()[0] == "#": # comments
continue
line = line.split('#', 1)[0] # allows for comments
type, data = line.rsplit('=', 1)
type, data = type.strip(), data.split(',')
except:
pyfalog.warning("Data isn't in correct format, continue to next line.")
continue
if type != "TargetResists":
continue
numPatterns += 1
name, data = data[0], data[1:5]
fields = {}
for index, val in enumerate(data):
val = float(val)
try:
assert 0 <= val <= 100
fields["%sAmount" % cls.DAMAGE_TYPES[index]] = val / 100
except:
pyfalog.warning("Caught unhandled exception in import patterns.")
continue
if len(fields) == 4: # Avoid possible blank lines
if name.strip() in lookup:
pattern = lookup[name.strip()]
pattern.update(**fields)
eos.db.save(pattern)
else:
pattern = TargetResists(**fields)
pattern.name = name.strip()
eos.db.save(pattern)
patterns.append(pattern)
eos.db.commit()
return patterns, numPatterns
EXPORT_FORMAT = "TargetResists = %s,%.1f,%.1f,%.1f,%.1f\n"
@classmethod
def exportPatterns(cls, *patterns):
out = "# Exported from pyfa\n#\n"
out += "# Values are in following format:\n"
out += "# TargetResists = [name],[EM %],[Thermal %],[Kinetic %],[Explosive %]\n\n"
for dp in patterns:
out += cls.EXPORT_FORMAT % (
dp.name,
dp.emAmount * 100,
dp.thermalAmount * 100,
dp.kineticAmount * 100,
dp.explosiveAmount * 100
)
return out.strip()
def __deepcopy__(self, memo):
p = TargetResists(self.emAmount, self.thermalAmount, self.kineticAmount, self.explosiveAmount)
p.name = "%s copy" % self.name
return p

View File

@@ -24,7 +24,7 @@ import string
from sqlalchemy.orm import validates
class User(object):
class User:
def __init__(self, username, password=None, admin=False):
self.username = username
if password is not None:

69
eos/utils/cycles.py Normal file
View File

@@ -0,0 +1,69 @@
# Borrowed from new eos
from utils.repr import makeReprStr
class CycleInfo:
def __init__(self, activeTime, inactiveTime, quantity, isInactivityReload):
self.activeTime = activeTime
self.inactiveTime = inactiveTime
self.quantity = quantity
self.isInactivityReload = isInactivityReload
@property
def averageTime(self):
return self.activeTime + self.inactiveTime
def iterCycles(self):
i = 0
while i < self.quantity:
yield self.activeTime, self.inactiveTime, self.isInactivityReload
i += 1
def _getCycleQuantity(self):
return self.quantity
def _getTime(self):
return (self.activeTime + self.inactiveTime) * self.quantity
def __repr__(self):
spec = ['activeTime', 'inactiveTime', 'quantity', 'isInactivityReload']
return makeReprStr(self, spec)
class CycleSequence:
def __init__(self, sequence, quantity):
self.sequence = sequence
self.quantity = quantity
@property
def averageTime(self):
"""Get average time between cycles."""
return self._getTime() / self._getCycleQuantity()
def iterCycles(self):
i = 0
while i < self.quantity:
for cycleInfo in self.sequence:
for cycleTime, inactiveTime, isInactivityReload in cycleInfo.iterCycles():
yield cycleTime, inactiveTime, isInactivityReload
i += 1
def _getCycleQuantity(self):
quantity = 0
for item in self.sequence:
quantity += item._getCycleQuantity()
return quantity
def _getTime(self):
time = 0
for item in self.sequence:
time += item._getTime()
return time
def __repr__(self):
spec = ['sequence', 'quantity']
return makeReprStr(self, spec)

3
eos/utils/default.py Normal file
View File

@@ -0,0 +1,3 @@
class DEFAULT:
"""Singleton class to signify default argument value."""
pass

View File

@@ -18,7 +18,7 @@ keepDigits = int(sys.float_info.dig / 2)
def floatUnerr(value):
"""Round possible float number error, killing some precision in process."""
if value == 0:
if value in (0, math.inf):
return value
# Find round factor, taking into consideration that we want to keep at least
# predefined amount of significant digits

View File

@@ -0,0 +1,39 @@
"""
Slightly modified version of function taken from here:
https://github.com/pyinstaller/pyinstaller/issues/1905#issuecomment-525221546
"""
import pkgutil
def iterNamespace(name, path):
"""Pyinstaller-compatible namespace iteration.
Yields the name of all modules found at a given Fully-qualified path.
To have it running with pyinstaller, it requires to ensure a hook inject the
"hidden" modules from your plugins folder inside the executable:
- if your plugins are under the ``myappname/pluginfolder`` module
- create a file ``specs/hook-<myappname.pluginfolder>.py``
- content of this file should be:
.. code-block:: python
from PyInstaller.utils.hooks import collect_submodules
hiddenimports = collect_submodules('<myappname.pluginfolder>')
"""
prefix = name + "."
for p in pkgutil.iter_modules(path, prefix):
yield p[1]
# special handling when the package is bundled with PyInstaller 3.5
# See https://github.com/pyinstaller/pyinstaller/issues/1905#issuecomment-445787510
toc = set()
for importer in pkgutil.iter_importers(name.partition(".")[0]):
if hasattr(importer, 'toc'):
toc |= importer.toc
for name in toc:
if name.startswith(prefix):
yield name

27
eos/utils/round.py Normal file
View File

@@ -0,0 +1,27 @@
import math
def roundToPrec(val, prec, nsValue=None):
"""
nsValue: custom value which should be used to determine normalization shift
"""
# We're not rounding integers anyway
# Also make sure that we do not ask to calculate logarithm of zero
if int(val) == val:
return int(val)
roundFactor = int(prec - math.floor(math.log10(abs(val if nsValue is None else nsValue))) - 1)
# But we don't want to round integers
if roundFactor < 0:
roundFactor = 0
# Do actual rounding
val = round(val, roundFactor)
# Make sure numbers with .0 part designating float don't get through
if int(val) == val:
val = int(val)
return val
def roundDec(val, prec):
if int(val) == val:
return int(val)
return round(val, prec)

View File

@@ -18,6 +18,7 @@
# ===============================================================================
import math
from collections import namedtuple
from eos.const import SpoolType
@@ -36,15 +37,33 @@ def calculateSpoolup(modMaxValue, modStepValue, modCycleTime, spoolType, spoolAm
"""
if not modMaxValue or not modStepValue:
return 0, 0, 0
if spoolType == SpoolType.SCALE:
cycles = int(floatUnerr(spoolAmount * modMaxValue / modStepValue))
return cycles * modStepValue, cycles, cycles * modCycleTime
if spoolType == SpoolType.SPOOL_SCALE:
# Find out at which point of spoolup scale we're on, find out how many cycles
# is enough to reach it and recalculate spoolup value for that amount of cycles
cycles = math.ceil(floatUnerr(modMaxValue * spoolAmount / modStepValue))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.CYCLE_SCALE:
# For cycle scale, find out max amount of cycles and scale against it
cycles = round(spoolAmount * math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.TIME:
cycles = min(int(floatUnerr(spoolAmount / modCycleTime)), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles, cycles * modCycleTime
cycles = min(
# How many full cycles mod had by passed time
math.floor(floatUnerr(spoolAmount / modCycleTime)),
# Max amount of cycles
math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
elif spoolType == SpoolType.CYCLES:
cycles = min(int(spoolAmount), int(floatUnerr(modMaxValue / modStepValue)))
return cycles * modStepValue, cycles, cycles * modCycleTime
cycles = min(
# Consider full cycles only
math.floor(spoolAmount),
# Max amount of cycles
math.ceil(floatUnerr(modMaxValue / modStepValue)))
spoolValue = min(modMaxValue, cycles * modStepValue)
return spoolValue, cycles, cycles * modCycleTime
else:
return 0, 0, 0

View File

@@ -18,6 +18,10 @@
# ===============================================================================
from eos.utils.float import floatUnerr
from utils.repr import makeReprStr
class DmgTypes:
"""Container for damage data stats."""
@@ -39,12 +43,14 @@ class DmgTypes:
def __eq__(self, other):
if not isinstance(other, DmgTypes):
return NotImplemented
return all((
self.em == other.em,
self.thermal == other.thermal,
self.kinetic == other.kinetic,
self.explosive == other.explosive,
self.total == other.total))
# Round for comparison's sake because often damage profiles are
# generated from data which includes float errors
return (
floatUnerr(self.em) == floatUnerr(other.em) and
floatUnerr(self.thermal) == floatUnerr(other.thermal) and
floatUnerr(self.kinetic) == floatUnerr(other.kinetic) and
floatUnerr(self.explosive) == floatUnerr(other.explosive) and
floatUnerr(self.total) == floatUnerr(other.total))
def __bool__(self):
return any((
@@ -68,3 +74,144 @@ class DmgTypes:
self.explosive += other.explosive
self._calcTotal()
return self
def __mul__(self, mul):
return type(self)(
em=self.em * mul,
thermal=self.thermal * mul,
kinetic=self.kinetic * mul,
explosive=self.explosive * mul)
def __imul__(self, mul):
if mul == 1:
return
self.em *= mul
self.thermal *= mul
self.kinetic *= mul
self.explosive *= mul
self._calcTotal()
return self
def __truediv__(self, div):
return type(self)(
em=self.em / div,
thermal=self.thermal / div,
kinetic=self.kinetic / div,
explosive=self.explosive / div)
def __itruediv__(self, div):
if div == 1:
return
self.em /= div
self.thermal /= div
self.kinetic /= div
self.explosive /= div
self._calcTotal()
return self
def __repr__(self):
spec = DmgTypes.names()
spec.append('total')
return makeReprStr(self, spec)
@staticmethod
def names(short=None, postProcessor=None):
value = ['em', 'th', 'kin', 'exp'] if short else ['em', 'thermal', 'kinetic', 'explosive']
if postProcessor:
value = [postProcessor(x) for x in value]
return value
class RRTypes:
"""Container for tank data stats."""
def __init__(self, shield, armor, hull, capacitor):
self.shield = shield
self.armor = armor
self.hull = hull
self.capacitor = capacitor
# Iterator is needed to support tuple-style unpacking
def __iter__(self):
yield self.shield
yield self.armor
yield self.hull
yield self.capacitor
def __eq__(self, other):
if not isinstance(other, RRTypes):
return NotImplemented
# Round for comparison's sake because often tanking numbers are
# generated from data which includes float errors
return (
floatUnerr(self.shield) == floatUnerr(other.shield) and
floatUnerr(self.armor) == floatUnerr(other.armor) and
floatUnerr(self.hull) == floatUnerr(other.hull) and
floatUnerr(self.capacitor) == floatUnerr(other.capacitor))
def __bool__(self):
return any((self.shield, self.armor, self.hull, self.capacitor))
def __add__(self, other):
return type(self)(
shield=self.shield + other.shield,
armor=self.armor + other.armor,
hull=self.hull + other.hull,
capacitor=self.capacitor + other.capacitor)
def __iadd__(self, other):
self.shield += other.shield
self.armor += other.armor
self.hull += other.hull
self.capacitor += other.capacitor
return self
def __mul__(self, mul):
return type(self)(
shield=self.shield * mul,
armor=self.armor * mul,
hull=self.hull * mul,
capacitor=self.capacitor * mul)
def __imul__(self, mul):
if mul == 1:
return
self.shield *= mul
self.armor *= mul
self.hull *= mul
self.capacitor *= mul
return self
def __truediv__(self, div):
return type(self)(
shield=self.shield / div,
armor=self.armor / div,
hull=self.hull / div,
capacitor=self.capacitor / div)
def __itruediv__(self, div):
if div == 1:
return self
self.shield /= div
self.armor /= div
self.hull /= div
self.capacitor /= div
return self
def __repr__(self):
spec = RRTypes.names(False)
return makeReprStr(self, spec)
@staticmethod
def names(ehpOnly=True, postProcessor=None):
value = ['shield', 'armor', 'hull']
if not ehpOnly:
value.append('capacitor')
if postProcessor:
value = [postProcessor(x) for x in value]
return value

BIN
eve.db

Binary file not shown.

22
graphs/__init__.py Normal file
View File

@@ -0,0 +1,22 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from .gui.canvasPanel import graphFrame_enabled
from .gui.frame import GraphFrame

37
graphs/calc.py Normal file
View File

@@ -0,0 +1,37 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from service.settings import GraphSettings
def checkLockRange(src, distance):
if distance is None:
return True
if GraphSettings.getInstance().get('ignoreLockRange'):
return True
return distance <= src.item.maxTargetRange
def checkDroneControlRange(src, distance):
if distance is None:
return True
if GraphSettings.getInstance().get('ignoreDCR'):
return True
return distance <= src.item.extraAttributes['droneControlRange']

30
graphs/data/__init__.py Normal file
View File

@@ -0,0 +1,30 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from . import fitDamageStats
from . import fitEwarStats
from . import fitRemoteReps
from . import fitShieldRegen
from . import fitCapacitor
from . import fitMobility
from . import fitWarpTime
from . import fitLockTime
# Hidden graphs, available via ctrl-alt-g
from . import fitEcmBurstScanresDamps

View File

@@ -0,0 +1,23 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from .cache import FitDataCache
from .defs import XDef, YDef, VectorDef, Input, InputCheckbox
from .getter import PointGetter, SmoothPointGetter
from .graph import FitGraph

View File

@@ -18,26 +18,14 @@
# =============================================================================
class Graph(object):
views = []
@classmethod
def register(cls):
Graph.views.append(cls)
class FitDataCache:
def __init__(self):
self.name = ""
self._data = {}
def getFields(self, fit, fields):
raise NotImplementedError()
def clearForFit(self, fitID):
if fitID in self._data:
del self._data[fitID]
def getIcons(self):
return None
# noinspection PyUnresolvedReferences
from gui.builtinGraphs import (
fitDpsRange, # noqa: E402, F401
fitDpsTime, # noqa: E402, F401
fitDmgTime, # noqa: E402, F401
)
def clearAll(self):
self._data.clear()

136
graphs/data/base/defs.py Normal file
View File

@@ -0,0 +1,136 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from collections import namedtuple
VectorDef = namedtuple('VectorDef', ('lengthHandle', 'lengthUnit', 'angleHandle', 'angleUnit', 'label'))
class YDef:
def __init__(self, handle, unit, label, selectorLabel=None, hidden=False):
self.handle = handle
self.unit = unit
self.label = label
self._selectorLabel = selectorLabel
self.hidden = hidden
@property
def selectorLabel(self):
if self._selectorLabel is not None:
return self._selectorLabel
return self.label
def __hash__(self):
return hash((self.handle, self.unit, self.label, self._selectorLabel))
def __eq__(self, other):
if not isinstance(other, YDef):
return False
return all((
self.handle == other.handle,
self.unit == other.unit,
self.label == other.label,
self._selectorLabel == other._selectorLabel))
class XDef:
def __init__(self, handle, unit, label, mainInput, selectorLabel=None, hidden=False):
self.handle = handle
self.unit = unit
self.label = label
self.mainInput = mainInput
self._selectorLabel = selectorLabel
self.hidden = hidden
@property
def selectorLabel(self):
if self._selectorLabel is not None:
return self._selectorLabel
return self.label
def __hash__(self):
return hash((self.handle, self.unit, self.label, self.mainInput, self._selectorLabel))
def __eq__(self, other):
if not isinstance(other, XDef):
return False
return all((
self.handle == other.handle,
self.unit == other.unit,
self.label == other.label,
self.mainInput == other.mainInput,
self._selectorLabel == other._selectorLabel))
class Input:
def __init__(self, handle, unit, label, iconID, defaultValue, defaultRange, mainTooltip=None, secondaryTooltip=None, conditions=()):
self.handle = handle
self.unit = unit
self.label = label
self.iconID = iconID
self.defaultValue = defaultValue
self.defaultRange = defaultRange
self.mainTooltip = mainTooltip
self.secondaryTooltip = secondaryTooltip
# Format: ((x condition, y condition), (x condition, y condition), ...)
self.conditions = tuple(conditions)
def __hash__(self):
return hash((self.handle, self.unit, self.label, self.iconID, self.defaultValue, self.defaultRange, self.mainTooltip, self.secondaryTooltip, self.conditions))
def __eq__(self, other):
if not isinstance(other, Input):
return False
return all((
self.handle == other.handle,
self.unit == other.unit,
self.label == other.label,
self.iconID == other.iconID,
self.defaultValue == other.defaultValue,
self.defaultRange == other.defaultRange,
self.mainTooltip == other.mainTooltip,
self.secondaryTooltip == other.secondaryTooltip,
self.conditions == other.conditions))
class InputCheckbox:
def __init__(self, handle, label, defaultValue, conditions=()):
self.handle = handle
self.label = label
self.defaultValue = defaultValue
# Format: ((x condition, y condition), (x condition, y condition), ...)
self.conditions = tuple(conditions)
def __hash__(self):
return hash((self.handle, self.label, self.defaultValue, self.conditions))
def __eq__(self, other):
if not isinstance(other, Input):
return False
return all((
self.handle == other.handle,
self.label == other.label,
self.defaultValue == other.defaultValue,
self.conditions == other.conditions))

View File

@@ -0,0 +1,95 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
from abc import ABCMeta, abstractmethod
class PointGetter(metaclass=ABCMeta):
def __init__(self, graph):
self.graph = graph
@abstractmethod
def getRange(self, xRange, miscParams, src, tgt):
raise NotImplementedError
@abstractmethod
def getPoint(self, x, miscParams, src, tgt):
raise NotImplementedError
class SmoothPointGetter(PointGetter, metaclass=ABCMeta):
_baseResolution = 200
_extraDepth = 0
def getRange(self, xRange, miscParams, src, tgt):
xs = []
ys = []
commonData = self._getCommonData(miscParams=miscParams, src=src, tgt=tgt)
def addExtraPoints(x1, y1, x2, y2, depth):
if depth <= 0 or y1 == y2:
return
newX = (x1 + x2) / 2
newY = self._calculatePoint(x=newX, miscParams=miscParams, src=src, tgt=tgt, commonData=commonData)
addExtraPoints(x1=prevX, y1=prevY, x2=newX, y2=newY, depth=depth - 1)
xs.append(newX)
ys.append(newY)
addExtraPoints(x1=newX, y1=newY, x2=x2, y2=y2, depth=depth - 1)
prevX = None
prevY = None
# Go through X points defined by our resolution setting
for x in self._xIterLinear(xRange):
y = self._calculatePoint(x=x, miscParams=miscParams, src=src, tgt=tgt, commonData=commonData)
if prevX is not None and prevY is not None:
# And if Y values of adjacent data points are not equal, add extra points
# depending on extra depth setting
addExtraPoints(x1=prevX, y1=prevY, x2=x, y2=y, depth=self._extraDepth)
prevX = x
prevY = y
xs.append(x)
ys.append(y)
return xs, ys
def getPoint(self, x, miscParams, src, tgt):
commonData = self._getCommonData(miscParams=miscParams, src=src, tgt=tgt)
return self._calculatePoint(x=x, miscParams=miscParams, src=src, tgt=tgt, commonData=commonData)
def _xIterLinear(self, xRange):
xLow = min(xRange)
xHigh = max(xRange)
# Resolution defines amount of ranges between points here,
# not amount of points
step = (xHigh - xLow) / self._baseResolution
if step == 0 or math.isnan(step):
yield xLow
else:
for i in range(self._baseResolution + 1):
yield xLow + step * i
def _getCommonData(self, miscParams, src, tgt):
return {}
@abstractmethod
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
raise NotImplementedError

299
graphs/data/base/graph.py Normal file
View File

@@ -0,0 +1,299 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from eos.utils.float import floatUnerr
from service.const import GraphCacheCleanupReason
class FitGraph(metaclass=ABCMeta):
# UI stuff
hidden = False
views = []
viewMap = {}
@classmethod
def register(cls):
FitGraph.views.append(cls)
FitGraph.viewMap[cls.internalName] = cls
def __init__(self):
# Format: {(fit ID, target type, target ID): {(xSpec, ySpec): (xs, ys)}}
self._plotCache = {}
# Format: {(fit ID, target type, target ID): {(xSpec, ySpec): {x: y}}}
self._pointCache = {}
@property
@abstractmethod
def name(self):
raise NotImplementedError
@property
@abstractmethod
def internalName(self):
raise NotImplementedError
@property
@abstractmethod
def yDefs(self):
raise NotImplementedError
@property
def yDefMap(self):
return OrderedDict(((y.handle, y.unit), y) for y in self.yDefs)
@property
@abstractmethod
def xDefs(self):
raise NotImplementedError
@property
def xDefMap(self):
return OrderedDict(((x.handle, x.unit), x) for x in self.xDefs)
@property
def inputs(self):
raise NotImplementedError
@property
def inputMap(self):
return OrderedDict(((i.handle, i.unit), i) for i in self.inputs)
checkboxes = ()
@property
def checkboxesMap(self):
return OrderedDict((ec.handle, ec) for ec in self.checkboxes)
hasTargets = False
srcVectorDef = None
tgtVectorDef = None
srcExtraCols = ()
tgtExtraCols = ()
usesHpEffectivity = False
def getPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, src, tgt=None):
cacheKey = self._makeCacheKey(src=src, tgt=tgt)
try:
plotData = self._plotCache[cacheKey][(ySpec, xSpec)]
except KeyError:
plotData = self._calcPlotPoints(
mainInput=mainInput, miscInputs=miscInputs,
xSpec=xSpec, ySpec=ySpec, src=src, tgt=tgt)
self._plotCache.setdefault(cacheKey, {})[(ySpec, xSpec)] = plotData
return plotData
def getPoint(self, x, miscInputs, xSpec, ySpec, src, tgt=None):
cacheKey = self._makeCacheKey(src=src, tgt=tgt)
try:
y = self._pointCache[cacheKey][(ySpec, xSpec)][x]
except KeyError:
y = self._calcPoint(x=x, miscInputs=miscInputs, xSpec=xSpec, ySpec=ySpec, src=src, tgt=tgt)
self._pointCache.setdefault(cacheKey, {}).setdefault((ySpec, xSpec), {})[x] = y
return y
def clearCache(self, reason, extraData=None):
caches = (self._plotCache, self._pointCache)
plotKeysToClear = set()
# If fit changed - clear plots which concern this fit
if reason in (GraphCacheCleanupReason.fitChanged, GraphCacheCleanupReason.fitRemoved):
for cache in caches:
for cacheKey in cache:
cacheFitID, cacheTgtType, cacheTgtID = cacheKey
if extraData == cacheFitID:
plotKeysToClear.add(cacheKey)
elif cacheTgtType == 'fit' and extraData == cacheTgtID:
plotKeysToClear.add(cacheKey)
# Same for profile
elif reason in (GraphCacheCleanupReason.profileChanged, GraphCacheCleanupReason.profileRemoved):
for cache in caches:
for cacheKey in cache:
cacheFitID, cacheTgtType, cacheTgtID = cacheKey
if cacheTgtType == 'profile' and extraData == cacheTgtID:
plotKeysToClear.add(cacheKey)
# Target fit resist mode changed
elif reason == GraphCacheCleanupReason.resistModeChanged:
for cache in caches:
for cacheKey in cache:
cacheFitID, cacheTgtType, cacheTgtID = cacheKey
if cacheTgtType == 'fit' and extraData == cacheTgtID:
plotKeysToClear.add(cacheKey)
# Wipe out whole plot cache otherwise
else:
for cache in caches:
for cacheKey in cache:
plotKeysToClear.add(cacheKey)
# Do actual cleanup
for cache in caches:
for cacheKey in plotKeysToClear:
try:
del cache[cacheKey]
except KeyError:
pass
# Process any internal caches graphs might have
self._clearInternalCache(reason, extraData)
def _makeCacheKey(self, src, tgt):
if tgt is not None and tgt.isFit:
tgtType = 'fit'
tgtItemID = tgt.item.ID
elif tgt is not None and tgt.isProfile:
tgtType = 'profile'
tgtItemID = tgt.item.ID
else:
tgtType = None
tgtItemID = None
cacheKey = (src.item.ID, tgtType, tgtItemID)
return cacheKey
def _clearInternalCache(self, reason, extraData):
return
# Calculation stuff
def _calcPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, src, tgt):
mainParamRange = self._normalizeMain(mainInput=mainInput, src=src, tgt=tgt)
miscParams = self._normalizeMisc(miscInputs=miscInputs, src=src, tgt=tgt)
mainParamRange = self._limitMain(mainParamRange=mainParamRange, src=src, tgt=tgt)
miscParams = self._limitMisc(miscParams=miscParams, src=src, tgt=tgt)
xs, ys = self._getPlotPoints(
xRange=mainParamRange[1], miscParams=miscParams,
xSpec=xSpec, ySpec=ySpec, src=src, tgt=tgt)
ys = self._denormalizeValues(values=ys, axisSpec=ySpec, src=src, tgt=tgt)
# Sometimes x denormalizer may fail (e.g. during conversion of 0 ship speed to %).
# If both inputs and outputs are in %, do some extra processing to at least have
# proper graph which shows the same value over whole specified relative parameter
# range
try:
xs = self._denormalizeValues(values=xs, axisSpec=xSpec, src=src, tgt=tgt)
except ZeroDivisionError:
if mainInput.unit == xSpec.unit == '%' and len(set(floatUnerr(y) for y in ys)) == 1:
xs = [min(mainInput.value), max(mainInput.value)]
ys = [ys[0], ys[0]]
else:
raise
else:
# Same for NaN which means we tried to denormalize infinity values, which might be the
# case for the ideal target profile with infinite signature radius
if mainInput.unit == xSpec.unit == '%' and all(math.isnan(x) for x in xs):
xs = [min(mainInput.value), max(mainInput.value)]
ys = [ys[0], ys[0]]
return xs, ys
def _calcPoint(self, x, miscInputs, xSpec, ySpec, src, tgt):
x = self._normalizeValue(value=x, axisSpec=xSpec, src=src, tgt=tgt)
miscParams = self._normalizeMisc(miscInputs=miscInputs, src=src, tgt=tgt)
miscParams = self._limitMisc(miscParams=miscParams, src=src, tgt=tgt)
y = self._getPoint(x=x, miscParams=miscParams, xSpec=xSpec, ySpec=ySpec, src=src, tgt=tgt)
y = self._denormalizeValue(value=y, axisSpec=ySpec, src=src, tgt=tgt)
return y
_normalizers = {}
def _normalizeMain(self, mainInput, src, tgt):
key = (mainInput.handle, mainInput.unit)
if key in self._normalizers:
normalizer = self._normalizers[key]
mainParamRange = (mainInput.handle, tuple(normalizer(v, src, tgt) for v in mainInput.value))
else:
mainParamRange = (mainInput.handle, mainInput.value)
return mainParamRange
def _normalizeMisc(self, miscInputs, src, tgt):
miscParams = {}
for miscInput in miscInputs:
key = (miscInput.handle, miscInput.unit)
if key in self._normalizers:
normalizer = self._normalizers[key]
miscParams[miscInput.handle] = normalizer(miscInput.value, src, tgt)
else:
miscParams[miscInput.handle] = miscInput.value
return miscParams
def _normalizeValue(self, value, axisSpec, src, tgt):
key = (axisSpec.handle, axisSpec.unit)
if key in self._normalizers:
normalizer = self._normalizers[key]
value = normalizer(value, src, tgt)
return value
_limiters = {}
def _limitMain(self, mainParamRange, src, tgt):
mainHandle, mainValue = mainParamRange
if mainHandle in self._limiters:
limiter = self._limiters[mainHandle]
mainParamRange = (mainHandle, tuple(self.__limitToRange(v, limiter(src, tgt)) for v in mainValue))
return mainParamRange
def _limitMisc(self, miscParams, src, tgt):
for miscHandle in miscParams:
if miscHandle in self._limiters:
limiter = self._limiters[miscHandle]
miscValue = miscParams[miscHandle]
miscParams[miscHandle] = self.__limitToRange(miscValue, limiter(src, tgt))
return miscParams
@staticmethod
def __limitToRange(val, limitRange):
if val is None:
return None
val = max(val, min(limitRange))
val = min(val, max(limitRange))
return val
_getters = {}
def _getPlotPoints(self, xRange, miscParams, xSpec, ySpec, src, tgt):
try:
getterClass = self._getters[(xSpec.handle, ySpec.handle)]
except KeyError:
return [], []
else:
getter = getterClass(graph=self)
return getter.getRange(xRange=xRange, miscParams=miscParams, src=src, tgt=tgt)
def _getPoint(self, x, miscParams, xSpec, ySpec, src, tgt):
try:
getterClass = self._getters[(xSpec.handle, ySpec.handle)]
except KeyError:
return [], []
else:
getter = getterClass(graph=self)
return getter.getPoint(x=x, miscParams=miscParams, src=src, tgt=tgt)
_denormalizers = {}
def _denormalizeValues(self, values, axisSpec, src, tgt):
key = (axisSpec.handle, axisSpec.unit)
if key in self._denormalizers:
denormalizer = self._denormalizers[key]
values = [denormalizer(v, src, tgt) for v in values]
return values
def _denormalizeValue(self, value, axisSpec, src, tgt):
key = (axisSpec.handle, axisSpec.unit)
if key in self._denormalizers:
denormalizer = self._denormalizers[key]
value = denormalizer(value, src, tgt)
return value

View File

@@ -0,0 +1,24 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from .graph import FitCapacitorGraph
FitCapacitorGraph.register()

View File

@@ -0,0 +1,197 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
from graphs.data.base import SmoothPointGetter
class Time2CapAmountGetter(SmoothPointGetter):
def getRange(self, xRange, miscParams, src, tgt):
# Use smooth getter when we're not using cap sim
if not miscParams['useCapsim']:
return super().getRange(xRange=xRange, miscParams=miscParams, src=src, tgt=tgt)
capAmountT0 = miscParams['capAmountT0'] or 0
capSimDataRaw = src.item.getCapSimData(startingCap=capAmountT0)
# Same here, no cap sim data - use smooth getter which considers only regen
if not capSimDataRaw:
return super().getRange(xRange=xRange, miscParams=miscParams, src=src, tgt=tgt)
capSimDataMaxTime = capSimDataRaw[-1][0]
minTime, maxTime = xRange
maxTime = min(maxTime, capSimDataMaxTime)
maxPointXDistance = (maxTime - minTime) / self._baseResolution
capSimDataInRange = {k: v for k, v in capSimDataRaw if minTime <= k <= maxTime}
prevTime = minTime
xs = []
ys = []
capSimDataBefore = {k: v for k, v in capSimDataRaw if k < minTime}
# When time range lies to the right of last cap sim data point, return nothing
if len(capSimDataBefore) > 0 and max(capSimDataBefore) == capSimDataMaxTime:
return xs, ys
maxCapAmount = src.item.ship.getModifiedItemAttr('capacitorCapacity')
capRegenTime = src.item.ship.getModifiedItemAttr('rechargeRate') / 1000
def plotCapRegen(prevTime, prevCap, currentTime):
subrangeAmount = math.ceil((currentTime - prevTime) / maxPointXDistance)
subrangeLength = (currentTime - prevTime) / subrangeAmount
for i in range(1, subrangeAmount + 1):
subrangeTime = prevTime + subrangeLength * i
subrangeCap = calculateCapAmount(
maxCapAmount=maxCapAmount,
capRegenTime=capRegenTime,
capAmountT0=prevCap,
time=subrangeTime - prevTime)
xs.append(subrangeTime)
ys.append(subrangeCap)
# Calculate starting cap for first value seen in our range
if capSimDataBefore:
timeBefore = max(capSimDataBefore)
capBefore = capSimDataBefore[timeBefore]
prevCap = calculateCapAmount(
maxCapAmount=maxCapAmount,
capRegenTime=capRegenTime,
capAmountT0=capBefore,
time=prevTime - timeBefore)
else:
prevCap = calculateCapAmount(
maxCapAmount=maxCapAmount,
capRegenTime=capRegenTime,
capAmountT0=capAmountT0,
time=prevTime)
xs.append(prevTime)
ys.append(prevCap)
for currentTime in sorted(capSimDataInRange):
if currentTime > prevTime:
plotCapRegen(prevTime=prevTime, prevCap=prevCap, currentTime=currentTime)
currentCap = capSimDataInRange[currentTime]
xs.append(currentTime)
ys.append(currentCap)
prevTime = currentTime
prevCap = currentCap
if maxTime > prevTime:
plotCapRegen(prevTime=prevTime, prevCap=prevCap, currentTime=maxTime)
return xs, ys
def getPoint(self, x, miscParams, src, tgt):
# Use smooth getter when we're not using cap sim
if not miscParams['useCapsim']:
return super().getPoint(x=x, miscParams=miscParams, src=src, tgt=tgt)
capAmountT0 = miscParams['capAmountT0'] or 0
capSimDataRaw = src.item.getCapSimData(startingCap=capAmountT0)
# Same here, no cap sim data - use smooth getter which considers only regen
if not capSimDataRaw:
return super().getPoint(x=x, miscParams=miscParams, src=src, tgt=tgt)
currentTime = x
capSimDataBefore = {k: v for k, v in capSimDataRaw if k <= currentTime}
capSimDataMaxTime = capSimDataRaw[-1][0]
# When time range lies to the right of last cap sim data point, return nothing
if len(capSimDataBefore) > 0 and max(capSimDataBefore) == capSimDataMaxTime:
return None
maxCapAmount = src.item.ship.getModifiedItemAttr('capacitorCapacity')
capRegenTime = src.item.ship.getModifiedItemAttr('rechargeRate') / 1000
if capSimDataBefore:
timeBefore = max(capSimDataBefore)
capBefore = capSimDataBefore[timeBefore]
if timeBefore == currentTime:
currentCap = capBefore
else:
currentCap = calculateCapAmount(
maxCapAmount=maxCapAmount,
capRegenTime=capRegenTime,
capAmountT0=capBefore,
time=currentTime - timeBefore)
else:
currentCap = calculateCapAmount(
maxCapAmount=maxCapAmount,
capRegenTime=capRegenTime,
capAmountT0=capAmountT0,
time=currentTime)
return currentCap
def _getCommonData(self, miscParams, src, tgt):
return {
'maxCapAmount': src.item.ship.getModifiedItemAttr('capacitorCapacity'),
'capRegenTime': src.item.ship.getModifiedItemAttr('rechargeRate') / 1000}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
time = x
capAmount = calculateCapAmount(
maxCapAmount=commonData['maxCapAmount'],
capRegenTime=commonData['capRegenTime'],
capAmountT0=miscParams['capAmountT0'] or 0,
time=time)
return capAmount
class Time2CapRegenGetter(SmoothPointGetter):
def _getCommonData(self, miscParams, src, tgt):
return {
'maxCapAmount': src.item.ship.getModifiedItemAttr('capacitorCapacity'),
'capRegenTime': src.item.ship.getModifiedItemAttr('rechargeRate') / 1000}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
time = x
capAmount = calculateCapAmount(
maxCapAmount=commonData['maxCapAmount'],
capRegenTime=commonData['capRegenTime'],
capAmountT0=miscParams['capAmountT0'] or 0,
time=time)
capRegen = calculateCapRegen(
maxCapAmount=commonData['maxCapAmount'],
capRegenTime=commonData['capRegenTime'],
currentCapAmount=capAmount)
return capRegen
# Useless, but valid combination of x and y
class CapAmount2CapAmountGetter(SmoothPointGetter):
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
capAmount = x
return capAmount
class CapAmount2CapRegenGetter(SmoothPointGetter):
def _getCommonData(self, miscParams, src, tgt):
return {
'maxCapAmount': src.item.ship.getModifiedItemAttr('capacitorCapacity'),
'capRegenTime': src.item.ship.getModifiedItemAttr('rechargeRate') / 1000}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
capAmount = x
capRegen = calculateCapRegen(
maxCapAmount=commonData['maxCapAmount'],
capRegenTime=commonData['capRegenTime'],
currentCapAmount=capAmount)
return capRegen
def calculateCapAmount(maxCapAmount, capRegenTime, capAmountT0, time):
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
return maxCapAmount * (1 + math.exp(5 * -time / capRegenTime) * (math.sqrt(capAmountT0 / maxCapAmount) - 1)) ** 2
def calculateCapRegen(maxCapAmount, capRegenTime, currentCapAmount):
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
return 10 * maxCapAmount / capRegenTime * (math.sqrt(currentCapAmount / maxCapAmount) - currentCapAmount / maxCapAmount)

View File

@@ -0,0 +1,62 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from graphs.data.base import FitGraph, XDef, YDef, Input, InputCheckbox
from .getter import CapAmount2CapAmountGetter, CapAmount2CapRegenGetter, Time2CapAmountGetter, Time2CapRegenGetter
class FitCapacitorGraph(FitGraph):
# UI stuff
internalName = 'capacitorGraph'
name = 'Capacitor'
xDefs = [
XDef(handle='time', unit='s', label='Time', mainInput=('time', 's')),
XDef(handle='capAmount', unit='GJ', label='Cap amount', mainInput=('capAmount', '%')),
XDef(handle='capAmount', unit='%', label='Cap amount', mainInput=('capAmount', '%'))]
yDefs = [
YDef(handle='capAmount', unit='GJ', label='Cap amount'),
YDef(handle='capRegen', unit='GJ/s', label='Cap regen')]
inputs = [
Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=120, defaultRange=(0, 300), conditions=[
(('time', 's'), None)]),
Input(handle='capAmount', unit='%', label='Cap amount', iconID=1668, defaultValue=25, defaultRange=(0, 100), conditions=[
(('capAmount', 'GJ'), None),
(('capAmount', '%'), None)]),
Input(handle='capAmountT0', unit='%', label='Starting cap amount', iconID=1668, defaultValue=100, defaultRange=(0, 100), conditions=[
(('time', 's'), None)])]
checkboxes = [InputCheckbox(handle='useCapsim', label='Use capacitor simulator', defaultValue=True, conditions=[
(('time', 's'), ('capAmount', 'GJ'))])]
srcExtraCols = ('CapAmount', 'CapTime')
# Calculation stuff
_normalizers = {
('capAmount', '%'): lambda v, src, tgt: v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity'),
('capAmountT0', '%'): lambda v, src, tgt: None if v is None else v / 100 * src.item.ship.getModifiedItemAttr('capacitorCapacity')}
_limiters = {
'time': lambda src, tgt: (0, 3600),
'capAmount': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity')),
'capAmountT0': lambda src, tgt: (0, src.item.ship.getModifiedItemAttr('capacitorCapacity'))}
_getters = {
('time', 'capAmount'): Time2CapAmountGetter,
('time', 'capRegen'): Time2CapRegenGetter,
('capAmount', 'capAmount'): CapAmount2CapAmountGetter,
('capAmount', 'capRegen'): CapAmount2CapRegenGetter}
_denormalizers = {('capAmount', '%'): lambda v, src, tgt: v * 100 / src.item.ship.getModifiedItemAttr('capacitorCapacity')}

View File

@@ -0,0 +1,24 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from .graph import FitDamageStatsGraph
FitDamageStatsGraph.register()

View File

@@ -0,0 +1,22 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from .projected import ProjectedDataCache
from .time import TimeCache

View File

@@ -0,0 +1,121 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from collections import namedtuple
from eos.modifiedAttributeDict import getResistanceAttrID
from graphs.data.base import FitDataCache
ModProjData = namedtuple('ModProjData', ('boost', 'optimal', 'falloff', 'stackingGroup', 'resAttrID'))
MobileProjData = namedtuple('MobileProjData', ('boost', 'optimal', 'falloff', 'stackingGroup', 'resAttrID', 'speed', 'radius'))
class ProjectedDataCache(FitDataCache):
def getProjModData(self, src):
try:
projectedData = self._data[src.item.ID]['modules']
except KeyError:
# Format of items for both: (boost strength, optimal, falloff, stacking group, resistance attr ID)
webMods = []
tpMods = []
projectedData = self._data.setdefault(src.item.ID, {})['modules'] = (webMods, tpMods)
for mod in src.item.activeModulesIter():
for webEffectName in ('remoteWebifierFalloff', 'structureModuleEffectStasisWebifier'):
if webEffectName in mod.item.effects:
webMods.append(ModProjData(
mod.getModifiedItemAttr('speedFactor'),
mod.maxRange or 0,
mod.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects[webEffectName])))
if 'doomsdayAOEWeb' in mod.item.effects:
webMods.append(ModProjData(
mod.getModifiedItemAttr('speedFactor'),
max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()),
mod.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects['doomsdayAOEWeb'])))
for tpEffectName in ('remoteTargetPaintFalloff', 'structureModuleEffectTargetPainter'):
if tpEffectName in mod.item.effects:
tpMods.append(ModProjData(
mod.getModifiedItemAttr('signatureRadiusBonus'),
mod.maxRange or 0,
mod.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects[tpEffectName])))
if 'doomsdayAOEPaint' in mod.item.effects:
tpMods.append(ModProjData(
mod.getModifiedItemAttr('signatureRadiusBonus'),
max(0, (mod.maxRange or 0) + mod.getModifiedItemAttr('doomsdayAOERange') - src.getRadius()),
mod.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=mod, effect=mod.item.effects['doomsdayAOEPaint'])))
return projectedData
def getProjDroneData(self, src):
try:
projectedData = self._data[src.item.ID]['drones']
except KeyError:
# Format of items for both: (boost strength, optimal, falloff, stacking group, resistance attr ID, drone speed, drone radius)
webDrones = []
tpDrones = []
projectedData = self._data.setdefault(src.item.ID, {})['drones'] = (webDrones, tpDrones)
for drone in src.item.activeDronesIter():
if 'remoteWebifierEntity' in drone.item.effects:
webDrones.extend(drone.amountActive * (MobileProjData(
drone.getModifiedItemAttr('speedFactor'),
drone.maxRange or 0,
drone.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=drone, effect=drone.item.effects['remoteWebifierEntity']),
drone.getModifiedItemAttr('maxVelocity'),
drone.getModifiedItemAttr('radius')),))
if 'remoteTargetPaintEntity' in drone.item.effects:
tpDrones.extend(drone.amountActive * (MobileProjData(
drone.getModifiedItemAttr('signatureRadiusBonus'),
drone.maxRange or 0,
drone.falloff or 0,
'default',
getResistanceAttrID(modifyingItem=drone, effect=drone.item.effects['remoteTargetPaintEntity']),
drone.getModifiedItemAttr('maxVelocity'),
drone.getModifiedItemAttr('radius')),))
return projectedData
def getProjFighterData(self, src):
try:
projectedData = self._data[src.item.ID]['fighters']
except KeyError:
# Format of items for both: (boost strength, optimal, falloff, stacking group, resistance attr ID, fighter speed, fighter radius)
webFighters = []
tpFighters = []
projectedData = self._data.setdefault(src.item.ID, {})['fighters'] = (webFighters, tpFighters)
for fighter, ability in src.item.activeFighterAbilityIter():
if ability.effect.name == 'fighterAbilityStasisWebifier':
webFighters.append(MobileProjData(
fighter.getModifiedItemAttr('fighterAbilityStasisWebifierSpeedPenalty') * fighter.amount,
fighter.getModifiedItemAttr('fighterAbilityStasisWebifierOptimalRange'),
fighter.getModifiedItemAttr('fighterAbilityStasisWebifierFalloffRange'),
'default',
getResistanceAttrID(modifyingItem=fighter, effect=fighter.item.effects['fighterAbilityStasisWebifier']),
fighter.getModifiedItemAttr('maxVelocity'),
fighter.getModifiedItemAttr('radius')))
return projectedData

254
graphs/data/fitDamageStats/cache/time.py vendored Normal file
View File

@@ -0,0 +1,254 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
from copy import copy
from eos.utils.float import floatUnerr
from eos.utils.spoolSupport import SpoolOptions, SpoolType
from eos.utils.stats import DmgTypes
from graphs.data.base import FitDataCache
class TimeCache(FitDataCache):
# Whole data getters
def getDpsData(self, src):
"""Return DPS data in {time: {key: dps}} format."""
return self._data[src.item.ID]['finalDps']
def getVolleyData(self, src):
"""Return volley data in {time: {key: volley}} format."""
return self._data[src.item.ID]['finalVolley']
def getDmgData(self, src):
"""Return inflicted damage data in {time: {key: damage}} format."""
return self._data[src.item.ID]['finalDmg']
# Specific data point getters
def getDpsDataPoint(self, src, time):
"""Get DPS data by specified time in {key: dps} format."""
return self._getDataPoint(src=src, time=time, dataFunc=self.getDpsData)
def getVolleyDataPoint(self, src, time):
"""Get volley data by specified time in {key: volley} format."""
return self._getDataPoint(src=src, time=time, dataFunc=self.getVolleyData)
def getDmgDataPoint(self, src, time):
"""Get inflicted damage data by specified time in {key: dmg} format."""
return self._getDataPoint(src=src, time=time, dataFunc=self.getDmgData)
# Preparation functions
def prepareDpsData(self, src, maxTime):
self._prepareDpsVolleyData(src=src, maxTime=maxTime)
def prepareVolleyData(self, src, maxTime):
self._prepareDpsVolleyData(src=src, maxTime=maxTime)
def prepareDmgData(self, src, maxTime):
# Time is none means that time parameter has to be ignored,
# we do not need cache for that
if maxTime is None:
return
self._generateInternalForm(src=src, maxTime=maxTime)
fitCache = self._data[src.item.ID]
# Final cache has been generated already, don't do anything
if 'finalDmg' in fitCache:
return
intCache = fitCache['internalDmg']
changesByTime = {}
for key, dmgMap in intCache.items():
for time in dmgMap:
changesByTime.setdefault(time, []).append(key)
# Here we convert cache to following format:
# {time: {key: damage done by key at this time}}
finalCache = fitCache['finalDmg'] = {}
timeDmgData = {}
for time in sorted(changesByTime):
timeDmgData = copy(timeDmgData)
for key in changesByTime[time]:
keyDmg = intCache[key][time]
if key in timeDmgData:
timeDmgData[key] = timeDmgData[key] + keyDmg
else:
timeDmgData[key] = keyDmg
finalCache[time] = timeDmgData
# We do not need internal cache once we have final
del fitCache['internalDmg']
# Private stuff
def _prepareDpsVolleyData(self, src, maxTime):
# Time is none means that time parameter has to be ignored,
# we do not need cache for that
if maxTime is None:
return True
self._generateInternalForm(src=src, maxTime=maxTime)
fitCache = self._data[src.item.ID]
# Final cache has been generated already, don't do anything
if 'finalDps' in fitCache and 'finalVolley' in fitCache:
return
# Convert cache from segments with assigned values into points
# which are located at times when dps/volley values change
pointCache = {}
for key, dmgList in fitCache['internalDpsVolley'].items():
pointData = pointCache[key] = {}
prevDps = None
prevVolley = None
prevTimeEnd = None
for timeStart, timeEnd, dps, volley in dmgList:
# First item
if not pointData:
pointData[timeStart] = (dps, volley)
# Gap between items
elif floatUnerr(prevTimeEnd) < floatUnerr(timeStart):
pointData[prevTimeEnd] = (DmgTypes(0, 0, 0, 0), DmgTypes(0, 0, 0, 0))
pointData[timeStart] = (dps, volley)
# Changed value
elif dps != prevDps or volley != prevVolley:
pointData[timeStart] = (dps, volley)
prevDps = dps
prevVolley = volley
prevTimeEnd = timeEnd
# We have data in another form, do not need old one any longer
del fitCache['internalDpsVolley']
changesByTime = {}
for key, dmgMap in pointCache.items():
for time in dmgMap:
changesByTime.setdefault(time, []).append(key)
# Here we convert cache to following format:
# {time: {key: (dps, volley}}
finalDpsCache = fitCache['finalDps'] = {}
finalVolleyCache = fitCache['finalVolley'] = {}
timeDpsData = {}
timeVolleyData = {}
for time in sorted(changesByTime):
timeDpsData = copy(timeDpsData)
timeVolleyData = copy(timeVolleyData)
for key in changesByTime[time]:
dps, volley = pointCache[key][time]
timeDpsData[key] = dps
timeVolleyData[key] = volley
finalDpsCache[time] = timeDpsData
finalVolleyCache[time] = timeVolleyData
def _generateInternalForm(self, src, maxTime):
if self._isTimeCacheValid(src=src, maxTime=maxTime):
return
fitCache = self._data[src.item.ID] = {'maxTime': maxTime}
intCacheDpsVolley = fitCache['internalDpsVolley'] = {}
intCacheDmg = fitCache['internalDmg'] = {}
def addDpsVolley(ddKey, addedTimeStart, addedTimeFinish, addedVolleys):
if not addedVolleys:
return
volleySum = sum(addedVolleys, DmgTypes(0, 0, 0, 0))
if volleySum.total > 0:
addedDps = volleySum / (addedTimeFinish - addedTimeStart)
# We can take "just best" volley, no matter target resistances, because all
# known items have the same damage type ratio throughout their cycle - and
# applying resistances doesn't change final outcome
bestVolley = max(addedVolleys, key=lambda v: v.total)
ddCacheDps = intCacheDpsVolley.setdefault(ddKey, [])
ddCacheDps.append((addedTimeStart, addedTimeFinish, addedDps, bestVolley))
def addDmg(ddKey, addedTime, addedDmg):
if addedDmg.total == 0:
return
intCacheDmg.setdefault(ddKey, {})[addedTime] = addedDmg
# Modules
for mod in src.item.activeModulesIter():
if not mod.isDealingDamage():
continue
cycleParams = mod.getCycleParameters(reloadOverride=True)
if cycleParams is None:
continue
currentTime = 0
nonstopCycles = 0
for cycleTimeMs, inactiveTimeMs, isInactivityReload in cycleParams.iterCycles():
cycleVolleys = []
volleyParams = mod.getVolleyParameters(spoolOptions=SpoolOptions(SpoolType.CYCLES, nonstopCycles, True))
for volleyTimeMs, volley in volleyParams.items():
cycleVolleys.append(volley)
addDmg(mod, currentTime + volleyTimeMs / 1000, volley)
addDpsVolley(mod, currentTime, currentTime + cycleTimeMs / 1000, cycleVolleys)
if inactiveTimeMs > 0:
nonstopCycles = 0
else:
nonstopCycles += 1
if currentTime > maxTime:
break
currentTime += cycleTimeMs / 1000 + inactiveTimeMs / 1000
# Drones
for drone in src.item.activeDronesIter():
if not drone.isDealingDamage():
continue
cycleParams = drone.getCycleParameters(reloadOverride=True)
if cycleParams is None:
continue
currentTime = 0
volleyParams = drone.getVolleyParameters()
for cycleTimeMs, inactiveTimeMs, isInactivityReload in cycleParams.iterCycles():
cycleVolleys = []
for volleyTimeMs, volley in volleyParams.items():
cycleVolleys.append(volley)
addDmg(drone, currentTime + volleyTimeMs / 1000, volley)
addDpsVolley(drone, currentTime, currentTime + cycleTimeMs / 1000, cycleVolleys)
if currentTime > maxTime:
break
currentTime += cycleTimeMs / 1000 + inactiveTimeMs / 1000
# Fighters
for fighter in src.item.activeFightersIter():
if not fighter.isDealingDamage():
continue
cycleParams = fighter.getCycleParametersPerEffectOptimizedDps(reloadOverride=True)
if cycleParams is None:
continue
volleyParams = fighter.getVolleyParametersPerEffect()
for effectID, abilityCycleParams in cycleParams.items():
if effectID not in volleyParams:
continue
currentTime = 0
abilityVolleyParams = volleyParams[effectID]
for cycleTimeMs, inactiveTimeMs, isInactivityReload in abilityCycleParams.iterCycles():
cycleVolleys = []
for volleyTimeMs, volley in abilityVolleyParams.items():
cycleVolleys.append(volley)
addDmg((fighter, effectID), currentTime + volleyTimeMs / 1000, volley)
addDpsVolley((fighter, effectID), currentTime, currentTime + cycleTimeMs / 1000, cycleVolleys)
if currentTime > maxTime:
break
currentTime += cycleTimeMs / 1000 + inactiveTimeMs / 1000
def _isTimeCacheValid(self, src, maxTime):
try:
cacheMaxTime = self._data[src.item.ID]['maxTime']
except KeyError:
return False
return maxTime <= cacheMaxTime
def _getDataPoint(self, src, time, dataFunc):
data = dataFunc(src)
timesBefore = [t for t in data if floatUnerr(t) <= floatUnerr(time)]
try:
time = max(timesBefore)
except ValueError:
return {}
else:
return data[time]

View File

@@ -0,0 +1,18 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================

View File

@@ -0,0 +1,423 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
from functools import lru_cache
from eos.calc import calculateRangeFactor
from eos.const import FittingHardpoint
from eos.utils.float import floatUnerr
from graphs.calc import checkLockRange, checkDroneControlRange
from service.attribute import Attribute
from service.const import GraphDpsDroneMode
from service.settings import GraphSettings
def getApplicationPerKey(src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngle, tgtSigRadius):
inLockRange = checkLockRange(src=src, distance=distance)
inDroneRange = checkDroneControlRange(src=src, distance=distance)
applicationMap = {}
for mod in src.item.activeModulesIter():
if not mod.isDealingDamage():
continue
if "ChainLightning" in mod.item.effects:
if inLockRange:
applicationMap[mod] = getVortonMult(
mod=mod,
distance=distance,
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
elif mod.hardpoint == FittingHardpoint.TURRET:
if inLockRange:
applicationMap[mod] = getTurretMult(
mod=mod,
src=src,
tgt=tgt,
atkSpeed=atkSpeed,
atkAngle=atkAngle,
distance=distance,
tgtSpeed=tgtSpeed,
tgtAngle=tgtAngle,
tgtSigRadius=tgtSigRadius)
else:
applicationMap[mod] = 0
elif mod.hardpoint == FittingHardpoint.MISSILE:
# FoF missiles can shoot beyond lock range
if inLockRange or (mod.charge is not None and 'fofMissileLaunching' in mod.charge.effects):
applicationMap[mod] = getLauncherMult(
mod=mod,
distance=distance,
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
else:
applicationMap[mod] = 0
elif mod.item.group.name in ('Smart Bomb', 'Structure Area Denial Module'):
applicationMap[mod] = getSmartbombMult(
mod=mod,
distance=distance)
elif mod.item.group.name == 'Missile Launcher Bomb':
applicationMap[mod] = getBombMult(
mod=mod,
src=src,
tgt=tgt,
distance=distance,
tgtSigRadius=tgtSigRadius)
elif mod.item.group.name == 'Structure Guided Bomb Launcher':
if inLockRange:
applicationMap[mod] = getGuidedBombMult(
mod=mod,
src=src,
distance=distance,
tgtSigRadius=tgtSigRadius)
else:
applicationMap[mod] = 0
elif mod.item.group.name in ('Super Weapon', 'Structure Doomsday Weapon'):
# Only single-target DDs need locks
if not inLockRange and {'superWeaponAmarr', 'superWeaponCaldari', 'superWeaponGallente', 'superWeaponMinmatar', 'lightningWeapon'}.intersection(mod.item.effects):
applicationMap[mod] = 0
else:
applicationMap[mod] = getDoomsdayMult(
mod=mod,
tgt=tgt,
distance=distance,
tgtSigRadius=tgtSigRadius)
for drone in src.item.activeDronesIter():
if not drone.isDealingDamage():
continue
if inLockRange and inDroneRange:
applicationMap[drone] = getDroneMult(
drone=drone,
src=src,
tgt=tgt,
atkSpeed=atkSpeed,
atkAngle=atkAngle,
distance=distance,
tgtSpeed=tgtSpeed,
tgtAngle=tgtAngle,
tgtSigRadius=tgtSigRadius)
else:
applicationMap[drone] = 0
for fighter in src.item.activeFightersIter():
if not fighter.isDealingDamage():
continue
for ability in fighter.abilities:
if not ability.dealsDamage or not ability.active:
continue
# Bomb launching doesn't need locks
if inLockRange or ability.effect.name == 'fighterAbilityLaunchBomb':
applicationMap[(fighter, ability.effectID)] = getFighterAbilityMult(
fighter=fighter,
ability=ability,
src=src,
tgt=tgt,
distance=distance,
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
else:
applicationMap[(fighter, ability.effectID)] = 0
# Ensure consistent results - round off a little to avoid float errors
for k, v in applicationMap.items():
applicationMap[k] = floatUnerr(v)
return applicationMap
# Item application multiplier calculation
def getTurretMult(mod, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngle, tgtSigRadius):
cth = _calcTurretChanceToHit(
atkSpeed=atkSpeed,
atkAngle=atkAngle,
atkRadius=src.getRadius(),
atkOptimalRange=mod.maxRange or 0,
atkFalloffRange=mod.falloff or 0,
atkTracking=mod.getModifiedItemAttr('trackingSpeed'),
atkOptimalSigRadius=mod.getModifiedItemAttr('optimalSigRadius'),
distance=distance,
tgtSpeed=tgtSpeed,
tgtAngle=tgtAngle,
tgtRadius=tgt.getRadius(),
tgtSigRadius=tgtSigRadius)
mult = _calcTurretMult(cth)
return mult
def getVortonMult(mod, distance, tgtSpeed, tgtSigRadius):
rangeFactor = calculateRangeFactor(
mod.getModifiedItemAttr('maxRange'),
0,
distance)
applicationFactor = _calcMissileFactor(
atkEr=mod.getModifiedItemAttr('aoeCloudSize'),
atkEv=mod.getModifiedItemAttr('aoeVelocity'),
atkDrf=mod.getModifiedItemAttr('aoeDamageReductionFactor'),
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
return rangeFactor * applicationFactor
def getLauncherMult(mod, distance, tgtSpeed, tgtSigRadius):
missileMaxRangeData = mod.missileMaxRangeData
if missileMaxRangeData is None:
return 0
# The ranges already consider ship radius
lowerRange, higherRange, higherChance = missileMaxRangeData
if distance is None or distance <= lowerRange:
distanceFactor = 1
elif lowerRange < distance <= higherRange:
distanceFactor = higherChance
else:
distanceFactor = 0
applicationFactor = _calcMissileFactor(
atkEr=mod.getModifiedChargeAttr('aoeCloudSize'),
atkEv=mod.getModifiedChargeAttr('aoeVelocity'),
atkDrf=mod.getModifiedChargeAttr('aoeDamageReductionFactor'),
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
return distanceFactor * applicationFactor
def getSmartbombMult(mod, distance):
modRange = mod.maxRange
if modRange is None:
return 0
if distance is not None and distance > modRange:
return 0
return 1
def getDoomsdayMult(mod, tgt, distance, tgtSigRadius):
modRange = mod.maxRange
# Single-target DDs have no range limit
if distance is not None and modRange and distance > modRange:
return 0
# Single-target titan DDs are vs capitals only
if {'superWeaponAmarr', 'superWeaponCaldari', 'superWeaponGallente', 'superWeaponMinmatar'}.intersection(mod.item.effects):
# Disallow only against subcaps, allow against caps and tgt profiles
if tgt.isFit and not tgt.item.ship.item.requiresSkill('Capital Ships'):
return 0
damageSig = mod.getModifiedItemAttr('doomsdayDamageRadius') or mod.getModifiedItemAttr('signatureRadius')
if not damageSig:
return 1
return min(1, tgtSigRadius / damageSig)
def getBombMult(mod, src, tgt, distance, tgtSigRadius):
modRange = mod.maxRange
if modRange is None:
return 0
blastRadius = mod.getModifiedChargeAttr('explosionRange')
atkRadius = src.getRadius()
tgtRadius = tgt.getRadius()
# Bomb starts in the center of the ship
# Also here we assume that it affects target as long as blast
# touches its surface, not center - I did not check this
if distance is not None and distance < max(0, modRange - atkRadius - tgtRadius - blastRadius):
return 0
if distance is not None and distance > max(0, modRange - atkRadius + tgtRadius + blastRadius):
return 0
return _calcBombFactor(
atkEr=mod.getModifiedChargeAttr('aoeCloudSize'),
tgtSigRadius=tgtSigRadius)
def getGuidedBombMult(mod, src, distance, tgtSigRadius):
modRange = mod.maxRange
if modRange is None:
return 0
if distance is not None and distance > modRange - src.getRadius():
return 0
eR = mod.getModifiedChargeAttr('aoeCloudSize')
if eR == 0:
return 1
else:
return min(1, tgtSigRadius / eR)
def getDroneMult(drone, src, tgt, atkSpeed, atkAngle, distance, tgtSpeed, tgtAngle, tgtSigRadius):
if (
distance is not None and (
(not GraphSettings.getInstance().get('ignoreDCR') and distance > src.item.extraAttributes['droneControlRange']) or
(not GraphSettings.getInstance().get('ignoreLockRange') and distance > src.item.maxTargetRange))
):
return 0
droneSpeed = drone.getModifiedItemAttr('maxVelocity')
# Hard to simulate drone behavior, so assume chance to hit is 1 for mobile drones
# which catch up with target
droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
if (
droneSpeed > 1 and (
(droneOpt == GraphDpsDroneMode.auto and droneSpeed >= tgtSpeed) or
droneOpt == GraphDpsDroneMode.followTarget)
):
cth = 1
# Otherwise put the drone into center of the ship, move it at its max speed or ship's speed
# (whichever is lower) towards direction of attacking ship and see how well it projects
else:
droneRadius = drone.getModifiedItemAttr('radius')
if distance is None:
cthDistance = None
else:
# As distance is ship surface to ship surface, we adjust it according
# to attacker ship's radiuses to have drone surface to ship surface distance
cthDistance = distance + src.getRadius() - droneRadius
cth = _calcTurretChanceToHit(
atkSpeed=min(atkSpeed, droneSpeed),
atkAngle=atkAngle,
atkRadius=droneRadius,
atkOptimalRange=drone.maxRange or 0,
atkFalloffRange=drone.falloff or 0,
atkTracking=drone.getModifiedItemAttr('trackingSpeed'),
atkOptimalSigRadius=drone.getModifiedItemAttr('optimalSigRadius'),
distance=cthDistance,
tgtSpeed=tgtSpeed,
tgtAngle=tgtAngle,
tgtRadius=tgt.getRadius(),
tgtSigRadius=tgtSigRadius)
mult = _calcTurretMult(cth)
return mult
def getFighterAbilityMult(fighter, ability, src, tgt, distance, tgtSpeed, tgtSigRadius):
fighterSpeed = fighter.getModifiedItemAttr('maxVelocity')
attrPrefix = ability.attrPrefix
# It's bomb attack
if attrPrefix == 'fighterAbilityLaunchBomb':
# Just assume we can land bomb anywhere
return _calcBombFactor(
atkEr=fighter.getModifiedChargeAttr('aoeCloudSize'),
tgtSigRadius=tgtSigRadius)
droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
# It's regular missile-based attack
if (droneOpt == GraphDpsDroneMode.auto and fighterSpeed >= tgtSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
rangeFactor = 1
# Same as with drones, if fighters are slower - put them to center of
# the ship and see how they apply
else:
if distance is None:
rangeFactorDistance = None
else:
rangeFactorDistance = distance + src.getRadius() - fighter.getModifiedItemAttr('radius')
rangeFactor = calculateRangeFactor(
srcOptimalRange=fighter.getModifiedItemAttr('{}RangeOptimal'.format(attrPrefix)) or fighter.getModifiedItemAttr('{}Range'.format(attrPrefix)),
srcFalloffRange=fighter.getModifiedItemAttr('{}RangeFalloff'.format(attrPrefix)),
distance=rangeFactorDistance)
drf = fighter.getModifiedItemAttr('{}ReductionFactor'.format(attrPrefix), None)
if drf is None:
drf = fighter.getModifiedItemAttr('{}DamageReductionFactor'.format(attrPrefix))
drs = fighter.getModifiedItemAttr('{}ReductionSensitivity'.format(attrPrefix), None)
if drs is None:
drs = fighter.getModifiedItemAttr('{}DamageReductionSensitivity'.format(attrPrefix))
missileFactor = _calcMissileFactor(
atkEr=fighter.getModifiedItemAttr('{}ExplosionRadius'.format(attrPrefix)),
atkEv=fighter.getModifiedItemAttr('{}ExplosionVelocity'.format(attrPrefix)),
atkDrf=_calcAggregatedDrf(reductionFactor=drf, reductionSensitivity=drs),
tgtSpeed=tgtSpeed,
tgtSigRadius=tgtSigRadius)
resistMult = 1
if tgt.isFit:
resistAttrID = fighter.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))
if resistAttrID:
resistAttrInfo = Attribute.getInstance().getAttributeInfo(resistAttrID)
if resistAttrInfo is not None:
resistMult = tgt.item.ship.getModifiedItemAttr(resistAttrInfo.name, 1)
mult = rangeFactor * missileFactor * resistMult
return mult
# Turret-specific math
@lru_cache(maxsize=50)
def _calcTurretMult(chanceToHit):
"""Calculate damage multiplier for turret-based weapons."""
# https://wiki.eveuniversity.org/Turret_mechanics#Damage
wreckingChance = min(chanceToHit, 0.01)
wreckingPart = wreckingChance * 3
normalChance = chanceToHit - wreckingChance
if normalChance > 0:
avgDamageMult = (0.01 + chanceToHit) / 2 + 0.49
normalPart = normalChance * avgDamageMult
else:
normalPart = 0
totalMult = normalPart + wreckingPart
return totalMult
@lru_cache(maxsize=1000)
def _calcTurretChanceToHit(
atkSpeed, atkAngle, atkRadius, atkOptimalRange, atkFalloffRange, atkTracking, atkOptimalSigRadius,
distance, tgtSpeed, tgtAngle, tgtRadius, tgtSigRadius
):
"""Calculate chance to hit for turret-based weapons."""
# https://wiki.eveuniversity.org/Turret_mechanics#Hit_Math
angularSpeed = _calcAngularSpeed(atkSpeed, atkAngle, atkRadius, distance, tgtSpeed, tgtAngle, tgtRadius)
# Turrets can be activated regardless of range to target
rangeFactor = calculateRangeFactor(atkOptimalRange, atkFalloffRange, distance, restrictedRange=False)
trackingFactor = _calcTrackingFactor(atkTracking, atkOptimalSigRadius, angularSpeed, tgtSigRadius)
cth = rangeFactor * trackingFactor
return cth
def _calcAngularSpeed(atkSpeed, atkAngle, atkRadius, distance, tgtSpeed, tgtAngle, tgtRadius):
"""Calculate angular speed based on mobility parameters of two ships."""
if distance is None:
return 0
atkAngle = atkAngle * math.pi / 180
tgtAngle = tgtAngle * math.pi / 180
ctcDistance = atkRadius + distance + tgtRadius
# Target is to the right of the attacker, so transversal is projection onto Y axis
transSpeed = abs(atkSpeed * math.sin(atkAngle) - tgtSpeed * math.sin(tgtAngle))
if ctcDistance == 0:
return 0 if transSpeed == 0 else math.inf
else:
return transSpeed / ctcDistance
def _calcTrackingFactor(atkTracking, atkOptimalSigRadius, angularSpeed, tgtSigRadius):
"""Calculate tracking chance to hit component."""
return 0.5 ** (((angularSpeed * atkOptimalSigRadius) / (atkTracking * tgtSigRadius)) ** 2)
# Missile-specific math
@lru_cache(maxsize=200)
def _calcMissileFactor(atkEr, atkEv, atkDrf, tgtSpeed, tgtSigRadius):
"""Missile application."""
factors = [1]
# "Slow" part
if atkEr > 0:
factors.append(tgtSigRadius / atkEr)
# "Fast" part
if tgtSpeed > 0:
factors.append(((atkEv * tgtSigRadius) / (atkEr * tgtSpeed)) ** atkDrf)
totalMult = min(factors)
return totalMult
def _calcAggregatedDrf(reductionFactor, reductionSensitivity):
"""
Sometimes DRF is specified as 2 separate numbers,
here we combine them into generic form.
"""
return math.log(reductionFactor) / math.log(reductionSensitivity)
# Misc math
def _calcBombFactor(atkEr, tgtSigRadius):
if atkEr == 0:
return 1
else:
return min(1, tgtSigRadius / atkEr)

View File

@@ -0,0 +1,189 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import math
from eos.calc import calculateRangeFactor
from eos.utils.float import floatUnerr
from graphs.calc import checkLockRange, checkDroneControlRange
from service.const import GraphDpsDroneMode
from service.settings import GraphSettings
def _isRegularScram(mod):
if not mod.item:
return False
if not {'warpScrambleBlockMWDWithNPCEffect', 'structureWarpScrambleBlockMWDWithNPCEffect'}.intersection(mod.item.effects):
return False
if not mod.getModifiedItemAttr('activationBlockedStrenght', 0):
return False
return True
def _isHicScram(mod):
if not mod.item:
return False
if 'warpDisruptSphere' not in mod.item.effects:
return False
if not mod.charge:
return False
if 'shipModuleFocusedWarpScramblingScript' not in mod.charge.effects:
return False
return True
def getScramRange(src):
scramRange = None
for mod in src.item.activeModulesIter():
if _isRegularScram(mod) or _isHicScram(mod):
scramRange = max(scramRange or 0, mod.maxRange or 0)
return scramRange
def getScrammables(tgt):
scrammables = []
if tgt.isFit:
for mod in tgt.item.activeModulesIter():
if not mod.item:
continue
if {'moduleBonusMicrowarpdrive', 'microJumpDrive', 'microJumpPortalDrive'}.intersection(mod.item.effects):
scrammables.append(mod)
return scrammables
def getTackledSpeed(src, tgt, currentUntackledSpeed, srcScramRange, tgtScrammables, webMods, webDrones, webFighters, distance):
# Can slow down non-immune ships and target profiles
if tgt.isFit and tgt.item.ship.getModifiedItemAttr('disallowOffensiveModifiers'):
return currentUntackledSpeed
maxUntackledSpeed = tgt.getMaxVelocity()
# What's immobile cannot be slowed
if maxUntackledSpeed == 0:
return maxUntackledSpeed
inLockRange = checkLockRange(src=src, distance=distance)
inDroneRange = checkDroneControlRange(src=src, distance=distance)
speedRatio = currentUntackledSpeed / maxUntackledSpeed
# No scrams or distance is longer than longest scram - nullify scrammables list
if not inLockRange or srcScramRange is None or (distance is not None and distance > srcScramRange):
tgtScrammables = ()
appliedMultipliers = {}
# Modules first, they are always applied the same way
if inLockRange:
for wData in webMods:
appliedBoost = wData.boost * calculateRangeFactor(
srcOptimalRange=wData.optimal,
srcFalloffRange=wData.falloff,
distance=distance)
if appliedBoost:
appliedMultipliers.setdefault(wData.stackingGroup, []).append((1 + appliedBoost / 100, wData.resAttrID))
maxTackledSpeed = tgt.getMaxVelocity(extraMultipliers=appliedMultipliers, ignoreAfflictors=tgtScrammables)
currentTackledSpeed = maxTackledSpeed * speedRatio
# Drones and fighters
mobileWebs = []
if inLockRange:
mobileWebs.extend(webFighters)
if inLockRange and inDroneRange:
mobileWebs.extend(webDrones)
atkRadius = src.getRadius()
# As mobile webs either follow the target or stick to the attacking ship,
# if target is within mobile web optimal - it can be applied unconditionally
longEnoughMws = [mw for mw in mobileWebs if distance is None or distance <= mw.optimal - atkRadius + mw.radius]
if longEnoughMws:
for mwData in longEnoughMws:
appliedMultipliers.setdefault(mwData.stackingGroup, []).append((1 + mwData.boost / 100, mwData.resAttrID))
mobileWebs.remove(mwData)
maxTackledSpeed = tgt.getMaxVelocity(extraMultipliers=appliedMultipliers, ignoreAfflictors=tgtScrammables)
currentTackledSpeed = maxTackledSpeed * speedRatio
# Apply remaining webs, from fastest to slowest
droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
while mobileWebs:
# Process in batches unified by speed to save up resources
fastestMwSpeed = max(mobileWebs, key=lambda mw: mw.speed).speed
fastestMws = [mw for mw in mobileWebs if mw.speed == fastestMwSpeed]
for mwData in fastestMws:
# Faster than target or set to follow it - apply full slowdown
if (droneOpt == GraphDpsDroneMode.auto and mwData.speed >= currentTackledSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
appliedMwBoost = mwData.boost
# Otherwise project from the center of the ship
else:
if distance is None:
rangeFactorDistance = None
else:
rangeFactorDistance = distance + atkRadius - mwData.radius
appliedMwBoost = mwData.boost * calculateRangeFactor(
srcOptimalRange=mwData.optimal,
srcFalloffRange=mwData.falloff,
distance=rangeFactorDistance)
appliedMultipliers.setdefault(mwData.stackingGroup, []).append((1 + appliedMwBoost / 100, mwData.resAttrID))
mobileWebs.remove(mwData)
maxTackledSpeed = tgt.getMaxVelocity(extraMultipliers=appliedMultipliers, ignoreAfflictors=tgtScrammables)
currentTackledSpeed = maxTackledSpeed * speedRatio
# Ensure consistent results - round off a little to avoid float errors
return floatUnerr(currentTackledSpeed)
def getSigRadiusMult(src, tgt, tgtSpeed, srcScramRange, tgtScrammables, tpMods, tpDrones, tpFighters, distance):
# Can blow non-immune ships and target profiles
if tgt.isFit and tgt.item.ship.getModifiedItemAttr('disallowOffensiveModifiers'):
return 1
inLockRange = checkLockRange(src=src, distance=distance)
inDroneRange = checkDroneControlRange(src=src, distance=distance)
initSig = tgt.getSigRadius()
# No scrams or distance is longer than longest scram - nullify scrammables list
if not inLockRange or srcScramRange is None or (distance is not None and distance > srcScramRange):
tgtScrammables = ()
# TPing modules
appliedMultipliers = {}
if inLockRange:
for tpData in tpMods:
appliedBoost = tpData.boost * calculateRangeFactor(
srcOptimalRange=tpData.optimal,
srcFalloffRange=tpData.falloff,
distance=distance)
if appliedBoost:
appliedMultipliers.setdefault(tpData.stackingGroup, []).append((1 + appliedBoost / 100, tpData.resAttrID))
# TPing drones
mobileTps = []
if inLockRange:
mobileTps.extend(tpFighters)
if inLockRange and inDroneRange:
mobileTps.extend(tpDrones)
droneOpt = GraphSettings.getInstance().get('mobileDroneMode')
atkRadius = src.getRadius()
for mtpData in mobileTps:
# Faster than target or set to follow it - apply full TP
if (droneOpt == GraphDpsDroneMode.auto and mtpData.speed >= tgtSpeed) or droneOpt == GraphDpsDroneMode.followTarget:
appliedMtpBoost = mtpData.boost
# Otherwise project from the center of the ship
else:
if distance is None:
rangeFactorDistance = None
else:
rangeFactorDistance = distance + atkRadius - mtpData.radius
appliedMtpBoost = mtpData.boost * calculateRangeFactor(
srcOptimalRange=mtpData.optimal,
srcFalloffRange=mtpData.falloff,
distance=rangeFactorDistance)
appliedMultipliers.setdefault(mtpData.stackingGroup, []).append((1 + appliedMtpBoost / 100, mtpData.resAttrID))
modifiedSig = tgt.getSigRadius(extraMultipliers=appliedMultipliers, ignoreAfflictors=tgtScrammables)
if modifiedSig == math.inf and initSig == math.inf:
return 1
mult = modifiedSig / initSig
# Ensure consistent results - round off a little to avoid float errors
return floatUnerr(mult)

View File

@@ -0,0 +1,467 @@
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
import eos.config
from eos.utils.spoolSupport import SpoolOptions, SpoolType
from eos.utils.stats import DmgTypes
from graphs.data.base import PointGetter, SmoothPointGetter
from service.settings import GraphSettings
from .calc.application import getApplicationPerKey
from .calc.projected import getScramRange, getScrammables, getTackledSpeed, getSigRadiusMult
def applyDamage(dmgMap, applicationMap, tgtResists):
total = DmgTypes(em=0, thermal=0, kinetic=0, explosive=0)
for key, dmg in dmgMap.items():
total += dmg * applicationMap.get(key, 0)
if not GraphSettings.getInstance().get('ignoreResists'):
emRes, thermRes, kinRes, exploRes = tgtResists
total = DmgTypes(
em=total.em * (1 - emRes),
thermal=total.thermal * (1 - thermRes),
kinetic=total.kinetic * (1 - kinRes),
explosive=total.explosive * (1 - exploRes))
return total
# Y mixins
class YDpsMixin:
def _getDamagePerKey(self, src, time):
# Use data from time cache if time was not specified
if time is not None:
return self._getTimeCacheDataPoint(src=src, time=time)
# Compose map ourselves using current fit settings if time is not specified
dpsMap = {}
defaultSpoolValue = eos.config.settings['globalDefaultSpoolupPercentage']
for mod in src.item.activeModulesIter():
if not mod.isDealingDamage():
continue
dpsMap[mod] = mod.getDps(spoolOptions=SpoolOptions(SpoolType.SPOOL_SCALE, defaultSpoolValue, False))
for drone in src.item.activeDronesIter():
if not drone.isDealingDamage():
continue
dpsMap[drone] = drone.getDps()
for fighter in src.item.activeFightersIter():
if not fighter.isDealingDamage():
continue
for effectID, effectDps in fighter.getDpsPerEffect().items():
dpsMap[(fighter, effectID)] = effectDps
return dpsMap
def _prepareTimeCache(self, src, maxTime):
self.graph._timeCache.prepareDpsData(src=src, maxTime=maxTime)
def _getTimeCacheData(self, src):
return self.graph._timeCache.getDpsData(src=src)
def _getTimeCacheDataPoint(self, src, time):
return self.graph._timeCache.getDpsDataPoint(src=src, time=time)
class YVolleyMixin:
def _getDamagePerKey(self, src, time):
# Use data from time cache if time was not specified
if time is not None:
return self._getTimeCacheDataPoint(src=src, time=time)
# Compose map ourselves using current fit settings if time is not specified
volleyMap = {}
defaultSpoolValue = eos.config.settings['globalDefaultSpoolupPercentage']
for mod in src.item.activeModulesIter():
if not mod.isDealingDamage():
continue
volleyMap[mod] = mod.getVolley(spoolOptions=SpoolOptions(SpoolType.SPOOL_SCALE, defaultSpoolValue, False))
for drone in src.item.activeDronesIter():
if not drone.isDealingDamage():
continue
volleyMap[drone] = drone.getVolley()
for fighter in src.item.activeFightersIter():
if not fighter.isDealingDamage():
continue
for effectID, effectVolley in fighter.getVolleyPerEffect().items():
volleyMap[(fighter, effectID)] = effectVolley
return volleyMap
def _prepareTimeCache(self, src, maxTime):
self.graph._timeCache.prepareVolleyData(src=src, maxTime=maxTime)
def _getTimeCacheData(self, src):
return self.graph._timeCache.getVolleyData(src=src)
def _getTimeCacheDataPoint(self, src, time):
return self.graph._timeCache.getVolleyDataPoint(src=src, time=time)
class YInflictedDamageMixin:
def _getDamagePerKey(self, src, time):
# Damage inflicted makes no sense without time specified
if time is None:
raise ValueError
return self._getTimeCacheDataPoint(src=src, time=time)
def _prepareTimeCache(self, src, maxTime):
self.graph._timeCache.prepareDmgData(src=src, maxTime=maxTime)
def _getTimeCacheData(self, src):
return self.graph._timeCache.getDmgData(src=src)
def _getTimeCacheDataPoint(self, src, time):
return self.graph._timeCache.getDmgDataPoint(src=src, time=time)
# X mixins
class XDistanceMixin(SmoothPointGetter):
_baseResolution = 50
_extraDepth = 2
def _getCommonData(self, miscParams, src, tgt):
# Prepare time cache here because we need to do it only once,
# and this function is called once per point info fetch
self._prepareTimeCache(src=src, maxTime=miscParams['time'])
applyProjected = GraphSettings.getInstance().get('applyProjected')
return {
'applyProjected': applyProjected,
'srcScramRange': getScramRange(src=src) if applyProjected else None,
'tgtScrammables': getScrammables(tgt=tgt) if applyProjected else (),
'dmgMap': self._getDamagePerKey(src=src, time=miscParams['time']),
'tgtResists': tgt.getResists()}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
distance = x
tgtSpeed = miscParams['tgtSpeed']
tgtSigRadius = tgt.getSigRadius()
if commonData['applyProjected']:
webMods, tpMods = self.graph._projectedCache.getProjModData(src)
webDrones, tpDrones = self.graph._projectedCache.getProjDroneData(src)
webFighters, tpFighters = self.graph._projectedCache.getProjFighterData(src)
tgtSpeed = getTackledSpeed(
src=src,
tgt=tgt,
currentUntackledSpeed=tgtSpeed,
srcScramRange=commonData['srcScramRange'],
tgtScrammables=commonData['tgtScrammables'],
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=distance)
tgtSigRadius = tgtSigRadius * getSigRadiusMult(
src=src,
tgt=tgt,
tgtSpeed=tgtSpeed,
srcScramRange=commonData['srcScramRange'],
tgtScrammables=commonData['tgtScrammables'],
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=distance)
applicationMap = getApplicationPerKey(
src=src,
tgt=tgt,
atkSpeed=miscParams['atkSpeed'],
atkAngle=miscParams['atkAngle'],
distance=distance,
tgtSpeed=tgtSpeed,
tgtAngle=miscParams['tgtAngle'],
tgtSigRadius=tgtSigRadius)
y = applyDamage(
dmgMap=commonData['dmgMap'],
applicationMap=applicationMap,
tgtResists=commonData['tgtResists']).total
return y
class XTimeMixin(PointGetter):
def _prepareApplicationMap(self, miscParams, src, tgt):
tgtSpeed = miscParams['tgtSpeed']
tgtSigRadius = tgt.getSigRadius()
if GraphSettings.getInstance().get('applyProjected'):
srcScramRange = getScramRange(src=src)
tgtScrammables = getScrammables(tgt=tgt)
webMods, tpMods = self.graph._projectedCache.getProjModData(src)
webDrones, tpDrones = self.graph._projectedCache.getProjDroneData(src)
webFighters, tpFighters = self.graph._projectedCache.getProjFighterData(src)
tgtSpeed = getTackledSpeed(
src=src,
tgt=tgt,
currentUntackledSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=miscParams['distance'])
tgtSigRadius = tgtSigRadius * getSigRadiusMult(
src=src,
tgt=tgt,
tgtSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=miscParams['distance'])
# Get all data we need for all times into maps/caches
applicationMap = getApplicationPerKey(
src=src,
tgt=tgt,
atkSpeed=miscParams['atkSpeed'],
atkAngle=miscParams['atkAngle'],
distance=miscParams['distance'],
tgtSpeed=tgtSpeed,
tgtAngle=miscParams['tgtAngle'],
tgtSigRadius=tgtSigRadius)
return applicationMap
def getRange(self, xRange, miscParams, src, tgt):
xs = []
ys = []
minTime, maxTime = xRange
# Prepare time cache and various shared data
self._prepareTimeCache(src=src, maxTime=maxTime)
timeCache = self._getTimeCacheData(src=src)
applicationMap = self._prepareApplicationMap(miscParams=miscParams, src=src, tgt=tgt)
tgtResists = tgt.getResists()
# Custom iteration for time graph to show all data points
currentDmg = None
currentTime = None
for currentTime in sorted(timeCache):
prevDmg = currentDmg
currentDmgData = timeCache[currentTime]
currentDmg = applyDamage(dmgMap=currentDmgData, applicationMap=applicationMap, tgtResists=tgtResists).total
if currentTime < minTime:
continue
# First set of data points
if not xs:
# Start at exactly requested time, at last known value
initialDmg = prevDmg or 0
xs.append(minTime)
ys.append(initialDmg)
# If current time is bigger then starting, extend plot to that time with old value
if currentTime > minTime:
xs.append(currentTime)
ys.append(initialDmg)
# If new value is different, extend it with new point to the new value
if currentDmg != prevDmg:
xs.append(currentTime)
ys.append(currentDmg)
continue
# Last data point
if currentTime >= maxTime:
xs.append(maxTime)
ys.append(prevDmg)
break
# Anything in-between
if currentDmg != prevDmg:
if prevDmg is not None:
xs.append(currentTime)
ys.append(prevDmg)
xs.append(currentTime)
ys.append(currentDmg)
# Special case - there are no damage dealers
if currentDmg is None and currentTime is None:
xs.append(minTime)
ys.append(0)
# Make sure that last data point is always at max time
if maxTime > (currentTime or 0):
xs.append(maxTime)
ys.append(currentDmg or 0)
return xs, ys
def getPoint(self, x, miscParams, src, tgt):
time = x
# Prepare time cache and various data
self._prepareTimeCache(src=src, maxTime=time)
dmgData = self._getTimeCacheDataPoint(src=src, time=time)
applicationMap = self._prepareApplicationMap(miscParams=miscParams, src=src, tgt=tgt)
y = applyDamage(dmgMap=dmgData, applicationMap=applicationMap, tgtResists=tgt.getResists()).total
return y
class XTgtSpeedMixin(SmoothPointGetter):
_baseResolution = 50
_extraDepth = 2
def _getCommonData(self, miscParams, src, tgt):
# Prepare time cache here because we need to do it only once,
# and this function is called once per point info fetch
self._prepareTimeCache(src=src, maxTime=miscParams['time'])
return {
'applyProjected': GraphSettings.getInstance().get('applyProjected'),
'dmgMap': self._getDamagePerKey(src=src, time=miscParams['time']),
'tgtResists': tgt.getResists()}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
tgtSpeed = x
tgtSigRadius = tgt.getSigRadius()
if commonData['applyProjected']:
srcScramRange = getScramRange(src=src)
tgtScrammables = getScrammables(tgt=tgt)
webMods, tpMods = self.graph._projectedCache.getProjModData(src)
webDrones, tpDrones = self.graph._projectedCache.getProjDroneData(src)
webFighters, tpFighters = self.graph._projectedCache.getProjFighterData(src)
tgtSpeed = getTackledSpeed(
src=src,
tgt=tgt,
currentUntackledSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=miscParams['distance'])
tgtSigRadius = tgtSigRadius * getSigRadiusMult(
src=src,
tgt=tgt,
tgtSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=miscParams['distance'])
applicationMap = getApplicationPerKey(
src=src,
tgt=tgt,
atkSpeed=miscParams['atkSpeed'],
atkAngle=miscParams['atkAngle'],
distance=miscParams['distance'],
tgtSpeed=tgtSpeed,
tgtAngle=miscParams['tgtAngle'],
tgtSigRadius=tgtSigRadius)
y = applyDamage(
dmgMap=commonData['dmgMap'],
applicationMap=applicationMap,
tgtResists=commonData['tgtResists']).total
return y
class XTgtSigRadiusMixin(SmoothPointGetter):
_baseResolution = 50
_extraDepth = 2
def _getCommonData(self, miscParams, src, tgt):
tgtSpeed = miscParams['tgtSpeed']
tgtSigMult = 1
if GraphSettings.getInstance().get('applyProjected'):
srcScramRange = getScramRange(src=src)
tgtScrammables = getScrammables(tgt=tgt)
webMods, tpMods = self.graph._projectedCache.getProjModData(src)
webDrones, tpDrones = self.graph._projectedCache.getProjDroneData(src)
webFighters, tpFighters = self.graph._projectedCache.getProjFighterData(src)
tgtSpeed = getTackledSpeed(
src=src,
tgt=tgt,
currentUntackledSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
webMods=webMods,
webDrones=webDrones,
webFighters=webFighters,
distance=miscParams['distance'])
tgtSigMult = getSigRadiusMult(
src=src,
tgt=tgt,
tgtSpeed=tgtSpeed,
srcScramRange=srcScramRange,
tgtScrammables=tgtScrammables,
tpMods=tpMods,
tpDrones=tpDrones,
tpFighters=tpFighters,
distance=miscParams['distance'])
# Prepare time cache here because we need to do it only once,
# and this function is called once per point info fetch
self._prepareTimeCache(src=src, maxTime=miscParams['time'])
return {
'tgtSpeed': tgtSpeed,
'tgtSigMult': tgtSigMult,
'dmgMap': self._getDamagePerKey(src=src, time=miscParams['time']),
'tgtResists': tgt.getResists()}
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
tgtSigRadius = x
applicationMap = getApplicationPerKey(
src=src,
tgt=tgt,
atkSpeed=miscParams['atkSpeed'],
atkAngle=miscParams['atkAngle'],
distance=miscParams['distance'],
tgtSpeed=commonData['tgtSpeed'],
tgtAngle=miscParams['tgtAngle'],
tgtSigRadius=tgtSigRadius * commonData['tgtSigMult'])
y = applyDamage(
dmgMap=commonData['dmgMap'],
applicationMap=applicationMap,
tgtResists=commonData['tgtResists']).total
return y
# Final getters
class Distance2DpsGetter(XDistanceMixin, YDpsMixin):
pass
class Distance2VolleyGetter(XDistanceMixin, YVolleyMixin):
pass
class Distance2InflictedDamageGetter(XDistanceMixin, YInflictedDamageMixin):
pass
class Time2DpsGetter(XTimeMixin, YDpsMixin):
pass
class Time2VolleyGetter(XTimeMixin, YVolleyMixin):
pass
class Time2InflictedDamageGetter(XTimeMixin, YInflictedDamageMixin):
pass
class TgtSpeed2DpsGetter(XTgtSpeedMixin, YDpsMixin):
pass
class TgtSpeed2VolleyGetter(XTgtSpeedMixin, YVolleyMixin):
pass
class TgtSpeed2InflictedDamageGetter(XTgtSpeedMixin, YInflictedDamageMixin):
pass
class TgtSigRadius2DpsGetter(XTgtSigRadiusMixin, YDpsMixin):
pass
class TgtSigRadius2VolleyGetter(XTgtSigRadiusMixin, YVolleyMixin):
pass
class TgtSigRadius2InflictedDamageGetter(XTgtSigRadiusMixin, YInflictedDamageMixin):
pass

Some files were not shown because too many files have changed in this diff Show More