1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-28 05:12:36 +01:00

BREAKING CHANGE: new query API

This commit is contained in:
aclist 2023-11-15 19:53:11 +09:00
parent 8738475e16
commit e6f808892b
3 changed files with 930 additions and 705 deletions

View file

@ -1,5 +1,49 @@
# Changelog
## [4.0.0-rc.1] 2023-11-15
Hello players, this is a major version update which overhauls many of DZGUI's underlying systems to improve responsiveness of the application and make menus more intuitive to interact with. It should
be considerably more difficult if not impossible to inadvertently crash a dialog, and nested dialogs should behave in a more expected fashion, such as when going back and forth between menus or
changing options dynamically within a given menu.
In addition, with this update we are querying servers directly. The net benefit of this is that results will returned faster, bootup is faster, and it also paves the way for future features like
connecting to servers on a LAN. The Battlemetrics API is now entirely optional and can be skipped during the setup process.
However, you can continue using it if you want to query or add servers by ID instead of IP.
As part of this change, version 4.0.0 introduces the ability to connect to or add servers to your list based on either ID or IP.
Previously, you could only connect by IP and add by IP, but now you can connect by IP/ID or add by IP/ID.
If you choose the ID method, this will be translated into an IP seamlessly in the background.
Similarly, favorite servers are now stored using the full IP rather than the ID.
Due to the variety of systems and methods for connecting to servers, the application was carrying around and converting server IPs, IDs, and other formats back and forth, creating unnecessary complexity. By normalizing everything to an IP basis, maintainability should be more consistent. When upgrading to this version, your old favorites lists will be updated automatically to the new IP method.
Note that as a result of this change, we must purge old history lists ("Recent Servers"), but everything else should carry over as before.
If you encounter problems, please report them via the appropriate channels and I will be happy to help you. This release candidate will remain on the testing branch for a few days before being merged
into the stable branch.
## Added
- Change in game name: dynamically change your profile name via the Advanced Options menu
- Connect by ID: supply a Battlemetrics ID to connect to a server; this can be used in lieu of the IP
- Add by IP: supply a standard IP to add a server to your list; this can be used as a more direct way of saving servers
- Save connected server to favorites: prior to connecting, asks the user if they want to save this server for future use
- Generate additional output when generating system logs
## Fixed
- Rare cases where the keyword filter would not filter server results correctly
- Handling of dialog exit signals: made it much more difficult to crash the application in rare cases when spamming input or returning from menus
- Update menus in place: when toggling options in the Advanced Options menu, displays the current state/mode of the option for better readability into what option is currently enabled
- More intuitive menu navigation: dialog setup and teardown is more responsive and follows expected flows when inside of nested menus
- Message formatting: fold long messages inside of popup dialogs for proper word wrapping regardless of screen type
- Fixed a rare case where dialogs would spawn twice during first-time setup
- Properly remain inside of menus when looping where it would make sense to do so : e.g., Delete Servers list, Advanced Options
## Changed
- Query servers directly to reduce API hops: initial bootup and subsequent server queries should be considerably faster
- Store complete IP:Port instead of server IDs
- Make Battlemetrics API key optional: this is only used for the 'Connect by ID' and 'Add server by ID' methods and is not required. If you prefer, you can simply connect/add by IP.
- Prevent the application from launching in Game Mode on Steam Deck: Steam Deck's kiosk mode has problems sending keyboard input to third party applications. To prevent unintended usage, DZGUI now warns the user to launch the app in Desktop Mode if they attempt to use it from Game Mode. Adding DZGUI as a Non-Steam Game does work on desktop PCs, but is not recommended due to the way Steam handles subshells. For best results, launch DZGUI directly via the script/applications menu (PC) or via the desktop icon (Steam Deck).
- Omit null servers from list: servers that timeout or send an empty response are now omitted entirely from the My Servers list, as they will not return meaningful metadata unless they are online. The
My Servers list thus shows online and accessible servers
## [3.4.0-rc.1] 2023-05-16
### Added
- Fetch more inclusive global "players in-game" count

1541
dzgui.sh

File diff suppressed because it is too large Load diff

50
helpers/query.py Normal file
View file

@ -0,0 +1,50 @@
import sys
import a2s
import math
import json
from a2s import dayzquery
sys.path.append('a2s')
def get_info(ip, qport):
try:
info = a2s.info((ip, int(qport)))
name = info.server_name
address = ip + ":" + str(info.port)
count = str(info.player_count) + "/" + str(info.max_players)
keywords = info.keywords
ping = (info.ping*1000)
ping = math.floor(ping)
res = {}
res['name'] = name
res['address'] = address
res['count'] = count
res['keywords'] = keywords
res['stat'] = "online"
res['qport'] = qport
res['ping'] = str(ping) + "ms"
j = json.dumps(res)
print(j)
except:
sys.exit(1)
def get_rules(ip, qport):
try:
mods = dayzquery.dayz_rules((ip, int(qport))).mods
for k in mods:
print(k.workshop_id)
except:
sys.exit(1)
ip = sys.argv[1]
qport = sys.argv[2]
mode = sys.argv[3]
match mode:
case "info":
get_info(ip, qport)
case "rules":
get_rules(ip, qport)