4879 【后端】【1.3.100】宗门试练新增扫荡
| | |
| | | CallPlayerID = 0 #(DWORD CallPlayerID)// 助战的玩家ID,有值时代表真实助战,没有值时为自己打的
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | CallPlayerName = "" #(String CallPlayerName)// 助战的玩家名,size = NameLen
|
| | | IsSweep = 0 #(BYTE IsSweep)// 是否扫荡
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.CallPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CallPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | self.IsSweep,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.CallPlayerID = 0
|
| | | self.NameLen = 0
|
| | | self.CallPlayerName = ""
|
| | | self.IsSweep = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.CallPlayerName)
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteDWORD(data, self.CallPlayerID)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.CallPlayerName)
|
| | | data = CommFunc.WriteBYTE(data, self.IsSweep)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | Reason:%d,
|
| | | CallPlayerID:%d,
|
| | | NameLen:%d,
|
| | | CallPlayerName:%s
|
| | | CallPlayerName:%s,
|
| | | IsSweep:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | |
| | | self.Reason,
|
| | | self.CallPlayerID,
|
| | | self.NameLen,
|
| | | self.CallPlayerName
|
| | | self.CallPlayerName,
|
| | | self.IsSweep
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | elif cmd == "Call":
|
| | | result = __DoFBHelpBattleCall(curPlayer.GetPlayerID(), curPlayer.GetName(), msgList)
|
| | |
|
| | | # 扫荡召唤
|
| | | elif cmd == "SweepCall":
|
| | | result = __DoFBHelpBattleSweepCall(curPlayer, msgList)
|
| | | |
| | | if result == None:
|
| | | return
|
| | |
|
| | |
| | | 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
|
| | | checkInPlayerIDList = PyGameData.g_fbHelpBattleCheckInPlayerDict.keys()
|
| | | random.shuffle(checkInPlayerIDList) # 刷新纯随机
|
| | | GameWorld.Log(" 登记助战人数=%s" % (len(checkInPlayerIDList)), playerID)
|
| | | 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) >= maxHelpPlayerCount:
|
| | | 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))
|
| | | 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
|
| | | todayHelpCount = helpBattlePlayer.todayHelpCountDict.get(helpCountKey, 0)
|
| | | if dayFreeHelpCount:
|
| | | needGoldCall = todayHelpCount >= dayFreeHelpCount
|
| | | if needGoldCall:
|
| | | GameWorld.DebugLog(" 不是免费, checkInPlayerID=%s,todayHelpCount=%s > dayFreeHelpCount=%s" % (checkInPlayerID, todayHelpCount, dayFreeHelpCount))
|
| | | 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, isLogin=False):
|
| | |
| | | CallPlayerID = 0 #(DWORD CallPlayerID)// 助战的玩家ID,有值时代表真实助战,没有值时为自己打的
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | CallPlayerName = "" #(String CallPlayerName)// 助战的玩家名,size = NameLen
|
| | | IsSweep = 0 #(BYTE IsSweep)// 是否扫荡
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.CallPlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CallPlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | self.IsSweep,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.CallPlayerID = 0
|
| | | self.NameLen = 0
|
| | | self.CallPlayerName = ""
|
| | | self.IsSweep = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.CallPlayerName)
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteDWORD(data, self.CallPlayerID)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.CallPlayerName)
|
| | | data = CommFunc.WriteBYTE(data, self.IsSweep)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | Reason:%d,
|
| | | CallPlayerID:%d,
|
| | | NameLen:%d,
|
| | | CallPlayerName:%s
|
| | | CallPlayerName:%s,
|
| | | IsSweep:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | |
| | | self.Reason,
|
| | | self.CallPlayerID,
|
| | | self.NameLen,
|
| | | self.CallPlayerName
|
| | | self.CallPlayerName,
|
| | | self.IsSweep
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | return callFunc(curPlayer, mapID, lineID, cnt, isFinish, dataEx)
|
| | |
|
| | | ## 副本助战扫荡结果
|
| | | def OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason):
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnPlayerFBHelpBattleSweepResult"))
|
| | | |
| | | if callFunc == None:
|
| | | return False
|
| | |
|
| | | return callFunc(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason)
|
| | |
|
| | | ## 开始公共CD副本扫荡
|
| | | def OnStartPubCDFBSweep(curPlayer, mapID, lineID, cnt, dataEx):
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(mapID)
|
| | |
| | | Over_enterLV = 'enterLV' #进入时等级
|
| | | Over_leaderID = 'leaderID' #渡劫玩家ID
|
| | | Over_xianyuanCoin = 'xianyuanCoin' #获得仙缘币信息 [获得仙缘币数, 没有获得的原因] 原因: 1-达到助战次数上限,2-达到每日获得仙缘币上限
|
| | | Over_helpPlayer = 'helpPlayer' #助战玩家信息 {"玩家ID":{玩家信息key:value, ...}, ...}
|
| | |
|
| | | #副本行为
|
| | | (
|
| | |
| | | __OnHelpBattleCheckInResult(curPlayer, msgList, tick)
|
| | |
|
| | | # 刷新
|
| | | if cmd == "Refresh":
|
| | | elif cmd == "Refresh":
|
| | | __OnHelpBattleRefreshResult(curPlayer, msgList, tick)
|
| | |
|
| | | # 助战记录
|
| | | if cmd == "HelpRecord":
|
| | | elif cmd == "HelpRecord":
|
| | | __OnHelpBattleRecord(curPlayer, msgList, tick)
|
| | |
|
| | | # 扫荡召唤
|
| | | elif cmd == "SweepCall":
|
| | | __OnHelpBattleSweepCallResult(curPlayer, msgList, tick)
|
| | | |
| | | return
|
| | |
|
| | | #// B1 05 助战登记 #tagCMHelpBattleCheckIn
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, helpPlayerListPack)
|
| | | return
|
| | |
|
| | | def SendGameServer_SweepCallHelpBattlePlayer(curPlayer, mapID, funcLineID):
|
| | | ## 发送GameServer请求扫荡助战玩家
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, funcLineID)
|
| | | if not ipyData:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgInfo = str(["SweepCall", mapID, funcLineID])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "FBHelpBattle", msgInfo, len(msgInfo))
|
| | | GameWorld.Log("SendGameServer_SweepCallHelpBattlePlayer %s" % (msgInfo), playerID)
|
| | | return
|
| | |
|
| | | def __OnHelpBattleSweepCallResult(curPlayer, msgList, tick):
|
| | | ## 助战扫荡结果处理
|
| | | cmd, mapID, funcLineID, helpBattlePlayerDict = msgList
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("__OnHelpBattleSweepCallResult %s,mapID=%s,funcLineID=%s,helpBattlePlayerDict=%s" |
| | | % (cmd, mapID, funcLineID, helpBattlePlayerDict), playerID)
|
| | | |
| | | fbFuncIpyData = IpyGameDataPY.GetIpyGameData("FBFunc", mapID)
|
| | | if not fbFuncIpyData:
|
| | | return
|
| | | |
| | | reason = 0
|
| | | addCoinRate = 10000 # 基础倍率
|
| | | baseFBPoint = fbFuncIpyData.GetFBPoint() # 过关 - 基础仙缘币
|
| | | |
| | | xianyuanCoinUpper = IpyGameDataPY.GetFuncCfg("HelpBattlePoint", 1) # 每日仙缘币上限
|
| | | relationCoinAddDict = IpyGameDataPY.GetFuncEvalCfg("HelpBattlePoint", 2, {}) # 社交关系加成 {"社交关系":[过关加成, 助战加成], ...} |
| | | todayXianyuanCoin = PlayerControl.GetTodayXianyuanCoin(curPlayer) # 今日已获得仙缘币
|
| | | playerXianyuanCoinUpper = xianyuanCoinUpper
|
| | | if curPlayer.GetVIPLv():
|
| | | playerXianyuanCoinUpper += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_XianyuanCoinUpperAdd)
|
| | | addCoinRate += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_XianyuanCoinAddPer)
|
| | | |
| | | relation, relationAdd = 0, 0
|
| | | for helpPlayerInfoDict in helpBattlePlayerDict.values():
|
| | | relation = helpPlayerInfoDict.get("Relation", 0)
|
| | | if not relation:
|
| | | continue
|
| | | relationAddList = relationCoinAddDict.get(str(relation), [])
|
| | | relationAdd += relationAddList[0] if len(relationAddList) == 2 else 0
|
| | | |
| | | coinAdd = 0
|
| | | if baseFBPoint:
|
| | | coinAdd = int((baseFBPoint + relationAdd) * addCoinRate / 10000.0)
|
| | | canAddMax = max(playerXianyuanCoinUpper - todayXianyuanCoin, 0)
|
| | | coinAddReal = min(coinAdd, canAddMax) # 实际加仙缘币
|
| | | if canAddMax == 0 and not reason:
|
| | | reason = 2
|
| | | |
| | | GameWorld.DebugLog("扫荡副本增加仙缘币: baseFBPoint=%s,relationAdd=%s,addCoinRate=%s,coinAdd=%s,canAddMax=%s,coinAddReal=%s" |
| | | % (baseFBPoint, relationAdd, addCoinRate, coinAdd, canAddMax, coinAddReal), playerID)
|
| | | if coinAddReal:
|
| | | addDataDict = {"MapID":mapID, "FuncLineID":funcLineID, "IsSweep":1}
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, coinAddReal, addDataDict=addDataDict)
|
| | | PlayerControl.AddTodayXianyuanCoin(curPlayer, coinAddReal)
|
| | | |
| | | #扫荡结果给奖励等
|
| | | FBLogic.OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, funcLineID, helpBattlePlayerDict, coinAddReal, reason)
|
| | | |
| | | # 通知自己获得仙缘币
|
| | | msgPack = ChPyNetSendPack.tagMCAddXianyuanCoinMsg()
|
| | | msgPack.MapID = mapID
|
| | | msgPack.FuncLineID = funcLineID
|
| | | msgPack.Relation = relation
|
| | | msgPack.RelationCoinAdd = relationAdd
|
| | | msgPack.XianyuanCoinAdd = coinAddReal
|
| | | msgPack.Reason = reason
|
| | | #msgPack.CallPlayerID = relationPlayerID
|
| | | #msgPack.CallPlayerName = relationPlayerName
|
| | | msgPack.NameLen = len(msgPack.CallPlayerName)
|
| | | msgPack.IsSweep = 1
|
| | | NetPackCommon.SendFakePack(curPlayer, msgPack)
|
| | | return
|
| | |
|
| | | def __OnHelpBattleRecord(curPlayer, msgList, tick):
|
| | | ## 助战记录同步
|
| | | cmd, helpRecordList, isLogin = msgList
|
| | |
| | | ##---获得副本刷怪配置---
|
| | | # @param None
|
| | | # @return 配置信息
|
| | | def __GetZMSLnpcCfg(lineID):
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | def __GetZMSLnpcCfg(lineID, mapID=0):
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | return FBCommon.GetFBLineRefreshNPC(mapID, lineID)
|
| | |
|
| | | def GetMTFBLineStepTime(lineID=-1):
|
| | |
| | | if star == 5:
|
| | | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1)
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star))
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [playerCount, star, lineID+1])
|
| | | #PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [playerCount, star, lineID+1])
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "passzmsl")
|
| | | # 如果在副本中过天,则只给物品奖励,不变更过关信息
|
| | | if not isInFBOnDay:
|
| | |
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | if mapID != ChConfig.Def_FBMapID_MunekadoTrial:
|
| | | return
|
| | | # 暂写死,前两层不能扫
|
| | | if lineID < 2: |
| | | GameWorld.DebugLog("前两层不能扫荡!")
|
| | | return
|
| | | historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID-1, False, [mapID])
|
| | | if historyStar < 5:
|
| | | GameWorld.DebugLog("没有S级不能扫荡!")
|
| | | return
|
| | | |
| | | return True
|
| | |
|
| | | ## 助战扫荡结果
|
| | | def OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason):
|
| | | #扣门票要在公共逻辑中完成
|
| | | |
| | | refreshNPCList = __GetZMSLnpcCfg(lineID, mapID)[0]
|
| | | if not refreshNPCList:
|
| | | return
|
| | | lastNPCList = refreshNPCList[-1]
|
| | | if not lastNPCList:
|
| | | return
|
| | | killNPCID = lastNPCList[0][0] # 默认最后一波的NPCID为通关boss奖励ID
|
| | | GameWorld.DebugLog("扫荡宗门试炼: killNPCID=%s,addXianyuanCoin=%s,reason=%s,helpBattlePlayerDict=%s" |
| | | % (killNPCID, addXianyuanCoin, reason, helpBattlePlayerDict))
|
| | | |
| | | star = 5
|
| | | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1)
|
| | | |
| | | EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star))
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "passzmsl")
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrialEx, 1)
|
| | | |
| | | jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, {killNPCID:1}, curGrade=star)
|
| | | |
| | | # 通知结果
|
| | | overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1}
|
| | | overDict[FBCommon.Over_helpPlayer] = helpBattlePlayerDict
|
| | | overDict[FBCommon.Over_xianyuanCoin] = [addXianyuanCoin, reason]
|
| | | overDict[FBCommon.Over_itemInfo] = jsonItemList
|
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return True
|
| | |
|
| | | ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
|
| | | # @param attacker 攻击方
|
| | | # @param defender 防守方
|
| | |
| | | return attrDict
|
| | |
|
| | | def GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, exp_rate=None, mailTypeKey=None, isMail=False,
|
| | | extraItemList=[], prizeMultiple=1, dropItemMapInfo=[]):
|
| | | extraItemList=[], prizeMultiple=1, dropItemMapInfo=[], curGrade=0):
|
| | | '''给玩家击杀NPC掉落奖励
|
| | | @param mapID: 击杀的NPC所在地图ID,注意次地图并不一定是玩家当前地图
|
| | | @param npcCountDict: 执行单次时所击杀的npc数量字典 {npcID:count, ...}
|
| | |
| | | # 掉落有概率因素,需多次执行
|
| | | for dCount in xrange(1, totalCount + 1):
|
| | | isKillCountDropEquipEx = dCount == 1 # 同一只NPC一次处理中多次击杀的情况,只算一次附加装备处理
|
| | | dropInfo = GetNPCDropInfo(curPlayer, mapID, npcID, isKillCountDropEquipEx=isKillCountDropEquipEx)
|
| | | dropInfo = GetNPCDropInfo(curPlayer, mapID, npcID, isKillCountDropEquipEx=isKillCountDropEquipEx, curGrade=curGrade)
|
| | | if not dropInfo:
|
| | | continue
|
| | | dropIDList, dropIDBindDict, dropMoneyCnt, moneyValue = dropInfo
|
| | |
| | | % (npcID, killCount, dropIDCountDict, dropIDBindDict, dropMoney), playerID)
|
| | | return dropIDCountDict, dropIDBindDict, dropMoney
|
| | |
|
| | | def GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList=[], ipyDrop=None, isSingle=True, isKillCountDropEquipEx=True):
|
| | | def GetNPCDropInfo(dropPlayer, mapID, npcID, ownerPlayerList=[], ipyDrop=None, isSingle=True, isKillCountDropEquipEx=True, curGrade=0):
|
| | | '''获取NPC掉落信息, 击杀及扫荡通用,调用该函数获得掉落信息,然后再看掉落地板上还是直接放入背包
|
| | | @param dropPlayer: 用于判断调用相关用的玩家示例,该玩家并不一定是击杀者,只是按一定规则设定的掉落判断依据的玩家
|
| | | 如队伍,取等级最大的玩家,该玩家并不一定是击杀者
|
| | |
| | | indepRateDoCnt = ipyDrop.GetIndepRateDoCnt()
|
| | | if indepRateDoCnt:
|
| | | indepRateDoCnt = __GetNPCDropDoCountChange(indepRateDoCnt, doCountRate + equipDropDoCountPlus, doCountAdd)
|
| | | dropEquipInfoList += __GetNPCIndepRateEquipDrop(ipyDrop, indepRateDoCnt, equipDropRatePlus)
|
| | | dropEquipInfoList += __GetNPCIndepRateEquipDrop(ipyDrop, indepRateDoCnt, equipDropRatePlus, curGrade)
|
| | |
|
| | | #GameWorld.DebugLog("阶,颜色,部位集合key,dropEquipInfoList=%s" % (dropEquipInfoList))
|
| | | placeDict = IpyGameDataPY.GetFuncCfg("EquipDropPartSets", 1)
|
| | |
| | | fbGradeColorStarRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 2) # 评级影响品质星级概率 {npcID:{(颜色,星级):[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorStarRateDict:
|
| | | gradeColorStarRateDict = fbGradeColorStarRateDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | |
|
| | | colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | colorMaxDropCntDict = ipyDrop.GetIndepRateMaxDropCount() # {颜色:上限数量,...}
|
| | |
| | | fbGradePriItemIDDropDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 3)
|
| | | if npcID in fbGradePriItemIDDropDict:
|
| | | gradePriItemIDDropDict = fbGradePriItemIDDropDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | priDropInfoList = gradePriItemIDDropDict.get(curGrade, [])
|
| | | priDropIDList = []
|
| | | for priItemID, priItemCount in priDropInfoList:
|
| | |
| | | #GameWorld.DebugLog("饼图装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
|
| | | return dropEquipInfoList
|
| | |
|
| | | def __GetNPCIndepRateEquipDrop(ipyDrop, doCnt, equipDropPlus):
|
| | | def __GetNPCIndepRateEquipDrop(ipyDrop, doCnt, equipDropPlus, curGrade=0):
|
| | | ## 获取NPC独立掉率装备掉落信息
|
| | | npcID = ipyDrop.GetNPCID()
|
| | | indepRateDict = ipyDrop.GetIndepRateDrop() # {(阶,颜色,部位集合key):概率,...}
|
| | |
| | | fbGradeColorRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 1) #{npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
|
| | | if npcID in fbGradeColorRateDict:
|
| | | gradeColorRateDict = fbGradeColorRateDict[npcID]
|
| | | curGrade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | |
|
| | | #colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
|
| | | dropEquipInfoList = []
|
| | |
| | | import IpyGameDataPY
|
| | | import ShareDefine
|
| | | import GameFuncComm
|
| | | import FBHelpBattle
|
| | |
|
| | | import time
|
| | | import math
|
| | |
| | | #增加副本进入次数
|
| | | if fbIpyData and fbIpyData.GetDayTimes():
|
| | | FBCommon.AddEnterFBCount(curPlayer, mapID, cnt)
|
| | | |
| | | |
| | | helpIpyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, lineID)
|
| | | if helpIpyData:
|
| | | FBHelpBattle.SendGameServer_SweepCallHelpBattlePlayer(curPlayer, mapID, lineID)
|
| | | return
|
| | | |
| | | #扫荡结果给奖励等
|
| | | FBLogic.OnPlayerFBSweepResult(curPlayer, mapID, lineID, cnt, isFinish, dataEx)
|
| | | return
|