Show server name with player count to be joined in tooltip for 'Play Now' button

This commit is contained in:
2022-06-04 21:26:24 -05:00
parent c0eac0104b
commit 2531a20bab
2 changed files with 19 additions and 4 deletions

View File

@@ -203,12 +203,20 @@ class W3DHub
end
end
def play_now(app_id, channel)
def play_now_server(app_id, channel)
app_data = installed?(app_id, channel)
return false unless app_data
return nil unless app_data
server = Store.server_list.select { |server| server.game == app_id && server.channel == channel && !server.status.password }&.first
found_server = Store.server_list.select do |server|
server.game == app_id && server.channel == channel && !server.status.password
end&.first
found_server ? found_server : nil
end
def play_now(app_id, channel)
server = play_now_server(app_id, channel)
return false unless server