def enterInstance1(dynamicId, characterId, InstanceId): '''进入副本 @param dynamicId: int 角色动态id @param characterId: int 角色id @param InstanceId: int 副本id ''' vplayer = VCharacterManager().getVCharacterByClientId(dynamicId) if not vplayer or vplayer.getLocked():#判断是否存在角色或者角色是否被锁定 return oldnode = 201000 if oldnode < 300000 and oldnode != 0:#如果角色在场景 #创建新的副本返回服务器编号,副本动态id famserTag,famId=FamSerManager().createNewFam(dynamicId) if famserTag <0: return vplayer.lock()#锁定角色对象 newnode = 300000+famserTag #获取角色在原先场景中的实例 d = GlobalObject().root.callChild("scense_1000",610,dynamicId, characterId) #调用失败后的处理 d.addErrback(InFamErrbck,vplayer,newnode,famId) #进入副本 d.addCallback(Transfer1501,newnode,dynamicId,characterId,InstanceId,famId) return d else: dd = defer.Deferred() dd.callback({'result':True,'message':u'nofam'}) return dd
def enterInstance1(dynamicId, characterId, InstanceId): '''进入副本 @param dynamicId: int 角色动态id @param characterId: int 角色id @param InstanceId: int 副本id ''' vplayer = VCharacterManager().getVCharacterByClientId(dynamicId) if not vplayer or vplayer.getLocked(): #判断是否存在角色或者角色是否被锁定 return oldnode = 201000 if oldnode < 300000 and oldnode != 0: #如果角色在场景 #创建新的副本返回服务器编号,副本动态id famserTag, famId = FamSerManager().createNewFam(dynamicId) if famserTag < 0: return vplayer.lock() #锁定角色对象 newnode = 300000 + famserTag #获取角色在原先场景中的实例 d = GlobalObject().root.callChild("scense_1000", 610, dynamicId, characterId) #调用失败后的处理 d.addErrback(InFamErrbck, vplayer, newnode, famId) #进入副本 d.addCallback(Transfer1501, newnode, dynamicId, characterId, InstanceId, famId) return d else: dd = defer.Deferred() dd.callback({'result': True, 'message': u'nofam'}) return dd
def CreateZuDui(dynamicId,pid,pos,gkType): '''创建队伍 ''' vplayer = VCharacterManager().getVCharacterByClientId(dynamicId) if not vplayer or vplayer.getLocked():#判断是否存在角色或者角色是否被锁定 return # nownode = vplayer.getNode() d = GlobalObject().root.callChild("scense_1000",610,dynamicId, pid) d.addErrback(ErorrBack) d.addCallback(TransferPlayerCreate,dynamicId,pid,pos,gkType) return d
def JoinDuiWu(dynamicId, pid, pos, dwId): """加入队伍 """ vplayer = VCharacterManager().getVCharacterByClientId(dynamicId) if not vplayer or vplayer.getLocked(): # 判断是否存在角色或者角色是否被锁定 return # nownode = vplayer.getNode() d = GlobalObject().root.callChild("scense_1000", 610, dynamicId, pid) d.addErrback(ErorrBack) d.addCallback(TransferPlayerJoin, dynamicId, pid, pos, dwId) return d
def forwarding(key,dynamicId,data): """ """ if localservice._targets.has_key(key): return localservice.callTarget(key,dynamicId,data) else: user = UsersManager().getUserByDynamicId(dynamicId) if not user: return oldvcharacter = VCharacterManager().getVCharacterByClientId(dynamicId) if not oldvcharacter: return if oldvcharacter.getLocked():#判断角色对象是否被锁定 return node = VCharacterManager().getNodeByClientId(dynamicId) return GlobalObject().root.callChild(node,key,dynamicId,data)
def forwarding(key,dynamicId,data): """ """ if key in GlobalObject().localservice._targets: return GlobalObject().localservice.callTarget(key,dynamicId,data) else: user = UsersManager().getUserByDynamicId(dynamicId) if not user: return oldvcharacter = VCharacterManager().getVCharacterByClientId(dynamicId) if not oldvcharacter: return if oldvcharacter.getLocked():#判断角色对象是否被锁定 return node = VCharacterManager().getNodeByClientId(dynamicId) return GlobalObject().root.callChild(node, key, dynamicId, data)
def forwarding(key, dynamicId, data): ''' ''' if localservice._targets.has_key(key): return localservice.callTarget(key, dynamicId, data) else: user = UsersManager().getUserByDynamicId(dynamicId) if not user: return "-1" if not user.CheckEffective(): return "-2" oldvcharacter = VCharacterManager().getVCharacterByClientId(dynamicId) if not oldvcharacter: return if oldvcharacter.getLocked(): #判断角色对象是否被锁定 return node = VCharacterManager().getNodeByClientId(dynamicId) return GlobalObject().root.callChild(node, key, dynamicId, data)
def roleLogin(dynamicId, userId, characterId): '''角色登陆 @param dynamicId: int 客户端的ID @param userId: int 用户的ID @param characterId: int 角色的ID ''' user=UsersManager().getUserByDynamicId(dynamicId) if not user: return {'result':False,'message':u'conn_error'} characterInfo = user.getCharacterInfo() if not characterInfo: return {'result':False,'message':u'norole'} characterId = user.characterId oldvcharacter = VCharacterManager().getVCharacterByCharacterId(characterId) if oldvcharacter and oldvcharacter.getLocked(): return {'result':False,'message':u'zhengzaiyx'} vcharacter = VirtualCharacter(characterId,dynamicId) VCharacterManager().addVCharacter(vcharacter) data = {'placeId':characterInfo.get('town',1000)} return {'result':True,'message':u'login_success','data':data}
def roleLogin(dynamicId, userId, characterId): '''角色登陆 @param dynamicId: int 客户端的ID @param userId: int 用户的ID @param characterId: int 角色的ID ''' user = UsersManager().getUserByDynamicId(dynamicId) if not user: return {'result': False, 'message': u'conn_error'} characterInfo = user.getCharacterInfo() if not characterInfo: return {'result': False, 'message': u'norole'} characterId = user.characterId oldvcharacter = VCharacterManager().getVCharacterByCharacterId(characterId) if oldvcharacter and oldvcharacter.getLocked(): return {'result': False, 'message': u'zhengzaiyx'} vcharacter = VirtualCharacter(characterId, dynamicId) VCharacterManager().addVCharacter(vcharacter) data = {'placeId': characterInfo.get('town', 1000)} return {'result': True, 'message': u'login_success', 'data': data}
def forwarding(key,dynamicId,data): #net传过来的信息 '''分配处理netserver转发的请求 @param key: int 请求的指令号 @param conn: Conn Object Client到netserver的连接 @param data: str Client 发送过来的数据 ''' if localservice._targets.has_key(key): return localservice.callTarget(key,dynamicId,data) else: from app.gate.basicapp.pushObject import pushOtherMessage from app.gate.utils.dbopera.db_language_login import getLanguageStr user = UsersManager().getUserByDynamicId(dynamicId) if not user: msg = getLanguageStr('conn_error') pushOtherMessage(msg,[dynamicId]) return oldvcharacter = VCharacterManager().getVCharacterByClientId(dynamicId) if oldvcharacter.getLocked():#判断角色对象是否被锁定 return node = VCharacterManager().getNodeByClientId(dynamicId) root=GlobalObject().root return root.callChild(node,key,dynamicId,data)
def forwarding(key, dynamicId, data): #net传过来的信息 '''分配处理netserver转发的请求 @param key: int 请求的指令号 @param conn: Conn Object Client到netserver的连接 @param data: str Client 发送过来的数据 ''' if localservice._targets.has_key(key): return localservice.callTarget(key, dynamicId, data) else: from app.gate.basicapp.pushObject import pushOtherMessage from app.gate.utils.dbopera.db_language_login import getLanguageStr user = UsersManager().getUserByDynamicId(dynamicId) if not user: msg = getLanguageStr('conn_error') pushOtherMessage(msg, [dynamicId]) return oldvcharacter = VCharacterManager().getVCharacterByClientId(dynamicId) if oldvcharacter.getLocked(): #判断角色对象是否被锁定 return node = VCharacterManager().getNodeByClientId(dynamicId) root = GlobalObject().root return root.callChild(node, key, dynamicId, data)