ValvePython / dota2

🐸 Python package for interacting with Dota 2 Game Coordinator
http://dota2.readthedocs.io
201 stars 32 forks source link

Implement shared objects #1

Open rossengeorgiev opened 8 years ago

rossengeorgiev commented 8 years ago
m-bo-one commented 7 years ago

Hi! Full implementation of parties require this part of create/update. Without this I could not make accept and decline event handling. Could I make a request without this part, just with bare features? And after help to finish this part and complete invite party module. TY.

rossengeorgiev commented 7 years ago

I wanted to make SOs easy to work with, but I didn't quite figure out how. Needs more investigation. If you want to do it, go for it. I'm happy to look over any code and help out

m-bo-one commented 7 years ago

How about this implementation? What you thinking about this? https://gist.github.com/DeV1doR/def8d11e1bc64d36614ca9494bfcbcf9

rossengeorgiev commented 7 years ago

Thank @DeV1doR, but I want to keep SOCache more general and not entangled with other parts of the code. I've refactored it on top of your changes. It will now track most of the SO types. See party branch

m-bo-one commented 7 years ago

@rossengeorgiev, now it become much difficult, and I don't understand how will be controlled the state, when GC is in the party, lobby etc.? And I think this is very bad https://github.com/ValvePython/dota2/blob/party/dota2/features/sharedobjects.py#L122 better do not complex data result and handle if something None with raising the exception.

rossengeorgiev commented 7 years ago

In Party you add handlers to listen for the appropriate events.

@client.socache.on(('new', CSODOTAPartyInvite))
def new_party_invite(message):
    pass
m-bo-one commented 7 years ago

@rossengeorgiev , could you give full example of code after this implementation? TY)

rossengeorgiev commented 7 years ago

Seems like there are a few more bits I need to figure out, before that. I will add some code for parties when its ready. Can't test right now since GC is acting up.