Updated server browser to order servers by player count, then by ping.

This commit is contained in:
2025-05-16 09:47:49 -05:00
parent 1e0adc398c
commit 9dfee9d1d3
2 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
class W3DHub
class Api
class ServerListServer
NO_OR_BAD_PING = 1_000_000
attr_reader :id, :game, :address, :port, :region, :channel, :ping, :status
def initialize(hash)
@@ -12,7 +14,7 @@ class W3DHub
@port = @data[:port]
@region = @data[:region]
@channel = @data[:channel] || "release"
@ping = -1
@ping = NO_OR_BAD_PING
@status = Status.new(@data[:status])
@@ -55,7 +57,7 @@ class W3DHub
end
end
@ping = -1 if @ping.zero?
@ping = NO_OR_BAD_PING if @ping.zero?
@ping
end,