No description
Find a file
2025-10-29 23:54:08 +01:00
app add CELERY_URL env variable 2025-10-29 23:53:13 +01:00
discordbot add CELERY_URL env variable 2025-10-29 23:53:13 +01:00
kubernetes add kubernetes deployment files 2025-10-29 23:54:08 +01:00
.gitignore update to dom version 6.30 2025-10-06 19:43:29 +02:00
build.sh update to dom version 6.30 2025-10-06 19:43:29 +02:00
nations.ods update to dom version 6.30 2025-10-06 19:43:29 +02:00
README.md add celery integration info 2025-10-06 22:04:10 +02:00
server_info.py update to dom version 6.30 2025-10-06 19:43:29 +02:00
test_celery.py update to dom version 6.30 2025-10-06 19:43:29 +02:00

Reads connection information from a Dominions 6 server version 6.30

Direct usage

Direct usage example

from server_info import ServerInfo, NationInfoTurn

info = ServerInfo()

info.connect('my.dom5server.net', 1234) # supply host and port here

print(info) # prints game name, turn number and turn timer
for nation in info.nation_info.values():
    print(nation)
    if nation.turn != NationInfoTurn.played:
        print(f"Nation {nation.nation_name} needs to do its turn")

Celery integration

For an integration in an existing celery queue use this setup

app = Celery(
    "dominionsInformer",
    broker="redis://celery-broker-redis:6379",
    backend="redis://celery-broker-redis:6379",
)
app.conf.task_routes = {"dom6info.*": {"queue": "dom6info"}}

get_info = app.signature("dom6info.get_info")

and retrieve data with a call to the get_info with the supplied server and server password

serverinfo = get_info.delay(
        server_name=dom_servername, password=dom_password
    ).get()

The returned data is structured in a map

server_info = {
    "name": "name of the server",
    "motto": "motd",
    "turn": "current turn number",
    "nations": {
                    "id": "internal nation id byte",
                    "name": "readable nation name case sensitive",
                    "motto": "nation title",
                    "playertype": "internal player info byte",
                    "playertype-text": "human or ai",
                    "turninfo": "internal turn info byte",
                    "turninfo-text": "open or done",
                }
}