# frozen_string_literal: true module Steam module Handler # Steam apps handler class SteamApps include Handler::Base # Describes the EMsgs this Handler cares about handles EMsg::CLIENT_GAME_CONNECT_TOKENS # Handle a packet # # @param packet [Networking::Packet] the packet to handle def handle(packet) case packet.msg_type when EMsg::CLIENT_GAME_CONNECT_TOKENS handle_client_game_connect_tokens(packet) end end private # Handles a packet that contains connect tokens. Connect tokens # are required to tell the Steam servers you are playing a game. # # @param packet [Networking::Packet] the packet def handle_client_game_connect_tokens(packet) msg = packet.as_message(Steamclient::CMsgClientGameConnectTokens.new) @client.update_connect_tokens(msg.body.tokens, msg.body.max_tokens_to_keep) end end end end