x-actly / Eve-Online-Mining-Bot

simple python script to automate mining in eve online
12 stars 5 forks source link

call external exe file to read eve memory export #85

Open sillychipmunk opened 5 months ago

sillychipmunk commented 5 months ago

We can use this as a way to find elements to click, for ex undock button etc. Its all about finding a way to parse the json

sillychipmunk commented 5 months ago

@x-actly this could be a possible way to hack into eve memory to get locations for stuff. We just have to reduce the json down to a usable format where all locations gets added offset from their parent, much like the elm version does it (obscurely)

i will make a fork of sanderling where i have added the changes that underlies the exe file in this PR

x-actly commented 5 months ago

sounds good, i`ll test it when its rdyyy

sillychipmunk commented 5 months ago

lol .. getting there slowly .. its a cat and mouse game between reading elm code and running interactive python shell and trying and failing ;) able to get approximate locations now.. they are still a some pixels off .. so i need to look more into the elm code to see how it calculates offsets properly

sillychipmunk commented 5 months ago

Of course! The y coord is off by the height of the Window title! So we must take that into account when running windowed. Or its a good thing to check. EDIT: absolutely correct :) x and y coordinates are calculated perfectly, just need a fixed window (not full screen) to be able to easily flip between windows .. or two screens

sillychipmunk commented 5 months ago

image

sillychipmunk commented 5 months ago

i means seriously, now its "just" mapping all this "already made" logic from elm to python:

parseUserInterfaceFromUITree : UITreeNodeWithDisplayRegion -> ParsedUserInterface
parseUserInterfaceFromUITree uiTree =
    {
    ........................
    , overviewWindows = parseOverviewWindowsFromUITreeRoot uiTree
    .................
    , bookmarkLocationWindow = parseBookmarkLocationWindowFromUITreeRoot uiTree
    ..................
    , standaloneBookmarkWindow = parseStandaloneBookmarkWindowFromUITreeRoot uiTree
    ..................
    }
sillychipmunk commented 5 months ago

for undock button its not needed to do complex parsing however, it can be found by name.

sillychipmunk commented 5 months ago

@x-actly this is cool .. just tested undocking from memory :D fricking works.

>>> mem = fe.read_eve_process_memory(None)
>>> mem = fe.adjust_display_positions(mem)
>>> fe.find_undock_button(mem)
{'_setText': 'Undock', '_displayY': 289, '_displayHeight': 18, '_displayX': 1765, '_color': {'aPercent': 75, 'rPercent': 100, 'gPercent': 100, 'bPercent': 100}, '_width': 40, '_name': 'label', '_displayWidth': 40, '_height': 18}
>>> fe.undock(1765, 289)
2024-05-27 18:11:54.125 | INFO     | Bot.functions:undock:38 - undocking...

this is revolutionary. Next i will try to undock and then move to a bookmark (belt)

sillychipmunk commented 5 months ago

<3

2024-05-27 20:43:49.981 | WARNING  | Bot.config:_get_setting:136 - Couldn't read cargo_loading_time_adjustment from settings, using default: 420.0
2024-05-27 20:43:49.982 | WARNING  | Bot.config:_get_boolean_setting:119 - Couldn't read auto_reset_miners from settings, using default: True
2024-05-27 20:43:50.103 | INFO     | Bot.bot:<module>:158 - Selected the first EVE window
2024-05-27 20:43:50.212 | INFO     | Bot.bot:start:688 - Starting bot
2024-05-27 20:43:59.105 | INFO     | Bot.bot:save_properties:593 - Configuration updated
2024-05-27 20:43:59.105 | INFO     | Bot.bot:start_function:665 - The mining script will run 2 mining runs!
2024-05-27 20:43:59.105 | INFO     | Bot.bot:start_function:666 - Using miner reset timer of 122 seconds.
2024-05-27 20:43:59.106 | INFO     | Bot.bot:start_function:674 - Estimate for completion is 1h 06m 22s
2024-05-27 20:43:59.111 | INFO     | Bot.bot:repeat_function:601 - Loading eve memory...
2024-05-27 20:44:47.914 | INFO     | Bot.bot:repeat_function:603 - Eve memory loaded! Starting mining...
2024-05-27 20:44:47.916 | INFO     | Bot.bot:repeat_function:608 - The mining cargo is filled in about 26m 11s
2024-05-27 20:44:48.919 | INFO     | Bot.functions:undock:38 - undocking...
2024-05-27 20:45:04.864 | INFO     | Bot.functions:set_hardener_online:49 - starting hardeners...
2024-05-27 20:45:04.894 | INFO     | Bot.functions:click_circle_menu:57 - clicking on the circle menu...
sillychipmunk commented 5 months ago

tested it and it works .. tomorrow i will make code to find asteroids in overview tab. it would need to reread the memory after warping to belt, but only once. We can cache the first two overview positions. EDIT: Hmm maybe should reread after each mining reset to make sure its enough roids left and if not exit and warp home EDIT2: the code will cache the root address in memory so it should be a fast lookup

sillychipmunk commented 5 months ago

now it works :) going to let it run until server reset now ;) you can test the branch now @x-actly. You still need to set clear cargo position and mouse reset position, but every other position is retrieved from eve memory.

It takes a minute from when you click start because it reads eve memory. But after that everything is as before.

sillychipmunk commented 5 months ago

image

sillychipmunk commented 5 months ago

It doesnt work to have it right aligned anymore. So just move it to the middle of the screen. Should disable on-top maybe. Not really needed. Or make it smaller when using eve memory

sillychipmunk commented 5 months ago

Oh and i used fixed fullscreen window. Its so much better. Plus not sure if it Even works in Windowed mode since offset from title bar isnt taken into account..

sillychipmunk commented 5 months ago

The beauty of all this is that we can periodically monitor local chat for fiends....;) just need to make a method to extract players from local chat

sillychipmunk commented 4 months ago

still here. Training skills in the background on two accounts, and have too much to do IRL ;)

I am a bit worried about the exe file being published here. Propably we should just use the default memory reading exe file from sanderling, call it, which will save a file to disk and then read the file to get the json. Right now I have hacked the memory reading c# code in a fork and built the exe file to return json output and not save to file.

x-actly commented 4 months ago

still here. Training skills in the background on two accounts, and have too much to do IRL ;)

I am a bit worried about the exe file being published here. Propably we should just use the default memory reading exe file from sanderling, call it, which will save a file to disk and then read the file to get the json. Right now I have hacked the memory reading c# code in a fork and built the exe file to return json output and not save to file.

All good, take your time... and work on it whenever you feel like it and have time, best regards

sillychipmunk commented 4 months ago

An idea. Maybe the new elm inspired language Gren, which is created for systems/backend/cli development, could be able to run the elm code in sanderling ui module. This will make the work of translating the memory reading into actually usable Logic so much easier. Its an exciting hypothesis at least.