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

Add co-op support #44

Merged
merged 6 commits into from
May 14, 2018
Merged

Conversation

StoicLoofah
Copy link
Collaborator

Not sure if anyone else is actively watching this repo for changes, but I added basic co-op support!

Most of the changes here are just addressing errors from co-op. I'll comment through on those.

I also added the commander to Player so you can check that.

Note that replay.cooperative == 0 for these replays. I filed an issue for it Blizzard/s2protocol#69 In the meantime, checking for a commander being set is the best we have

I might merge sometime on my own if no one reviews it, but it would be great if someone could take a look

@@ -164,10 +164,13 @@ class Player(object):
:param dict detail_data: The detail data associated with this player
:param dict attribute_data: The attribute data associated with this player
"""
def __init__(self, pid, detail_data, attribute_data):
def __init__(self, pid, slot_data, detail_data, attribute_data):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have to pass slot_data through to Player because that's where the commander name is

@@ -416,7 +416,8 @@ def load_players(self):
self.entities.append(Observer(slot_id, slot_data, user_id, initData['user_initial_data'][user_id], player_id))
player_id += 1

elif slot_data['control'] == 3:
elif slot_data['control'] == 3 and detail_id < len(details['players']):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be honest, I'm not really sure why this was necessary

@dsjoerg
Copy link
Member

dsjoerg commented Apr 6, 2018

sweeeeeet

@StoicLoofah StoicLoofah merged commit 7221653 into ggtracker:upstream May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants