Philipp15b / go-steam

Steam's protocol in Go to allow automation of different actions on the Steam network without running an actual Steam client. Includes APIs for friends, chatting, trading, trade offers and TF2 crafting.
https://pkg.go.dev/github.com/Philipp15b/go-steam/v3
Other
387 stars 131 forks source link

Gamecordinator csgo send ECsgoGCMsg = 9156 but steam not respond anyhing #132

Open VusalShahbazov opened 1 year ago

VusalShahbazov commented 1 year ago

Hello! I have trouble with GC When i send this request

client.GC.Write(gamecoordinator.NewGCMsgProtobuf(
    730,
    uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest),
    &payload,
))

I dont get any response from steam

I Register the handler for client.GC but nothing appear after my request


type Handler struct{}

func (g *Handler) HandleGCPacket(p *gamecoordinator.GCPacket) {
    fmt.Println("HandleGCPacket")
    if p.AppId == 730 {
        switch p.MsgType {
        case uint32(protobuf.ECsgoGCMsg_k_EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockResponse):
            var res protobuf.CMsgGCCStrike15V2_Client2GCEconPreviewDataBlockResponse
            err := proto.Unmarshal(p.Body, &res)
            if err != nil {
                panic(err)
            }

            fmt.Println( res.Iteminfo.GetPaintwear())
        }
    }
}

// ... 
client.GC.RegisterPacketHandler(&Handler{})

And please provide examples of GC usage

SakuraBurst commented 1 year ago

Hello! I'm not familiar with this library yet, but I'm dealing with the same problem. After connecting and successfully authenticating, you need to indicate to the client that you are in the game.

var appID uint64 = 730

gp := protobuf.CMsgClientGamesPlayed{GamesPlayed: []*protobuf.CMsgClientGamesPlayed_GamePlayed{{GameId: &appID}}}

client.Write(protocol.NewClientMsgProtobuf(steamlang.EMsg_ClientGamesPlayed, &gp))

After that, you can send messages to the gс by writing the running game id to the app_id field, and wait for a response