Exemplo n.º 1
0
def doMatch(dynamicId, characterId, npcid):
    ''''''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    data = gamer.trainmatch.doMacth(npcid)
    return {'result': True, 'data': data}
Exemplo n.º 2
0
def calPower(dynamicId,characterId):
	''''''
	gamer=GamersManager().getGamerBydynamicId(dynamicId)
	if dynamicId!=gamer.getDynamicId():
		return {'result':False,'message':"角色不存在"}
	result=gamer.CalPower()
	return result
Exemplo n.º 3
0
def sendMail(dynamicId, characterId, gamerName, title, content):
    '''添加邮件
	@param dynamicId:int 客户端的动态id
	@param characterId:int 角色的ID
	@param gamerName:str 接收人的名称
	@param content:str 邮件内容
	@param title:str 标题
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    if not dbShieldWord.checkIllegalChar(title):
        return {'result': False, 'message': u""}
    if not dbShieldWord.checkIllegalChar(content):
        return {'result': False, 'message': u""}
    if len(title) > 12:
        return {'result': False, 'message': u""}
    toId = dbCharacter.getCharacterIdByNickName(gamerName)
    if not toId:
        return {'result': False, 'message': u""}
    if toId[0] == characterId:
        return {'result': False, 'message': u""}
    result = gamer.mail.sendMail(toId[0], title, content)
    if result:
        return {'result': True, 'message': u""}
    return {'result': False, 'message': u""}
Exemplo n.º 4
0
def GetPackageInfo(dynamicId, characterId):
    '''获取包裹的信息'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'messgae': "角色不存在"}
    data = gamer.pack.getPackageItemList()
    return data
Exemplo n.º 5
0
def roleInfo(dynamicId, characterId):
    '''获取角色的状态栏信息
	@param userId: int 用户id
	@param characterId: 角色的id
	'''
    gamer = GamersManager().getGamerBydynamicId(dynamicId)
    if dynamicId != gamer.getDynamicId():
        return {'result': False, 'message': "角色不存在"}
    gamerinfo = gamer.formatInfo()
    responsedata = {
        'result': True,
        'message': '',
        'data': {
            'characterId': gamerinfo['id'],
            'rolename': gamerinfo['nickname'],
            'level': gamerinfo['level'],
            'exp': gamerinfo['exp'],
            'maxexp': gamerinfo['maxExp'],
            'gamecoin': gamerinfo['gamecoin'],
            'coin': gamerinfo['coin'],
            'energy': gamerinfo['energy'],
            'maxenergy': gamerinfo['energy'],
            'power': gamerinfo['power'],
            'photo': gamerinfo['photo'],
            'repute': gamerinfo['repute'],
            'trainpoint': gamerinfo['trainpoint'],
            'zenid': gamerinfo['zenid'],
            'tacticspoint': gamerinfo['tacticspoint']
        }
    }
    return responsedata
Exemplo n.º 6
0
def addPlayer(dynamicId, characterId, templateId):  #添加新球员到替补席
    '''添加新球员到替补席'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    result = gamer.player.addPlayer(templateId)
    return result
Exemplo n.º 7
0
def calPower(dynamicId, characterId):
    ''''''
    gamer = GamersManager().getGamerBydynamicId(dynamicId)
    if dynamicId != gamer.getDynamicId():
        return {'result': False, 'message': "角色不存在"}
    result = gamer.CalPower()
    return result
Exemplo n.º 8
0
def addPlayerExp(dynamicId, characterId, playerid, exp):
    '''球员加经验'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    result = gamer.player.addPlayerExp(playerid, exp)
    return result
Exemplo n.º 9
0
def buyItem(dynamicId,characterId,shopCategory,itemId,buyNum):
	'''购买道具'''
	gamer=GamersManager().getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	data=gamer.shop.buyItem(shopCategory,itemId,buyNum)
	return data
Exemplo n.º 10
0
def RotatePlayer(dynamicId, characterId, mainPlayerid, benchPlayerid):
    '''球员轮换'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    mainplayer = gamer.player.getPlayer(mainPlayerid)
    benchplayer = gamer.player.getPlayer(benchPlayerid)
    if mainplayer and benchplayer:
        maintempID = mainplayer.templateInfo.get('id')
        bebchtempID = benchplayer.templateInfo.get('id')
        if not gamer.player.IsOnCourt(
                bebchtempID, benchPlayerid) or maintempID == bebchtempID:
            playertemps = gamer.player.getPlayers()
            mainpos = mainplayer.getPlayerpos()
            benchpos = benchplayer.getPlayerpos()
            maincategory = mainplayer.getPlayerCategory()
            benchcategory = benchplayer.getPlayerCategory()
            mainplayer.savePlayerpos(benchpos, benchcategory)
            benchplayer.savePlayerpos(mainpos, maincategory)
            players = []
            for player in gamer.player.getPlayers().values():
                if player.getPlayerpos() >= 'a' and player.getPlayerpos(
                ) < 'z':  #场上球员
                    info = player.formatPlayerInfo()
                    players.append(info)
            if len(players) != 11:  #球员不是11人
                gamer.player._players = playertemps
                return {'result': False, 'message': u"换人失败"}
            gamer.CalPower()
            return {'result': True, 'message': u""}
        else:
            return {'result': False, 'message': u"该球员已经在场上"}
    else:
        return {'result': False, 'message': u"球员不存在"}
Exemplo n.º 11
0
def playerListInfo(dynamicId, characterId):
    '''获取角色的球员列表'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    playerList = gamer.player.FormatPlayerList()
    return {'result': True, 'data': playerList}
