Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status of the project #88

Open
eVen-gits opened this issue Jul 3, 2022 · 7 comments
Open

Status of the project #88

eVen-gits opened this issue Jul 3, 2022 · 7 comments
Labels

Comments

@eVen-gits
Copy link

Is this project still maintained?

I see it's bassed off of node-dota2, which has been deprecated.

I am currently to set up the bot, host a lobby, but I am unable to start it, as the bot doesn't connect to the game (even in broadcaster slot).

At the moment, I am looking at go-dota2, but that seems to be way more complicated (perhaps because I don't have experience with go).

So I guess my question is whether this project should still be used, or should I use something else?

@rossengeorgiev
Copy link
Member

Only basic maintenance, it is not being actively developed. None of these module will let you connect the game, only create and manage lobbies.

@eVen-gits
Copy link
Author

eVen-gits commented Jul 3, 2022

OK thanks!

I've managed to solve the problem by instead of joining the broadcaster team, I've joined the player pool team -> which disconnects the bot when it launches the game.

Now it appears that the bot does know when the game ends - once I write GG in chat and the throne explodes. The sequence of the messages is something like this:

Click to expand!
[2022-07-03 12:26:52,365] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:52,365] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:52,365] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:52,365] DEBUG SteamClient: Multi: Decompressing payload (1266 -> 1825)
[2022-07-03 12:26:52,366] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2022-07-03 12:26:52,366] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2022-07-03 12:26:52,366] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2022-07-03 12:26:52,366] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2022-07-03 12:26:52,366] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2022-07-03 12:26:52,366] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2022-07-03 12:26:52,366] DEBUG Dota2Client: Incoming: <ESOMsg.UpdateMultiple: 26>
[2022-07-03 12:26:52,367] DEBUG Dota2Client: Emit event: <ESOMsg.UpdateMultiple: 26>
[2022-07-03 12:26:52,367] DEBUG Dota2Client.socache: Emit event: ('updated', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2014
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2016
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2013
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2015
[2022-07-03 12:26:52,367] DEBUG Dota2Client: Emit event: 'lobby_changed'
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client.socache: Emit event: ('removed', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: 'lobby_removed'
[2022-07-03 12:26:52,464] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:52,464] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:52,464] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:52,464] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2022-07-03 12:26:52,464] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2022-07-03 12:26:52,465] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientFromGC: 5453> | CMsgGCClient)>
[2022-07-03 12:26:52,465] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2022-07-03 12:26:52,465] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCJoinChatChannelResponse: 7010>
[2022-07-03 12:26:52,465] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCJoinChatChannelResponse: 7010>
[2022-07-03 12:26:52,465] DEBUG Dota2Client.channels: Emit event: ('join_result', 'PostGame_27795233295518340', 18)
[2022-07-03 12:26:52,465] DEBUG Dota2Client.channels: Emit event: 'channel_joined'
[2022-07-03 12:26:52,465] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCOtherJoinedChannel: 7013>
[2022-07-03 12:26:52,465] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCOtherJoinedChannel: 7013>
[2022-07-03 12:26:52,466] DEBUG Dota2Client.channels: Emit event: 'members_update'
[2022-07-03 12:26:52,915] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:52,916] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:52,916] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:52,916] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientRichPresenceInfo: 7503> | not parsed)>
[2022-07-03 12:26:52,916] DEBUG SteamClient: Emit event: <EMsg.ClientRichPresenceInfo: 7503>
[2022-07-03 12:26:52,965] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:52,965] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:52,965] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:52,965] DEBUG SteamClient: Multi: Decompressing payload (271 -> 276)
[2022-07-03 12:26:52,966] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2022-07-03 12:26:52,966] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>
[2022-07-03 12:26:57,915] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:57,916] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:57,916] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:57,916] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientRichPresenceInfo: 7503> | not parsed)>
[2022-07-03 12:26:57,916] DEBUG SteamClient: Emit event: <EMsg.ClientRichPresenceInfo: 7503>
[2022-07-03 12:26:58,015] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:26:58,016] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:26:58,016] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:26:58,016] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2022-07-03 12:26:58,016] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>
[2022-07-03 12:26:59,026] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2022-07-03 12:27:08,026] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2022-07-03 12:27:17,027] DEBUG SteamClient: Outgoing: <MsgProto(<EMsg.ClientHeartBeat: 703> | CMsgClientHeartBeat)>
[2022-07-03 12:27:18,114] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:27:18,115] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:27:18,115] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:27:18,115] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2022-07-03 12:27:18,115] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>
[2022-07-03 12:27:20,419] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:27:20,419] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:27:20,419] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:27:20,419] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientRichPresenceInfo: 7503> | not parsed)>
[2022-07-03 12:27:20,419] DEBUG SteamClient: Emit event: <EMsg.ClientRichPresenceInfo: 7503>
[2022-07-03 12:27:20,515] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.Multi: 1> | CMsgMulti)>
[2022-07-03 12:27:20,515] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2022-07-03 12:27:20,515] DEBUG SteamClient: Multi: Unpacking
[2022-07-03 12:27:20,515] DEBUG SteamClient: Incoming: <MsgProto(<EMsg.ClientPersonaState: 766> | CMsgClientPersonaState)>
[2022-07-03 12:27:20,515] DEBUG SteamClient: Emit event: <EMsg.ClientPersonaState: 766>

