mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-03-21 19:56:14 +00:00
Fix typo avorive -> avorite, improve Play Now server selection to check server version if provided
This commit is contained in:
@@ -249,9 +249,17 @@ class W3DHub
|
|||||||
|
|
||||||
return nil unless app_data
|
return nil unless app_data
|
||||||
|
|
||||||
found_server = Store.server_list.select do |server|
|
server_options = Store.server_list.select do |server|
|
||||||
server.game == app_id && server.channel == channel && !server.status.password && server.status.player_count < server.status.max_players
|
server.game == app_id &&
|
||||||
end&.first
|
server.channel == channel &&
|
||||||
|
!server.status.password &&
|
||||||
|
server.status.player_count < server.status.max_players
|
||||||
|
end
|
||||||
|
|
||||||
|
# try to find server with lowest ping and matching version
|
||||||
|
found_server = server_options.find { |server| server.version == app_data[:installed_version] }
|
||||||
|
# try to find server with lowest ping and undefined version
|
||||||
|
found_server ||= server_options.find { |server| server.version == Api::ServerListServer::NO_OR_DEFAULT_VERSION }
|
||||||
|
|
||||||
found_server ? found_server : nil
|
found_server ? found_server : nil
|
||||||
end
|
end
|
||||||
@@ -283,7 +291,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def favorive(app_id, bool)
|
def favorite(app_id, bool)
|
||||||
Store.settings[:favorites] ||= {}
|
Store.settings[:favorites] ||= {}
|
||||||
|
|
||||||
if bool
|
if bool
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class W3DHub
|
|||||||
flow(width: 1.0, height: 28, padding: 8) do
|
flow(width: 1.0, height: 28, padding: 8) do
|
||||||
para "Favorite", fill: true
|
para "Favorite", fill: true
|
||||||
toggle_button checked: Store.application_manager.favorite?(game.id), height: 18, padding_top: 3, padding_right: 3, padding_bottom: 3, padding_left: 3 do |btn|
|
toggle_button checked: Store.application_manager.favorite?(game.id), height: 18, padding_top: 3, padding_right: 3, padding_bottom: 3, padding_left: 3 do |btn|
|
||||||
Store.application_manager.favorive(game.id, btn.value)
|
Store.application_manager.favorite(game.id, btn.value)
|
||||||
Store.settings.save_settings
|
Store.settings.save_settings
|
||||||
|
|
||||||
populate_games_list
|
populate_games_list
|
||||||
|
|||||||
Reference in New Issue
Block a user