Exemplo n.º 12
0
def getChallengeMatchInfoByLeague(dynamicId,characterId,leagueindex):
	'''根据级别获取挑战赛赛npc信息'''
	gamer=GamersManager().getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	data=gamer.challengematch.getNpcByLeague(leagueindex)
	return {'result':True,'data':data}
Exemplo n.º 13
0
def UseItem(dynamicId, characterId, itemId, targetId):
    '''获取包裹的信息'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'messgae': "角色不存在"}
    data = gamer.pack.useItem(itemId, targetId)
    return data
Exemplo n.º 14
0
def commitTask(dynamicId,characterId,taskId):
	'''提交任务'''
	gamer=GamersManager().getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	gamer.task._tasks.get(taskId).setStatus(1)
	data=gamer.task.commitTask(taskId)
	return data
Exemplo n.º 15
0
def GetOneItemInfo(dynamicId, characterId, itemid):
    '''获取单个物品的详细信息
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    response = gamer.pack.getOneItemInfo(itemid)
    return response
Exemplo n.º 16
0
def CompoundItem(dynamicId, characterId, tempid):
    '''合成物品
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    response = gamer.pack.CompoundItem(tempid)
    return response
Exemplo n.º 17
0
def getTrainBase(dynamicId, characterId):
    '''获取训练基地信息'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    trainbase = TrainBase()
    data = trainbase.getTrainBase()  #获取训练基地信息
    return {'result': True, 'data': data}
Exemplo n.º 18
0
def GetCompoundPackage_2109(dynamicId, characterId):
    '''获取合成包裹的信息
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    response = gamer.pack.HouQuSuiPianBaoguo()
    return response
Exemplo n.º 19
0
def doWhenStop():
    """服务器关闭前的处理
	"""
    for gamer in GamersManager()._gamers.values():
        try:
            gamer.updateGamerDBInfo()
            GamersManager().dropGamer(gamer)
        except Exception as ex:
            log.err(ex)
Exemplo n.º 20
0
def getMailList(dynamicId, characterId):
    '''获取邮件列表
	@param characterId: int 角色的ID
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    mailListInfo = gamer.mail.getMailList()
    return {'result': True, 'data': mailListInfo}
Exemplo n.º 21
0
def operagamer_99(pid,opera_str):
	'''执行后台管理脚本'''
	gamer=GamersManager().getGamerByID(pid)
	isOline=1
	if not gamer:
		gamer=GamerCharacter(pid)
		isOline=0
	exec(opera_str)
	if isOline==0:
		gamer.updateGamerDBInfo()
Exemplo n.º 22
0
def getMailInfo(dynamicId, characterId, mailId):
    '''获取邮件的详细信息
	@param characterId: int 角色的ID
	@param mailId: int 邮件的ID
	'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    mailInfo = gamer.mail.readMail(mailID)
    return mailInfo
Exemplo n.º 23
0
def playertraining(dynamicId, characterId, Shoot, Dribbling, Speed, Pass,
                   Tackle, Tackling, _Save, Response, playerid, Trainpoint):
    '''球员训练'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    result = gamer.player.PlayerTraining(playerid, Shoot, Dribbling, Speed,
                                         Pass, Tackle, Tackling, _Save,
                                         Response, Trainpoint, gamer)
    return result
