GuilhermeFaga / hero-siege-stats

Program that captures network packets from HS server and translates it to relevant game stats.
4 stars 2 forks source link

Update to UI and support for Asian server #1

Open nicholas-tollner opened 8 months ago

nicholas-tollner commented 8 months ago

Added support for connection to Asia server as well as changes to UI which enable users to switch between regions.

GuilhermeFaga commented 8 months ago

Thanks for the PR @nicholas-tollner!

I took a quick look and apparently has a few things that can be adjusted before I merge it.

I'll be reviewing your changes in depth this weekend.

GuilhermeFaga commented 8 months ago

The method responsible for sniffing the network is Backend.initialize (src/engine/backend.py):

          ...
32        sniffer = AsyncSniffer(
33            iface=iface,
34            filter=f"(host {' or host '.join(login_servers.values())}) and len > 30",
35            prn=packet_callback,
36            store=False
37        )
38        sniffer.start()
          ...

On line 34 it uses the dict login_servers values to build a filter query. It already listen to any of the servers, so it's not necessary for the user to select one.

The method that you changed (check_server_connection) just sends an empty packet to check whether or not the server is alive.

Knowing that, I ask that you make a few changes before I approve and merge the PR: