Sha256: f503894c48e1541e1ebf54ce8cecf63c966986740751737b23c443ffbc06241d

Contents?: true

Size: 1005 Bytes

Versions: 4

Compression:

Stored size: 1005 Bytes

Contents

# 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
steamrb-0.1.3 lib/steam/handler/steam_apps.rb
steamrb-0.1.2 lib/steam/handler/steam_apps.rb
steamrb-0.1.1 lib/steam/handler/steam_apps.rb
steamrb-0.1.0 lib/steam/handler/steam_apps.rb