| | |
| | |
|
| | | onlyFree = False
|
| | | goldCallCount = 0
|
| | | nowFreeRelationCount, nowRelationCount = 0, 0
|
| | | nowFreeRelationCount, nowRelationCount, nowRobotCount = 0, 0, 0
|
| | | atleastFreeRelationCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 1) # 至少免费社交人数,无社交则忽略
|
| | | atleastRelationCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 2) # 至少社交人数,无社交则忽略(人数包含免费社交人数)
|
| | | atmostRobotCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 3) # 助战列表机器人至多数量
|
| | | allowNoRelation = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 4) # 助战列表是否出现非社交关系玩家
|
| | | GameWorld.DebugLog(" atleastFreeRelationCount=%s,atleastRelationCount=%s" % (atleastFreeRelationCount, atleastRelationCount))
|
| | |
|
| | | #已经召唤的保留
|
| | |
| | | nowFreeRelationCount += 1
|
| | | # 机器人NPC
|
| | | elif 1 <= calledPlayerID <= MaxRobotID:
|
| | | nowRobotCount += 1
|
| | | helpBattlePlayerDict[calledPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(None, False, job)
|
| | | else:
|
| | | GameWorld.ErrLog("已召唤的助战玩家找不到镜像缓存!理论上不存在该情况,镜像缓存释放会比登记有效时长多半小时!")
|
| | |
| | | checkInPlayerIDList = PyGameData.g_fbHelpBattleCheckInPlayerDict.keys()
|
| | | random.shuffle(checkInPlayerIDList)
|
| | | GameWorld.Log(" 登记助战人数=%s" % (len(checkInPlayerIDList)), playerID)
|
| | | |
| | | if not allowNoRelation:
|
| | | atleastRelationCount = maxHelpPlayerSelectCount
|
| | | GameWorld.DebugLog("不允许出现非社交人数,默认设置至少社交人数为最大可选择人数! %s" % atleastRelationCount)
|
| | |
|
| | | # 1. 至少社交关系人数还不足的,先处理至少社交关系人数
|
| | | if nowRelationCount < atleastRelationCount:
|
| | |
| | | __AddHelpPlayer(curPlayer, helpBattlePlayer, helpBattlePlayerDict, needGoldCall, goldCallCount, nowRelationCount, nowFreeRelationCount)
|
| | |
|
| | | # 2. 常规添加助战人数
|
| | | if allowNoRelation:
|
| | | for checkInPlayerID in checkInPlayerIDList:
|
| | | if len(helpBattlePlayerDict) >= maxHelpPlayerSelectCount:
|
| | | GameWorld.DebugLog(" 超过最大个数了不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | |
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 开放的职业
|
| | | lackCount = maxHelpPlayerSelectCount - len(helpBattlePlayerDict)
|
| | | robotID = 0 # 机器人NPC定义ID从1开始
|
| | | while lackCount > 0 and robotID < MaxRobotID:
|
| | | while lackCount > 0 and robotID < MaxRobotID and nowRobotCount < atmostRobotCount:
|
| | | robotID += 1
|
| | | if robotID in helpBattlePlayerDict:
|
| | | continue
|
| | | lackCount -= 1
|
| | | nowRobotCount += 1
|
| | | randJob = random.choice(openJobList)
|
| | | helpBattlePlayerDict[robotID] = __GetNotifyMapServerHelpPlayerInfoDict(None, False, randJob)
|
| | |
|
| | |
| | | checkInValidHours = IpyGameDataPY.GetFuncCfg("HelpBattleCheckIn", 1) # 登记有效时长,小时
|
| | | checkInValidSeconds = checkInValidHours * 3600
|
| | |
|
| | | atmostRobotCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 3) # 助战列表机器人至多数量
|
| | | allowNoRelation = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 4) # 助战列表是否出现非社交关系玩家
|
| | | |
| | | onlyFree = True
|
| | | checkInPlayerIDList = PyGameData.g_fbHelpBattleCheckInPlayerDict.keys()
|
| | | random.shuffle(checkInPlayerIDList) # 刷新纯随机
|
| | |
| | | checkInValidSeconds, curTime, helpCountKey, dayFreeHelpCount, onlyFree)
|
| | | if not canHelp:
|
| | | continue
|
| | | helpBattlePlayer.todayHelpCountDict[helpCountKey] = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0) + 1
|
| | | relation = __GetHelpBattleRelation(curPlayer, helpBattlePlayer)
|
| | | if not allowNoRelation and not relation:
|
| | | continue
|
| | | helpBattlePlayer.todayHelpCountDict[helpCountKey] = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0) + 1
|
| | | helpBattlePlayerDict[checkInPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(helpBattlePlayer, needGoldCall, helpBattlePlayer.job, relation)
|
| | |
|
| | | nowRobotCount = 0
|
| | | # 不足的机器人NPC补足
|
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 开放的职业
|
| | | lackCount = maxHelpPlayerCount - len(helpBattlePlayerDict)
|
| | | robotID = 0 # 机器人NPC定义ID从1开始
|
| | | while lackCount > 0 and robotID < MaxRobotID:
|
| | | while lackCount > 0 and robotID < MaxRobotID and nowRobotCount < atmostRobotCount:
|
| | | robotID += 1
|
| | | if robotID in helpBattlePlayerDict:
|
| | | continue
|
| | | lackCount -= 1
|
| | | nowRobotCount += 1
|
| | | randJob = random.choice(openJobList)
|
| | | helpBattlePlayerDict[robotID] = __GetNotifyMapServerHelpPlayerInfoDict(None, False, randJob)
|
| | |
|