Exemplo n.º 24
0
def upgradePlayer(dynamicId, characterId, playerid, gamecoin, itemid):
    '''球员升级'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    if gamer.finance.addGameCoin(-gamecoin):
        result = gamer.player.upgradePlayer(playerid)
        return result
    else:
        return {'result': False, 'message': u"银币不足"}
Exemplo n.º 25
0
def TaskAcceptTaskList(dynamicId,characterId):
	'''获取可接任务列表
	@param dynamicId: int 客户端动态id
	@param characterId: int 角色id
	'''
	gamer=GamersManager().getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	data=gamer.task.getReceivedTaskList()
	return {'result':True,'data':data}
Exemplo n.º 26
0
def roleInfo(dynamicId,characterId):
	'''获取角色的状态栏信息
	@param userId: int 用户id
	@param characterId: 角色的id
	'''
	gamer=GamersManager().getGamerBydynamicId(dynamicId)
	if dynamicId!=gamer.getDynamicId():
		return {'result':False,'message':"角色不存在"}
	gamerinfo=gamer.formatInfo()
	responsedata={'result':True,'message':'','data':{'characterId':gamerinfo['id'],'rolename':gamerinfo['nickname'],'level':gamerinfo['level'],'exp':gamerinfo['exp'],'maxexp':gamerinfo['maxExp'],'gamecoin':gamerinfo['gamecoin'],'coin':gamerinfo['coin'],'energy':gamerinfo['energy'],'maxenergy':gamerinfo['energy'],'power':gamerinfo['power'],'photo':gamerinfo['photo'],'repute':gamerinfo['repute'],'trainpoint':gamerinfo['trainpoint'],'zenid':gamerinfo['zenid'],'tacticspoint':gamerinfo['tacticspoint']}}
	return responsedata
Exemplo n.º 27
0
def SignPlayer(dynamicId, characterId, playerId, gamecoin):  #签约球员
    '''签约球员'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    player = gamer.player.getPlayer(playerId)
    if gamer.finance.addGameCoin(-gamecoin):
        player.setPlayerCategory(2)
        player.setPlayerpos('z')
        return {'result': True, 'message': u""}
    else:
        return {'result': False, 'message': u"银币不足"}
Exemplo n.º 28
0
def dropPlayer(dynamicId, characterId, playerid):  #尚未添加返还训练点
    '''解雇球员'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    result = gamer.player.DropPlayer(playerid)
    if result:
        # returnpoint=PlayerInner.DISSMISSPOINT.get(playerquality) 查询训练点
        # gamer.playerInner.updatePoint(returnpoint) 返还训练点
        return {'result': True, 'message': ""}
    else:
        return {'result': False, 'message': u"解雇失败"}
Exemplo n.º 29
0
def NetConnLost_2(dynamicId):
	'''loginout
	'''
	gamer=GamersManager().getGamerBydynamicId(dynamicId)
	if not gamer:
		return True
	try:
		gamer.updateGamerDBInfo()
		GamersManager().dropGamer(gamer)
		gamer.playerInner.dbupdate()
	except Exception as ex:
		log.err(ex)
	finally:
		return 	True
Exemplo n.º 30
0
def DissmissPlayer(dynamicId, characterId, playerid):
    '''遣散球员'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    player = gamer.player.getPlayer(playerid)
    playerquality = player.level.getPlayerQuality()
    result = gamer.player.DropPlayer(playerid)
    if result:
        returnpoint = PlayerInner.DISSMISSPOINT.get(playerquality)
        gamer.playerInner.updatePoint(returnpoint)
        return {'result': True, 'message': ""}
    else:
        return {'result': False, 'message': u"遣散失败"}
Exemplo n.º 31
0
def getShopInfo(dynamicId,characterId,shopCategory):
	'''获取商城信息
	@param dynamicId:int 客户端id
	@param characterId:int 角色id
	@param shopCategory:int 商店类型 1金币2银币
	'''
	gamer=GamersManager().getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	shop=ShopManager().getShopByCategory(shopCategory)
	if not shop:
		shop=Shop(shopCategory)
		ShopManager().addShop(shop)
	data=shop.getShopInfo()
	return {'result':True,'data':data}
Exemplo n.º 32
0
def getPlayerInner(dynamicId, characterId):
    '''获取球员寻找信息'''
    gamer = GamersManager().getGamerByID(characterId)
    if not gamer or not gamer.CheckClient(dynamicId):
        return {'result': False, 'message': u"角色不存在"}
    data = {}
    pi = gamer.playerInner
    data['xy'] = pi.xy
    data['ctime1'] = pi.getTime(1)
    data['ctime2'] = pi.getTime(2)
    data['cs1'] = pi.cs1
    data['cs2'] = pi.cs2
    data['player1'] = pi.inner[0]
    data['player2'] = pi.inner[1]
    data['player3'] = pi.inner[2]
    data['point'] = pi.point
    return {'result': True, 'data': data}
Exemplo n.º 33
0
def SaveAndDeleteMail(dynamicId,characterId,setType,requestInfo,mailId,responseMailType):
	'''删除或保存邮件
	@param characterId:int 角色的ID
	@param setType:int 操作类型 0保存1删除单条数据2删除一页数据
	@requestInfo:int 单条时的邮件ID
	@param mailId: (int) list 批量时邮件的ID列表
	'''
	gamer=GamersManager.getGamerByID(characterId)
	if not gamer or not gamer.CheckClient(dynamicId):
		return {'result':False,'message':u"角色不存在"}
	if setType==0:
		result=gamer.mail.saveMail(requestInfo)
	elif setType==1:
		result=gamer.mail.deleteMail(requestInfo)
	else:
		result=gamer.mail.BatchDelete(mailId)
	if result['result']:
		pgcnd=gamer.mail.getPageCnd(responseMailType)
		result['data']={}
		result['data']['maxPage']=pgcnd
		result['data']['setTypeResponse']=setType
	return result