The relevant bit, I guess, is this line:
[2022-07-03 12:26:52,465] DEBUG Dota2Client.channels: Emit event: ('join_result', 'PostGame_27795233295518340', 18)

Unfortunately, it doesn't seem that I can hook onto this event this way: self.dota.on('join_result', self.on_join_result), as the function doesn't seem to reach a breakpoint. Additionally, I am not sure what the number is - it's not the match ID. Is there a way to convert this?

Sorry if this is offtopic, but I don't know where else to ask. Still, thank you for your swift and understanding reply.

@rossengeorgiev
Copy link
Member

rossengeorgiev commented Jul 3, 2022

That is the post match chat channel, everyone gets joined to it after the match. You should be looking at:

[2022-07-03 12:26:52,367] DEBUG Dota2Client.socache: Emit event: ('updated', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2014
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2016
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2013
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2015
[2022-07-03 12:26:52,367] DEBUG Dota2Client: Emit event: 'lobby_changed'
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client.socache: Emit event: ('removed', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: 'lobby_removed'

Lobby change indicates that the lobby socache object has been updated, like with the match result. Followed by <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081> which indicates match end, not sure what the message contains. The lobby socache object gets removed as you are no longer in a lobby.

I wonder what the unsupported socache types are, these are new and need to be implemented.

@eVen-gits
Copy link
Author

Hm, I am trying to get this going, but with no success.

How can I look at a message? It appears that I can only register callbacks to events (such as lobby_new or lobby_changed).
I am doing this in such manner (short snippet):

    def on_dota_ready(self):
        print('{}: Dota ready!'.format(self.username))
        if self.dota.lobby:
            self.dota.leave_practice_lobby()
            self.dota.wait_event('lobby_removed')

        #Register callbacks
        self.dota.on('lobby_new', self.on_lobby_new)

    def on_lobby_new(self, CSODOTALobby:ESOType.CSODOTALobby):
        result = self.dota.join_practice_lobby(
            CSODOTALobby.lobby_id,
            password=CSODOTALobby.pass_key
        )
        #result = self.dota.join_practice_lobby_broadcast_channel() #Fails to launch game because bot doesn't connect
        result = self.dota.join_practice_lobby_team(1, DOTA_GC_TEAM.PLAYER_POOL)

How do I make a callback or how do I look at the messages you suggested? Sorry if these are basic questions, but I can't find anything regarding this in the docs.

@Philaeux
Copy link
Contributor

Philaeux commented Mar 3, 2023

To subscribe to a message, use the "dota.on" decorator or the callback subscribe method "on".

# Subscribing to a callback
dota.on('lobby_changed', game_update)

# Using feature code
dota.on(dota2.features.Lobby.EVENT_LOBBY_CHANGED, game_update)

# using Message code
dota.on(EDOTAGCMsg.EMsgGCMatchmakingStatsResponse, stat_response)

# using decorator version
@dota.on('lobby_changed')
def game_update(self, message):
   # Here message.state can be 
   # 0: in lobby
   # 1: in-game (loading)
   # 2: in game
   # 3: post-game
   # if 3, message.match_outcome == 2 if radiant win, or 3 if dire win
   pass

ISSUE STATUS: CLOSED
TAG: HOWTO

@vilad86
Copy link

vilad86 commented Nov 25, 2023

That is the post match chat channel, everyone gets joined to it after the match. You should be looking at:

[2022-07-03 12:26:52,367] DEBUG Dota2Client.socache: Emit event: ('updated', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2014
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2016
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2013
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2015
[2022-07-03 12:26:52,367] DEBUG Dota2Client: Emit event: 'lobby_changed'
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <ESOMsg.CacheUnsubscribed: 25>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081>
[2022-07-03 12:26:52,368] DEBUG Dota2Client.socache: Emit event: ('removed', <ESOType.CSODOTALobby: 2004>)
[2022-07-03 12:26:52,368] DEBUG Dota2Client: Emit event: 'lobby_removed'

Lobby change indicates that the lobby socache object has been updated, like with the match result. Followed by <EDOTAGCMsg.EMsgGCToClientMatchSignedOut: 8081> which indicates match end, not sure what the message contains. The lobby socache object gets removed as you are no longer in a lobby.

I wonder what the unsupported socache types are, these are new and need to be implemented.

Hi

[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2014
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2016
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2013
[2022-07-03 12:26:52,367] ERROR Dota2Client.socache: Unsupported type: 2015

How to disable these messages?

@Philaeux
Copy link
Contributor

I don't think the project is updated at the moment: protobuff are not synced with retail. Also the lib is using ValvePython/steam which is not updated and got a breaking change too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants