| | |
| | | if playerID not in PyGameData.g_fbHelpBattleRecord:
|
| | | return
|
| | | unNotifyRecordList = PyGameData.g_fbHelpBattleRecord.pop(playerID)
|
| | | SendMapServer_FBHelpBattleRecord(curPlayer, unNotifyRecordList)
|
| | | SendMapServer_FBHelpBattleRecord(curPlayer, unNotifyRecordList, True)
|
| | | return
|
| | |
|
| | | def OnMinuteProcess():
|
| | |
| | | elif cmd == "Call":
|
| | | result = __DoFBHelpBattleCall(curPlayer.GetPlayerID(), curPlayer.GetName(), msgList)
|
| | |
|
| | | # 扫荡召唤
|
| | | elif cmd == "SweepCall":
|
| | | result = __DoFBHelpBattleSweepCall(curPlayer, msgList)
|
| | | |
| | | if result == None:
|
| | | return
|
| | |
|
| | |
| | | GameWorld.Log("刷新助战列表: mapID=%s,funcLineID=%s,helpCountLineID=%s,isClientRefresh=%s,costMoneyList=%s,calledPlayerIDDict=%s"
|
| | | % (mapID, funcLineID, helpCountLineID, isClientRefresh, costMoneyList, calledPlayerIDDict), playerID)
|
| | |
|
| | | onlyFree = False
|
| | | goldCallCount = 0
|
| | | nowFreeRelationCount, nowRelationCount = 0, 0
|
| | | atleastFreeRelationCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 1) # 至少免费社交人数,无社交则忽略
|
| | | atleastRelationCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall2", 2) # 至少社交人数,无社交则忽略(人数包含免费社交人数)
|
| | | GameWorld.DebugLog(" atleastFreeRelationCount=%s,atleastRelationCount=%s" % (atleastFreeRelationCount, atleastRelationCount))
|
| | |
|
| | | #已经召唤的保留
|
| | | for calledPlayerID, callInfo in calledPlayerIDDict.items():
|
| | |
| | | helpBattlePlayerDict[calledPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(helpBattlePlayer, needGoldCall, job, relation)
|
| | | if needGoldCall:
|
| | | goldCallCount += 1
|
| | | if relation:
|
| | | nowRelationCount += 1
|
| | | if not needGoldCall:
|
| | | nowFreeRelationCount += 1
|
| | | # 机器人NPC
|
| | | elif 1 <= calledPlayerID <= MaxRobotID:
|
| | | helpBattlePlayerDict[calledPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(None, False, job)
|
| | |
| | | checkInValidSeconds = checkInValidHours * 3600
|
| | |
|
| | | checkInPlayerIDList = PyGameData.g_fbHelpBattleCheckInPlayerDict.keys()
|
| | | random.shuffle(checkInPlayerIDList) # 刷新纯随机
|
| | | random.shuffle(checkInPlayerIDList)
|
| | | GameWorld.Log(" 登记助战人数=%s" % (len(checkInPlayerIDList)), playerID)
|
| | | |
| | | # 1. 至少社交关系人数还不足的,先处理至少社交关系人数
|
| | | if nowRelationCount < atleastRelationCount:
|
| | | relationIDList = []
|
| | | friendIDList = PlayerFriend.GetFriendStruct(playerID).GetSocialIDList()
|
| | | relationIDList += friendIDList
|
| | | #GameWorld.DebugLog(" 好友ID列表, friendIDList=%s" % friendIDList, playerID)
|
| | | curFamily = curPlayer.GetFamily()
|
| | | familyMemList = []
|
| | | if curFamily:
|
| | | for index in xrange(curFamily.GetCount()):
|
| | | member = curFamily.GetAt(index)
|
| | | memberID = member.GetPlayerID()
|
| | | familyMemList.append(memberID)
|
| | | if memberID != playerID and memberID not in relationIDList:
|
| | | relationIDList.append(memberID)
|
| | | #GameWorld.DebugLog(" 盟友ID列表, familyMemList=%s" % familyMemList, playerID)
|
| | | |
| | | random.shuffle(relationIDList)
|
| | | #GameWorld.DebugLog(" 有社交的ID列表, relationIDList=%s" % relationIDList, playerID)
|
| | | tempRelationHelpPlayerList = []
|
| | | for relationID in relationIDList:
|
| | | if nowRelationCount >= atleastRelationCount:
|
| | | break
|
| | | if relationID not in checkInPlayerIDList:
|
| | | continue
|
| | | helpBattlePlayer = PyGameData.g_fbHelpBattleCheckInPlayerDict[relationID]
|
| | | canHelp, needGoldCall = __CheckCanHelpComm(playerID, helpBattlePlayerDict, relationID, helpBattlePlayer, limitLV, fightPowerMin, fightPowerMax, |
| | | checkInValidSeconds, curTime, helpCountKey, dayFreeHelpCount, onlyFree, goldCallCount, maxGoldHelpPlayerCount)
|
| | | if not canHelp:
|
| | | continue
|
| | | |
| | | # 免费社交人数不足且免费 or 免费社交人数够了且总社交人数还不够 ; 都直接加入助战列表
|
| | | if (nowFreeRelationCount < atleastFreeRelationCount and not needGoldCall) \
|
| | | or (nowFreeRelationCount >= atleastFreeRelationCount and nowRelationCount < atleastRelationCount):
|
| | | goldCallCount, nowRelationCount, nowFreeRelationCount = \
|
| | | __AddHelpPlayer(curPlayer, helpBattlePlayer, helpBattlePlayerDict, needGoldCall, goldCallCount, nowRelationCount, nowFreeRelationCount)
|
| | | else:
|
| | | lackRelationCount = atleastRelationCount - nowRelationCount
|
| | | if len(tempRelationHelpPlayerList) < lackRelationCount:
|
| | | tempRelationHelpPlayerList.append([helpBattlePlayer, needGoldCall])
|
| | | |
| | | lackRelationCount = atleastRelationCount - nowRelationCount
|
| | | if lackRelationCount > 0:
|
| | | for helpBattlePlayer, needGoldCall in tempRelationHelpPlayerList[:lackRelationCount]:
|
| | | goldCallCount, nowRelationCount, nowFreeRelationCount = \
|
| | | __AddHelpPlayer(curPlayer, helpBattlePlayer, helpBattlePlayerDict, needGoldCall, goldCallCount, nowRelationCount, nowFreeRelationCount)
|
| | | |
| | | # 2. 常规添加助战人数 |
| | | for checkInPlayerID in checkInPlayerIDList:
|
| | | if checkInPlayerID == playerID:
|
| | | GameWorld.DebugLog(" 自己不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | continue
|
| | | if checkInPlayerID in helpBattlePlayerDict:
|
| | | GameWorld.DebugLog(" 已经在助战里的不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | continue
|
| | | if len(helpBattlePlayerDict) >= maxHelpPlayerSelectCount:
|
| | | GameWorld.DebugLog(" 超过最大个数了不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | break
|
| | | helpBattlePlayer = PyGameData.g_fbHelpBattleCheckInPlayerDict[checkInPlayerID]
|
| | | checkInPlayerLV = helpBattlePlayer.playerLV
|
| | | checkInPlayerFightPower = helpBattlePlayer.fightPower
|
| | | checkInTime = helpBattlePlayer.checkInTime
|
| | | if checkInPlayerLV < limitLV:
|
| | | GameWorld.DebugLog(" 等级不足, checkInPlayerID=%s,checkInPlayerLV=%s < limitLV=%s" % (checkInPlayerID, checkInPlayerLV, limitLV))
|
| | | canHelp, needGoldCall = __CheckCanHelpComm(playerID, helpBattlePlayerDict, checkInPlayerID, helpBattlePlayer, limitLV, fightPowerMin, fightPowerMax, |
| | | checkInValidSeconds, curTime, helpCountKey, dayFreeHelpCount, onlyFree, goldCallCount, maxGoldHelpPlayerCount)
|
| | | if not canHelp:
|
| | | continue
|
| | | if fightPowerMin and checkInPlayerFightPower < fightPowerMin:
|
| | | GameWorld.DebugLog(" 战力不足, checkInPlayerID=%s,checkInPlayerFightPower=%s < fightPowerMin=%s" % (checkInPlayerID, checkInPlayerFightPower, fightPowerMin))
|
| | | continue
|
| | | if fightPowerMax and checkInPlayerFightPower > fightPowerMax:
|
| | | GameWorld.DebugLog(" 战力超出, checkInPlayerID=%s,checkInPlayerFightPower=%s > fightPowerMax=%s" % (checkInPlayerID, checkInPlayerFightPower, fightPowerMax))
|
| | | continue
|
| | | passTime = curTime - checkInTime
|
| | | if passTime > checkInValidSeconds:
|
| | | GameWorld.DebugLog(" 登记超时, checkInPlayerID=%s,checkInTime=%s,passTime=%s > checkInValidSeconds=%s" % (checkInPlayerID, checkInTime, passTime, checkInValidSeconds))
|
| | | continue
|
| | | needGoldCall = False
|
| | | if dayFreeHelpCount:
|
| | | todayHelpCount = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0)
|
| | | needGoldCall = todayHelpCount >= dayFreeHelpCount
|
| | | if needGoldCall and goldCallCount >= maxGoldHelpPlayerCount:
|
| | | GameWorld.DebugLog(" 超过最大付费召唤人数, checkInPlayerID=%s,goldCallCount=%s > maxGoldHelpPlayerCount=%s" % (checkInPlayerID, goldCallCount, maxGoldHelpPlayerCount))
|
| | | continue
|
| | | goldCallCount += 1
|
| | | relation = __GetHelpBattleRelation(curPlayer, helpBattlePlayer)
|
| | | helpBattlePlayerDict[checkInPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(helpBattlePlayer, needGoldCall, helpBattlePlayer.job, relation)
|
| | |
|
| | | # 不足的机器人NPC补足
|
| | | goldCallCount, nowRelationCount, nowFreeRelationCount = \
|
| | | __AddHelpPlayer(curPlayer, helpBattlePlayer, helpBattlePlayerDict, needGoldCall, goldCallCount, nowRelationCount, nowFreeRelationCount)
|
| | | |
| | | # 3. 不足的机器人NPC补足
|
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 开放的职业
|
| | | lackCount = maxHelpPlayerSelectCount - len(helpBattlePlayerDict)
|
| | | robotID = 0 # 机器人NPC定义ID从1开始
|
| | |
| | |
|
| | | GameWorld.Log(" helpBattlePlayerDict=%s" % (helpBattlePlayerDict), playerID)
|
| | | return [helpBattlePlayerDict]
|
| | |
|
| | | def __CheckCanHelpComm(playerID, helpBattlePlayerDict, checkInPlayerID, helpBattlePlayer, limitLV, fightPowerMin, fightPowerMax, |
| | | checkInValidSeconds, curTime, helpCountKey, dayFreeHelpCount, onlyFree=False, goldCallCount=0, maxGoldHelpPlayerCount=0): |
| | | ## 常规检查是否满足助战条件
|
| | | if checkInPlayerID == playerID:
|
| | | GameWorld.DebugLog(" 自己不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | return False, False
|
| | | if checkInPlayerID in helpBattlePlayerDict:
|
| | | GameWorld.DebugLog(" 已经在助战里的不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | return False, False
|
| | | checkInPlayerLV = helpBattlePlayer.playerLV
|
| | | checkInPlayerFightPower = helpBattlePlayer.fightPower
|
| | | checkInTime = helpBattlePlayer.checkInTime
|
| | | if checkInPlayerLV < limitLV:
|
| | | GameWorld.DebugLog(" 等级不足, checkInPlayerID=%s,checkInPlayerLV=%s < limitLV=%s" % (checkInPlayerID, checkInPlayerLV, limitLV))
|
| | | return False, False
|
| | | if fightPowerMin and checkInPlayerFightPower < fightPowerMin:
|
| | | GameWorld.DebugLog(" 战力不足, checkInPlayerID=%s,checkInPlayerFightPower=%s < fightPowerMin=%s" % (checkInPlayerID, checkInPlayerFightPower, fightPowerMin))
|
| | | return False, False
|
| | | if fightPowerMax and checkInPlayerFightPower > fightPowerMax:
|
| | | GameWorld.DebugLog(" 战力超出, checkInPlayerID=%s,checkInPlayerFightPower=%s > fightPowerMax=%s" % (checkInPlayerID, checkInPlayerFightPower, fightPowerMax))
|
| | | return False, False
|
| | | passTime = curTime - checkInTime
|
| | | if passTime > checkInValidSeconds:
|
| | | GameWorld.DebugLog(" 登记超时, checkInPlayerID=%s,checkInTime=%s,passTime=%s > checkInValidSeconds=%s" % (checkInPlayerID, checkInTime, passTime, checkInValidSeconds))
|
| | | return False, False
|
| | | todayHelpCount = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0)
|
| | | needGoldCall = dayFreeHelpCount and todayHelpCount >= dayFreeHelpCount
|
| | | if needGoldCall:
|
| | | if onlyFree:
|
| | | GameWorld.DebugLog(" 不是免费, checkInPlayerID=%s,todayHelpCount=%s > dayFreeHelpCount=%s" % (checkInPlayerID, todayHelpCount, dayFreeHelpCount))
|
| | | return False, needGoldCall
|
| | | if goldCallCount >= maxGoldHelpPlayerCount:
|
| | | GameWorld.DebugLog(" 超过最大付费召唤人数, checkInPlayerID=%s,goldCallCount=%s > maxGoldHelpPlayerCount=%s" % (checkInPlayerID, goldCallCount, maxGoldHelpPlayerCount))
|
| | | return False, needGoldCall
|
| | | return True, needGoldCall
|
| | |
|
| | | def __AddHelpPlayer(curPlayer, helpBattlePlayer, helpBattlePlayerDict, needGoldCall, goldCallCount, nowRelationCount, nowFreeRelationCount):
|
| | | ## 添加助战玩家到助战列表
|
| | | if needGoldCall:
|
| | | goldCallCount += 1
|
| | | relation = __GetHelpBattleRelation(curPlayer, helpBattlePlayer)
|
| | | if relation:
|
| | | nowRelationCount += 1
|
| | | if not needGoldCall:
|
| | | nowFreeRelationCount += 1
|
| | | helpPlayerID = helpBattlePlayer.playerID
|
| | | helpBattlePlayerDict[helpPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(helpBattlePlayer, needGoldCall, helpBattlePlayer.job, relation)
|
| | | GameWorld.DebugLog(" 助战列表添加玩家: helpPlayerID=%s,needGoldCall=%s,relation=%s,goldCallCount=%s,nowRelationCount=%s,nowFreeRelationCount=%s" |
| | | % (helpPlayerID, needGoldCall, relation, goldCallCount, nowRelationCount, nowFreeRelationCount))
|
| | | return goldCallCount, nowRelationCount, nowFreeRelationCount
|
| | |
|
| | | def __GetHelpBattleRelation(curPlayer, helpBattlePlayer):
|
| | | ## 获取助战社交关系 0-无,1-好友,2-盟友
|
| | |
| | | helpPlayerDict["Relation"] = relation
|
| | | return helpPlayerDict
|
| | |
|
| | | def __DoFBHelpBattleSweepCall(curPlayer, msgList):
|
| | | ''' 扫荡助战列表刷新且直接召唤
|
| | | 随机选择免费的玩家、过滤仙缘币已达上限或溢出的玩家
|
| | | '''
|
| | | mapID, funcLineID = msgList[1:]
|
| | | |
| | | helpBattlePlayerDict = {} # 同步给地图服务器的待选助战玩家列表信息
|
| | | |
| | | fbFuncIpyData = IpyGameDataPY.GetIpyGameData("FBFunc", mapID)
|
| | | fbHelpIpyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, funcLineID)
|
| | | if not fbFuncIpyData or not fbHelpIpyData:
|
| | | return [helpBattlePlayerDict]
|
| | | |
| | | fightPowerMin = fbHelpIpyData.GetFightPowerMin()
|
| | | fightPowerMax = fbHelpIpyData.GetFightPowerMax()
|
| | | limitLV = fbHelpIpyData.GetLVLimit()
|
| | | dayFreeHelpCountInfo = fbHelpIpyData.GetDayFreeHelpCount() # 每日免费助战次数,[每日免费助战次数, 是否所有层通用]
|
| | | dayFreeHelpCount = 0 # 0为无限制次数
|
| | | helpCountLineID = funcLineID # 助战次数所属lineID,当所有层通用时,默认为0
|
| | | if dayFreeHelpCountInfo and len(dayFreeHelpCountInfo) == 2:
|
| | | dayFreeHelpCount, isAllLineCount = dayFreeHelpCountInfo
|
| | | if isAllLineCount:
|
| | | helpCountLineID = 0
|
| | | helpCountKey = (mapID, helpCountLineID)
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | tagPlayerID = playerID
|
| | | tagPlayerName = curPlayer.GetName()
|
| | | GameWorld.Log("扫荡刷新助战列表: mapID=%s,funcLineID=%s,helpCountLineID=%s" % (mapID, funcLineID, helpCountLineID), playerID)
|
| | | |
| | | curTime = int(time.time())
|
| | | maxHelpPlayerCount = IpyGameDataPY.GetFuncCfg("HelpBattleCall", 2) # 最大助战人数
|
| | | checkInValidHours = IpyGameDataPY.GetFuncCfg("HelpBattleCheckIn", 1) # 登记有效时长,小时
|
| | | checkInValidSeconds = checkInValidHours * 3600
|
| | | |
| | | xianyuanCoinUpper = IpyGameDataPY.GetFuncCfg("HelpBattlePoint", 1) # 每日仙缘币上限
|
| | | baseHelpPoint = fbFuncIpyData.GetHelpPoint() # 助战 - 基础仙缘币
|
| | | relationCoinAddDict = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 2, {}) # 社交关系加成 {"社交关系":[过关加成, 助战加成], ...} |
| | | |
| | | isSweep = True
|
| | | onlyFree = True
|
| | | checkInPlayerIDList = PyGameData.g_fbHelpBattleCheckInPlayerDict.keys()
|
| | | random.shuffle(checkInPlayerIDList) # 刷新纯随机
|
| | | GameWorld.Log(" 登记助战人数=%s" % (len(checkInPlayerIDList)), playerID)
|
| | | for checkInPlayerID in checkInPlayerIDList:
|
| | | if len(helpBattlePlayerDict) >= maxHelpPlayerCount:
|
| | | GameWorld.DebugLog(" 超过最大个数了不处理, checkInPlayerID=%s" % checkInPlayerID)
|
| | | break
|
| | | helpBattlePlayer = PyGameData.g_fbHelpBattleCheckInPlayerDict[checkInPlayerID]
|
| | | canHelp, needGoldCall = __CheckCanHelpComm(playerID, helpBattlePlayerDict, checkInPlayerID, helpBattlePlayer, limitLV, fightPowerMin, fightPowerMax, |
| | | checkInValidSeconds, curTime, helpCountKey, dayFreeHelpCount, onlyFree)
|
| | | if not canHelp:
|
| | | continue
|
| | | |
| | | relation = __GetHelpBattleRelation(curPlayer, helpBattlePlayer)
|
| | | if not __DoCallHelpPlayer(tagPlayerID, tagPlayerName, helpBattlePlayer, relation, mapID, funcLineID, helpCountKey, isSweep, |
| | | curTime, xianyuanCoinUpper, relationCoinAddDict, baseHelpPoint):
|
| | | continue
|
| | | |
| | | helpBattlePlayerDict[checkInPlayerID] = __GetNotifyMapServerHelpPlayerInfoDict(helpBattlePlayer, needGoldCall, helpBattlePlayer.job, relation)
|
| | | |
| | | # 不足的机器人NPC补足
|
| | | openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1) # 开放的职业
|
| | | lackCount = maxHelpPlayerCount - len(helpBattlePlayerDict)
|
| | | robotID = 0 # 机器人NPC定义ID从1开始
|
| | | while lackCount > 0 and robotID < MaxRobotID:
|
| | | robotID += 1
|
| | | if robotID in helpBattlePlayerDict:
|
| | | continue
|
| | | lackCount -= 1
|
| | | randJob = random.choice(openJobList)
|
| | | helpBattlePlayerDict[robotID] = __GetNotifyMapServerHelpPlayerInfoDict(None, False, randJob)
|
| | | |
| | | GameWorld.Log(" helpBattlePlayerDict=%s" % (helpBattlePlayerDict), playerID)
|
| | | return [helpBattlePlayerDict]
|
| | |
|
| | | def __DoCallHelpPlayer(callPlayerID, callPlayerName, helpBattlePlayer, relation, mapID, funcLineID, helpCountKey, isSweep, curTime, |
| | | xianyuanCoinUpper, relationCoinAddDict, baseHelpPoint):
|
| | | |
| | | calledPlayerID = helpBattlePlayer.playerID
|
| | | addCoinRate = 10000 # 基础倍率
|
| | | playerXianyuanCoinUpper = xianyuanCoinUpper
|
| | | relationAddList = relationCoinAddDict.get(str(relation), [])
|
| | | relationAdd = relationAddList[1] if len(relationAddList) == 2 else 0
|
| | | |
| | | todayXianyuanCoin = helpBattlePlayer.todayXianyuanCoin # 今日已获得仙缘币
|
| | | vipLV = helpBattlePlayer.vipLV
|
| | | if vipLV:
|
| | | xianyuanCoinUpperAdd = PlayerControl.GetPrivilegeValue(vipLV, ChConfig.VIPPrivilege_XianyuanCoinUpperAdd)
|
| | | xianyuanCoinAddPer = PlayerControl.GetPrivilegeValue(vipLV, ChConfig.VIPPrivilege_XianyuanCoinAddPer)
|
| | | |
| | | playerXianyuanCoinUpper += xianyuanCoinUpperAdd
|
| | | addCoinRate += xianyuanCoinAddPer
|
| | | |
| | | # 仙缘币公式=(通关仙缘币或助战仙缘币+社交关系加成)*VIP倍数
|
| | | coinAdd = int((baseHelpPoint + relationAdd) * addCoinRate / 10000.0)
|
| | | canAddMax = max(playerXianyuanCoinUpper - todayXianyuanCoin, 0)
|
| | | |
| | | # 扫荡不可溢出
|
| | | if isSweep and coinAdd > canAddMax:
|
| | | GameWorld.DebugLog(" 今日仙缘币已达上限, calledPlayerID=%s,coinAdd=%s > canAddMax=%s" % (calledPlayerID, coinAdd, canAddMax))
|
| | | return
|
| | | coinAddReal = min(coinAdd, canAddMax) # 实际加仙缘币
|
| | | |
| | | todayMapHelpCount = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0) + 1
|
| | | helpBattlePlayer.todayHelpCountDict[helpCountKey] = todayMapHelpCount
|
| | | GameWorld.DebugLog(" 助战增加仙缘币: todayXianyuanCoin=%s,coinUpper=%s,canAddMax=%s,coinAdd=%s,coinAddReal=%s,todayMapHelpCount=%s" |
| | | % (todayXianyuanCoin, playerXianyuanCoinUpper, canAddMax, coinAdd, coinAddReal, todayMapHelpCount), calledPlayerID)
|
| | | |
| | | # GameServer 直接先加
|
| | | helpBattlePlayer.todayXianyuanCoin += coinAddReal
|
| | | |
| | | helpRecord = FBHelpBattleRecord()
|
| | | helpRecord.callPlayerID = callPlayerID # 召唤他的玩家ID
|
| | | helpRecord.callPlayerName = callPlayerName
|
| | | helpRecord.mapID = mapID
|
| | | helpRecord.funcLineID = funcLineID
|
| | | helpRecord.xianyuanCoinAdd = coinAddReal
|
| | | helpRecord.relation = relation
|
| | | helpRecord.vipLV = vipLV
|
| | | helpRecord.recordTime = curTime
|
| | | |
| | | calledPlayer = GameWorld.GetPlayerManager().FindPlayerByID(calledPlayerID)
|
| | | # 非脱机在线直接通知地图
|
| | | if calledPlayer and not PlayerControl.GetIsTJG(calledPlayer):
|
| | | SendMapServer_FBHelpBattleRecord(calledPlayer, [helpRecord])
|
| | | else:
|
| | | unNotifyRecordList = PyGameData.g_fbHelpBattleRecord.get(calledPlayerID, [])
|
| | | unNotifyRecordList.append(helpRecord)
|
| | | PyGameData.g_fbHelpBattleRecord[calledPlayerID] = unNotifyRecordList
|
| | | return True
|
| | |
|
| | | def __DoFBHelpBattleCall(callPlayerID, callPlayerName, msgList):
|
| | | ''' 助战召唤,不管最终过关与否,被召唤方都直接算助战成功,这里处理被召唤的,主动方在地图直接处理
|
| | | '''
|
| | |
| | | helpCountKey = (mapID, helpCountLineID)
|
| | |
|
| | | curTime = int(time.time())
|
| | | tagPlayerID = callPlayerID
|
| | | tagPlayerName = callPlayerName
|
| | | playerMgr = GameWorld.GetPlayerManager()
|
| | | xianyuanCoinUpper = IpyGameDataPY.GetFuncCfg("HelpBattlePoint", 1) # 每日仙缘币上限
|
| | | baseHelpPoint = fbFuncIpyData.GetHelpPoint() # 助战 - 基础仙缘币
|
| | | relationCoinAddDict = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 2, {}) # 社交关系加成 {"社交关系":[过关加成, 助战加成], ...}
|
| | | GameWorld.DebugLog("召唤助战: mapID=%s, funcLineID=%s, helpCountKey=%s, calledPlayerDict=%s" % (mapID, funcLineID, helpCountKey, calledPlayerDict), tagPlayerID)
|
| | | |
| | | GameWorld.DebugLog("召唤助战: mapID=%s, funcLineID=%s, helpCountKey=%s, calledPlayerDict=%s" % (mapID, funcLineID, helpCountKey, calledPlayerDict), callPlayerID)
|
| | | isSweep = False
|
| | | for calledPlayerID, relation in calledPlayerDict.items():
|
| | | if calledPlayerID not in PyGameData.g_fbHelpBattleCheckInPlayerDict:
|
| | | continue
|
| | | addCoinRate = 10000 # 基础倍率
|
| | | playerXianyuanCoinUpper = xianyuanCoinUpper
|
| | | relationAddList = relationCoinAddDict.get(str(relation), [])
|
| | | relationAdd = relationAddList[1] if len(relationAddList) == 2 else 0
|
| | | |
| | | helpBattlePlayer = PyGameData.g_fbHelpBattleCheckInPlayerDict[calledPlayerID]
|
| | | todayMapHelpCount = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0) + 1
|
| | | helpBattlePlayer.todayHelpCountDict[helpCountKey] = todayMapHelpCount
|
| | | todayXianyuanCoin = helpBattlePlayer.todayXianyuanCoin # 今日已获得仙缘币
|
| | | vipLV = helpBattlePlayer.vipLV
|
| | | if vipLV:
|
| | | xianyuanCoinUpperAdd = PlayerControl.GetPrivilegeValue(vipLV, ChConfig.VIPPrivilege_XianyuanCoinUpperAdd)
|
| | | xianyuanCoinAddPer = PlayerControl.GetPrivilegeValue(vipLV, ChConfig.VIPPrivilege_XianyuanCoinAddPer)
|
| | | |
| | | playerXianyuanCoinUpper += xianyuanCoinUpperAdd
|
| | | addCoinRate += xianyuanCoinAddPer
|
| | | |
| | | # 仙缘币公式=(通关仙缘币或助战仙缘币+社交关系加成)*VIP倍数
|
| | | coinAdd = int((baseHelpPoint + relationAdd) * addCoinRate / 10000.0)
|
| | | canAddMax = max(playerXianyuanCoinUpper - todayXianyuanCoin, 0)
|
| | | coinAddReal = min(coinAdd, canAddMax) # 实际加仙缘币
|
| | | GameWorld.DebugLog(" 助战增加仙缘币: todayXianyuanCoin=%s,coinUpper=%s,canAddMax=%s,coinAdd=%s,coinAddReal=%s, todayMapHelpCount=%s" |
| | | % (todayXianyuanCoin, playerXianyuanCoinUpper, canAddMax, coinAdd, coinAddReal, todayMapHelpCount), calledPlayerID)
|
| | | |
| | | # GameServer 直接先加
|
| | | helpBattlePlayer.todayXianyuanCoin += coinAddReal
|
| | | |
| | | helpRecord = FBHelpBattleRecord()
|
| | | helpRecord.callPlayerID = tagPlayerID # 召唤他的玩家ID
|
| | | helpRecord.callPlayerName = tagPlayerName
|
| | | helpRecord.mapID = mapID
|
| | | helpRecord.funcLineID = funcLineID
|
| | | helpRecord.xianyuanCoinAdd = coinAddReal
|
| | | helpRecord.relation = relation
|
| | | helpRecord.vipLV = vipLV
|
| | | helpRecord.recordTime = curTime
|
| | | |
| | | calledPlayer = playerMgr.FindPlayerByID(calledPlayerID)
|
| | | # 非脱机在线直接通知地图
|
| | | if calledPlayer and not PlayerControl.GetIsTJG(calledPlayer):
|
| | | SendMapServer_FBHelpBattleRecord(calledPlayer, [helpRecord])
|
| | | else:
|
| | | unNotifyRecordList = PyGameData.g_fbHelpBattleRecord.get(calledPlayerID, [])
|
| | | unNotifyRecordList.append(helpRecord)
|
| | | PyGameData.g_fbHelpBattleRecord[calledPlayerID] = unNotifyRecordList
|
| | | |
| | | __DoCallHelpPlayer(callPlayerID, callPlayerName, helpBattlePlayer, relation, mapID, funcLineID, helpCountKey, isSweep, |
| | | curTime, xianyuanCoinUpper, relationCoinAddDict, baseHelpPoint)
|
| | | return
|
| | |
|
| | | def SendMapServer_FBHelpBattleRecord(curPlayer, syncHelpRecordList):
|
| | | def SendMapServer_FBHelpBattleRecord(curPlayer, syncHelpRecordList, isLogin=False):
|
| | | if not syncHelpRecordList:
|
| | | return
|
| | |
|
| | |
| | | for record in syncHelpRecordList:
|
| | | helpRecordList.append([record.callPlayerID, record.callPlayerName, record.mapID, record.funcLineID,
|
| | | record.xianyuanCoinAdd, record.relation, record.vipLV, record.recordTime])
|
| | | addXianyuanCoinMsg = str(["HelpRecord", helpRecordList])
|
| | | addXianyuanCoinMsg = str(["HelpRecord", helpRecordList, isLogin])
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, 'FBHelpBattle', addXianyuanCoinMsg, len(addXianyuanCoinMsg))
|
| | | GameWorld.DebugLog(" MapServer_QueryPlayerResult %s" % addXianyuanCoinMsg, curPlayer.GetPlayerID())
|
| | | return
|