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

AstronClientRepository improvements #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
acr: Add missing methods for handling generations with OTHER fields +…
… changed "getArg" functions with their own "get_*" functions
LittleToonCat authored Nov 8, 2016
commit 5ab24e5aeee484da124e8cea4af2103673319b95
34 changes: 26 additions & 8 deletions direct/src/distributed/AstronClientRepository.py
Original file line number Diff line number Diff line change
@@ -34,7 +34,9 @@ def __init__(self, *args, **kwargs):
self.message_handlers = {CLIENT_HELLO_RESP: self.handleHelloResp,
CLIENT_EJECT: self.handleEject,
CLIENT_ENTER_OBJECT_REQUIRED: self.handleEnterObjectRequired,
CLIENT_ENTER_OBJECT_REQUIRED_OTHER: self.handleEnterObjectRequiredOther,
CLIENT_ENTER_OBJECT_REQUIRED_OWNER: self.handleEnterObjectRequiredOwner,
CLIENT_ENTER_OBJECT_REQUIRED_OTHER_OWNER: self.handleEnterObjectRequiredOtherOwner,
CLIENT_OBJECT_SET_FIELD: self.handleUpdateField,
CLIENT_OBJECT_SET_FIELDS: self.handleUpdateFields,
CLIENT_OBJECT_LEAVING: self.handleObjectLeaving,
@@ -70,21 +72,37 @@ def handleEject(self, di):
messenger.send("CLIENT_EJECT", [error_code, reason])

def handleEnterObjectRequired(self, di):
do_id = di.getArg(STUint32)
parent_id = di.getArg(STUint32)
zone_id = di.getArg(STUint32)
dclass_id = di.getArg(STUint16)
do_id = di.get_uint32()
parent_id = di.get_uint32()
zone_id = di.get_uint32()
dclass_id = di.get_uint16()
dclass = self.dclassesByNumber[dclass_id]
self.generateWithRequiredFields(dclass, do_id, di, parent_id, zone_id)

def handleEnterObjectRequiredOther(self, di):
do_id = di.get_uint32()
parent_id = di.get_uint32()
zone_id = di.get_uint32()
dclass_id = di.get_uint16()
dclass = self.dclassesByNumber[dclass_id]
self.generateWithRequiredOtherFields(dclass, do_id, di, parent_id, zone_id)

def handleEnterObjectRequiredOwner(self, di):
avatar_doId = di.getArg(STUint32)
parentId = di.getArg(STUint32)
zoneId = di.getArg(STUint32)
dclass_id = di.getArg(STUint16)
avatar_doId = di.get_uint32()
parent_id = di.get_uint32()
zone_id = di.get_uint32()
dclass_id = di.get_uint16()
dclass = self.dclassesByNumber[dclass_id]
self.generateWithRequiredFieldsOwner(dclass, avatar_doId, di)

def handleEnterObjectRequiredOtherOwner(self, di):
avatar_doId = di.get_uint32()
parent_id = di.get_uint32()
zone_id = di.get_uint32()
dclass_id = di.get_uint16()
dclass = self.dclassesByNumber[dclass_id]
self.generateWithRequiredOtherFieldsOwner(dclass, avatar_doId, di)

def generateWithRequiredFieldsOwner(self, dclass, doId, di):
if doId in self.doId2ownerView:
# ...it is in our dictionary.