def login(sock, username, password): '登录session' sock.sendall( request_msg( msgid.LOGIN, session_pb2.LoginRequest(username=username, password=password))) return expect(msgid.LOGIN, session_pb2.LoginResponse)
def login_world(sock, userID, verify_code): '登录世界服务器' sock.sendall( request_msg( msgid.LOGIN_WORLD, role_pb2.LoginWorldRequest(userID=userID, verify_code=verify_code))) return expect(msgid.LOGIN_WORLD, role_pb2.LoginWorldResponse)
def enter(sock, entityID, newRole): '进入世界消息' sock.sendall( request_msg(msgid.ENTER_SCENE, world_pb2.EnterRequest(entityID=entityID))) expect(msgid.ENTER_SCENE) incr_enter_count() if newRole: pass
def login_sdk(sock, uin, sdkType): sock.sendall( request_msg( msgid.SDK_CHECK_LOGIN, sdk_pb2.SDKLoginRequest(sdkType=sdkType, sessionId='', uin=uin, deviceId=''))) return expect(msgid.SDK_CHECK_LOGIN, session_pb2.LoginResponse)
def start_pay(sock, sdkType=sdk_pb2.SDK_YY): sock.sendall( request_msg(msgid.SDK_PAY_START, sdk_pb2.SDKStartPayRequest(sdkType=sdkType))) return expect(msgid.SDK_PAY_START, sdk_pb2.SDKStartPayResponse).serialNo
def switch_scene(sock, sceneId): sock.sendall( request_msg(msgid.CHANGE_SCENE, world_pb2.EnterSceneRequest(sceneId=sceneId))) return expect_me()
def save_guide(sock, gid): sock.sendall( request_msg(msgid.GUIDE_SAVE, guide_pb2.SignGuide(guideId=gid)))
def request_sync_property(sock): sock.sendall(request_msg(msgid.SYNC_PROPERTY)) return expect(msgid.SYNC_PROPERTY, world_pb2.SyncProperty)
def collide_npc(sock, entityID): sock.sendall( request_msg(msgid.COLLIDE_NPC, world_pb2.NpcCollideRequest(entityID=entityID)))
def login_key(sock, mid, code=None): sock.sendall( request_msg( msgid.LOGIN_KEY, session_pb2.LoginRequest(username=mid, password=code or ''))) return expect(msgid.LOGIN_KEY, session_pb2.LoginResponse, allow_error=True)