ao-data / albiondata-client

Distributed client for the Albion Online Data project.
https://www.albion-online-data.com/
MIT License
97 stars 30 forks source link

Advice on extracting eventtypes #112

Open matheussampaio opened 1 month ago

matheussampaio commented 1 month ago

Hi, I'm the maintainer of a free loot logger for Albion (https://github.com/matheussampaio/ao-loot-logger). Once in a while, Albion releases introduces/removes new packets to their game and breaks the loot logger. Every time that happens, it takes me a few nights to figure out the new packets ids.

I was pointed it to your codebase this week (https://github.com/matheussampaio/ao-loot-logger/issues/42) and noticed you generate ALL event types using what it seems to be a script (stringer -type=EventType): https://github.com/ao-data/albiondata-client/blob/d639e71261c65f04699f843396faf49258bbf7be/client/eventtype_string.go#L1

If possible, could you point me out to how I could extract all current ids from the game (I couldn't find the script in the repository).

phendryx commented 1 month ago

There's no script for it because it's a manual process. You have to ensure the game has been updated on your machine and then run a program called il2cppdumper against the game files. It gives you a decompiled version of the game that is missing the majority of the game code but does expose function signatures and enums in readable text. I manually grab the event and operation codes, reformat them to work with golang and paste them into https://github.com/ao-data/albiondata-client/blob/master/client/events.go and https://github.com/ao-data/albiondata-client/blob/master/client/operations.go. The stringer output (events_string.go and operations_string.go) is a golang thing and I'm honestly not even sure what it does (it was added to the code base before I tool over maintenance of the project).

I do have some thoughts on how to automate this process, as well as ao-bin-dumps, but as of now, both are a manual process. If you think it'd be of use to you, as well as some other projects I know that are using ev/op codes that outside of what AODP does, I could make a repo on the ao-data github org that holds just the codes, somewhat like ao-bin-dumps holds all the data from the game bin files. Or, since it's just 2 extra files, maybe toss those into the ao-bin-dumps repo.

matheussampaio commented 1 month ago

There's no script for it because it's a manual process. You have to ensure the game has been updated on your machine and then run a program called il2cppdumper against the game files. It gives you a decompiled version of the game that is missing the majority of the game code but does expose function signatures and enums in readable text. I manually grab the event and operation codes, reformat them to work with golang and paste them into https://github.com/ao-data/albiondata-client/blob/master/client/events.go and https://github.com/ao-data/albiondata-client/blob/master/client/operations.go. The stringer output (events_string.go and operations_string.go) is a golang thing and I'm honestly not even sure what it does (it was added to the code base before I tool over maintenance of the project).

Interesting! I'll research about this, thanks for sharing it.

If you think it'd be of use to you, as well as some other projects I know that are using ev/op codes that outside of what AODP does, I could make a repo on the ao-data github org that holds just the codes, somewhat like ao-bin-dumps holds all the data from the game bin files. Or, since it's just 2 extra files, maybe toss those into the ao-bin-dumps repo.

This would be awesome! I don't have experience with Go, but if you share your thoughts on how to automate it, me or maybe someone out there can give a try.