Retrieval and display of game servers is now working

This commit is contained in:
2026-09-04 18:55:57 -05:00
parent 7524d01347
commit 7f716a57ca
6 changed files with 117 additions and 23 deletions

View File

@@ -32,6 +32,10 @@ module W3DHubLauncher
"ff_#{extended_data("colour","#000000").sub("#", "")}".to_i(16)
end
def game?
@type.include?("game")
end
def servicable?
@servicable
end

View File

@@ -3,7 +3,10 @@ module W3DHubLauncher
class Api
# Designed to work with cyberarm's Game Server Hub service data, may work with W3D Hub's service with degraded metadata.
class GameServer
attr_reader :id, :game, :channel, :address, :port, :region, :version
attr_reader :id, :game, :channel, :address, :port, :region,
:name, :password, :current_map, :player_count, :max_players,
:match_start_time, :estimated_end_time, :match_remaining_time,
:teams, :next_map, :version
def initialize(data)
# main data
@@ -43,6 +46,15 @@ module W3DHubLauncher
@version = data["version"] || "838"
@next_map = data["status"]["nextmap"] || ""
end
# TODO: implement :)
def time_elapsed
"00:00"
end
def password?
@password
end
end
class Team