From bed6ef2cbf2bc9c209f2f62d53b16654f237d7c3 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 23 五月 2022 17:00:21 +0800 Subject: [PATCH] 9415 【BT】【后端】古神战场(战场结算排名奖励及周榜排名奖励改为超出配置的排名无奖励) --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py | 123 +++++++++++++++++++++++++---------------- 1 files changed, 75 insertions(+), 48 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py index 0521929..b10f6c7 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py @@ -4,12 +4,12 @@ # ##@package CrossBattlefield # -# @todo:跨服战场 +# @todo:跨服战场/古神战场 # @author hxp # @date 2022-01-06 # @version 1.0 # -# 详细描述: 跨服战场 +# 详细描述: 跨服战场/古神战场 # #------------------------------------------------------------------------------- #"""Version = 2022-01-06 20:30""" @@ -166,7 +166,7 @@ if not zoneIpyData: return zoneID = zoneIpyData.GetZoneID() - SyncCrossBattlefieldBuyInfo(None, zoneID) + SyncCrossBattlefieldBuyInfo(curPlayer, zoneID) return def DoOnDayEx(): @@ -180,10 +180,13 @@ if not GameWorld.IsCrossServer(): return - enterWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboard", 3, {}) # 周参与榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 - callWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboard", 4, {}) # 周召集榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 - scoreWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboard", 5, {}) # 周参与榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 + enterWeekMoneyItemID = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboardJoin", 3) # 周参与榜额外奖励货币物品ID + enterWeekMoneyMultiDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboardJoin", 4, {}) # 周参与榜额外奖励货币名次对应倍值 + enterWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboardJoin", 2, {}) # 周参与榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 + callWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboard", 2, {}) # 周召集榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 + scoreWeekOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldBillboard", 3, {}) # 周积分榜名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 + enterWeekMoneyMultiIntDict = {int(k):v for k, v in enterWeekMoneyMultiDict.items()} enterWeekOrderIntAwardDict = {int(k):v for k, v in enterWeekOrderAwardDict.items()} callWeekOrderIntAwardDict = {int(k):v for k, v in callWeekOrderAwardDict.items()} scoreWeekOrderIntAwardDict = {int(k):v for k, v in scoreWeekOrderAwardDict.items()} @@ -209,11 +212,17 @@ if not billboardData: continue playerID = billboardData.ID + cmpValue = billboardData.CmpValue rank = i + 1 - awardItemList = GameWorld.GetOrderValueByDict(awardDict, rank) + awardItemList = GameWorld.GetOrderValueByDict(awardDict, rank, False) paramList = [rank] + if billboardType == ShareDefine.Def_CBT_BattlefieldWJoin and enterWeekMoneyItemID: + moneyBaseCount, multiValue = GameWorld.GetOrderValueByDict(enterWeekMoneyMultiIntDict, rank, False) # 奖励货币倍值 + #基础保底值(不同名次可能不一样) + 名次倍率*次数 + awardMoneyCount = int(moneyBaseCount + multiValue * cmpValue) + awardItemList.append([enterWeekMoneyItemID, awardMoneyCount, 0]) PlayerCompensation.SendMailByKey(mailKey, [playerID], awardItemList, paramList, crossMail=True) - + billboardObj.ClearData() return @@ -469,13 +478,8 @@ GameWorld.DebugLog("跨服PK赛季未开启中,跨服战场系统开启广播不处理!") continue - notifyKey = "CrossBattlefieldOpenSys" - paramList = [notifyOpenMinute] - country = 0 - serverGroupIDList = [] - crossNotifyList = [] - crossNotifyList.append([ShareDefine.CrossNotify_World, [country, notifyKey, paramList]]) - PlayerControl.CrossNotifyEx(serverGroupIDList, crossNotifyList) + serverGroupIDList = zoneIpyData.GetServerGroupIDList() + PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "CrossBattlefieldOpenSys", [notifyOpenMinute]) return @@ -503,12 +507,7 @@ matchTickSortList = sorted(buyPlayerInfo.values(), key=operator.attrgetter("buyTime")) buyRec = matchTickSortList[0] - notifyKey = "CrossBattlefieldOpenPlayer" - paramList = [buyRec.playerName, notifyOpenMinute] - country = 0 - crossNotifyList = [] - crossNotifyList.append([ShareDefine.CrossNotify_World, [country, notifyKey, paramList]]) - PlayerControl.CrossNotifyEx(serverGroupIDList, crossNotifyList) + PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "CrossBattlefieldOpenPlayer", [buyRec.playerName, notifyOpenMinute]) return @@ -629,16 +628,16 @@ return curFactionCount, othFactionCount = 0, 0 - for callPlayerID, buyRec in buyPlayerInfo.items(): + for _, buyRec in buyPlayerInfo.items(): if buyRec.factionID == faction: curFactionCount += 1 else: othFactionCount += 1 - if playerID in buyRec.callPlayerIDList: - GameWorld.Log("玩家已经在该召集场次阵营里! zoneID=%s,openHour=%s,openMinute=%s,callPlayerID=%s,callPlayerIDList=%s" - % (zoneID, openHour, openMinute, callPlayerID, buyRec.callPlayerIDList), playerID) - return +# if playerID in buyRec.callPlayerIDList: +# GameWorld.Log("玩家已经在该召集场次阵营里! zoneID=%s,openHour=%s,openMinute=%s,callPlayerID=%s,callPlayerIDList=%s" +# % (zoneID, openHour, openMinute, callPlayerID, buyRec.callPlayerIDList), playerID) +# return if curFactionCount > othFactionCount: GameWorld.Log("阵营平衡限制,不可再购买该跨服战场阵营! zoneID=%s,openHour=%s,openMinute=%s,faction=%s,curFactionCount(%s) > othFactionCount(%s)" @@ -668,14 +667,23 @@ buyRec.callPlayerIDList = [playerID] buyPlayerInfo[playerID] = buyRec + GameWorld.DebugLog("玩家购买开启召集场次! zoneID=%s,openHour=%s,openMinute=%s" % (zoneID, openHour, openMinute), playerID) + # 上榜 - billboardCallCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 2) # 周召集榜上榜至少次数 + billboardCallCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 1) # 周召集榜上榜至少次数 groupValue1, dataID, name1, name2 = zoneID, playerID, playerName, "" type2, value1, value2 = job, realmLV, 0 cmpValue = buyOpenCountWeek + 1 if cmpValue >= billboardCallCountLimit: CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWCall, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue) + for otherBuyPlayerID, otherRec in buyPlayerInfo.items(): + if otherBuyPlayerID == playerID: + continue + if playerID in otherRec.callPlayerIDList: + otherRec.callPlayerIDList.remove(playerID) + GameWorld.DebugLog(" 从已加入的其他召集队伍移除: otherBuyPlayerID=%s,playerID=%s" % (otherBuyPlayerID, playerID), playerID) + SyncMapServerCrossBattlefieldBuyInfo() # 通知子服 @@ -700,6 +708,9 @@ hmNum = GetHMNum(openHour, openMinute) buyPlayerInfo = GetBuyPlayerInfo(zoneID, hmNum) + if tagPlayerID in buyPlayerInfo: + GameWorld.ErrLog("玩家已购买该场次召集队伍,无法加入其他召集队伍! hmNum=%s,tagPlayerID=%s in %s" % (hmNum, tagPlayerID, buyPlayerInfo.keys()), playerID) + return if buyPlayerID not in buyPlayerInfo: GameWorld.ErrLog("跨服战场不存在该玩家的召集队伍! hmNum=%s,buyPlayerID=%s" % (hmNum, buyPlayerID), playerID) return @@ -710,9 +721,19 @@ GameWorld.ErrLog("跨服战场召集人数已满! hmNum=%s,buyPlayerID=%s,callPlayerIDList=%s" % (hmNum, buyPlayerID, buyRec.callPlayerIDList), playerID) return + GameWorld.DebugLog("玩家加入召集队伍! zoneID=%s,openHour=%s,openMinute=%s,buyPlayerID=%s,tagPlayerID=%s" + % (zoneID, openHour, openMinute, buyPlayerID, tagPlayerID), playerID) + if tagPlayerID not in buyRec.callPlayerIDList: buyRec.callPlayerIDList.append(tagPlayerID) + for otherBuyPlayerID, otherRec in buyPlayerInfo.items(): + if otherBuyPlayerID == buyPlayerID: + continue + if tagPlayerID in otherRec.callPlayerIDList: + otherRec.callPlayerIDList.remove(tagPlayerID) + GameWorld.DebugLog(" 从已加入的其他召集队伍移除: otherBuyPlayerID=%s,tagPlayerID=%s" % (otherBuyPlayerID, tagPlayerID), playerID) + SyncMapServerCrossBattlefieldBuyInfo() serverGroupIDList = zoneIpyData.GetServerGroupIDList() @@ -747,6 +768,9 @@ return buyRec.callPlayerIDList.remove(tagPlayerID) + GameWorld.DebugLog("玩家召集队伍踢人! zoneID=%s,openHour=%s,openMinute=%s,buyPlayerID=%s,tagPlayerID=%s" + % (zoneID, openHour, openMinute, buyPlayerID, tagPlayerID), playerID) + SyncMapServerCrossBattlefieldBuyInfo() serverGroupIDList = zoneIpyData.GetServerGroupIDList() @@ -757,10 +781,9 @@ def MapServer_CrossBattlefieldOver(msgList): ## 跨服战场地图结算 overTime = int(time.time()) - hmNum = GetCrossBattlefieldState() - fbPropertyID, zoneID, funcLineID, winnerFaction, superItemInfo, superItemPlayerID, superItemPlayerName, scoreKingID, scoreKingName, battlePlayerList = msgList - GameWorld.Log("跨服战场地图同步结果: hmNum=%s,zoneID=%s,funcLineID=%s,winnerFaction=%s,superItemInfo=%s,superItemPlayerID=%s,scoreKingID=%s,battlePlayerCount=%s" - % (hmNum, zoneID, funcLineID, winnerFaction, superItemInfo, superItemPlayerID, scoreKingID, len(battlePlayerList)), fbPropertyID) + hmNum, fbPropertyID, zoneID, funcLineID, winnerFaction, superItemInfo, finalSuperItemPlayerID, finalSuperItemPlayerName, superItemPlayerIDList, scoreKingID, scoreKingName, battlePlayerList = msgList + GameWorld.Log("跨服战场地图同步结果: hmNum=%s,zoneID=%s,funcLineID=%s,winnerFaction=%s,superItemInfo=%s,finalSuperItemPlayerID=%s,superItemPlayerIDList=%s,scoreKingID=%s,battlePlayerCount=%s" + % (hmNum, zoneID, funcLineID, winnerFaction, superItemInfo, finalSuperItemPlayerID, superItemPlayerIDList, scoreKingID, len(battlePlayerList)), fbPropertyID) winnerOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldAward", 2, {}) # 胜利方名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 loserOrderAwardDict = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldAward", 3, {}) # 失败方名次对应奖励物品列表 {"名次":[[物品ID,个数,是否拍品], ...], ...} , 名次配置支持段配置 @@ -770,25 +793,27 @@ winnerOrderIntAwardDict = {int(k):v for k, v in winnerOrderAwardDict.items()} loserOrderIntAwardDict = {int(k):v for k, v in loserOrderAwardDict.items()} - billboardEnterCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 1) # 周参与榜上榜至少次数 + billboardEnterCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboardJoin", 1) # 周参与榜上榜至少次数 syncPlayerDataInfo = {} winnerPlayerIDList, loserPlayerIDList = [], [] for playerInfo in battlePlayerList: - faction, rank, playerID, job, realmLV, name, score, highScoreToday, highScoreWeekTotal, enterCountWeek, isCallEnter = playerInfo - - isWinner = 0 + playerID, job, realmLV, name, \ + isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek, \ + isCallOpen, isCalled, killCnt, ckillCntInfo, killBossCnt, killScoreKing, killGuardCnt, auraScore, superItemAwardCnt, \ + factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt \ + = playerInfo + paramList = [rank] if faction == winnerFaction: - isWinner = 1 winnerPlayerIDList.append(playerID) orderAwardMailKey = "CrossBattlefieldOrderWin" - orderAwardItemList = GameWorld.GetOrderValueByDict(winnerOrderIntAwardDict, rank) + orderAwardItemList = GameWorld.GetOrderValueByDict(winnerOrderIntAwardDict, rank, False) GameWorld.Log(" 获胜阵营玩家: faction=%s,rank=%s,playerID=%s" % (faction, rank, playerID), fbPropertyID) else: loserPlayerIDList.append(playerID) orderAwardMailKey = "CrossBattlefieldOrderLose" - orderAwardItemList = GameWorld.GetOrderValueByDict(loserOrderIntAwardDict, rank) + orderAwardItemList = GameWorld.GetOrderValueByDict(loserOrderIntAwardDict, rank, False) GameWorld.Log(" 失败阵营玩家: faction=%s,rank=%s,playerID=%s" % (faction, rank, playerID), fbPropertyID) # 排名奖励邮件 @@ -809,10 +834,12 @@ cmpValue = highScoreWeekTotal CrossBillboard.UpdCrossBillboard(ShareDefine.Def_CBT_BattlefieldWScore, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue) - GameWorld.Log(" 战场阵营玩家: faction=%s,isWinner=%s,rank=%s,playerID=%s,score=%s,highScoreToday=%s,highScoreWeekTotal=%s,enterCountWeek=%s,isCallEnter=%s" - % (faction, isWinner, rank, playerID, score, highScoreToday, highScoreWeekTotal, enterCountWeek, isCallEnter), fbPropertyID) + GameWorld.Log(" 战场阵营玩家: faction=%s,isWinner=%s,rank=%s,playerID=%s,score=%s,highScoreToday=%s,highScoreWeekTotal=%s,enterCountWeek=%s,isCallOpen=%s,isCalled=%s" + % (faction, isWinner, rank, playerID, score, highScoreToday, highScoreWeekTotal, enterCountWeek, isCallOpen, isCalled), fbPropertyID) - syncPlayerDataInfo[playerID] = [highScoreToday, highScoreWeekTotal, enterCountWeek, isCallEnter] + syncPlayerDataInfo[playerID] = [isWinner, faction, rank, score, highScoreToday, highScoreWeekTotal, enterCountWeek, + isCallOpen, isCalled, killCnt, ckillCntInfo, killBossCnt, killScoreKing, killGuardCnt, auraScore, superItemAwardCnt, + factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt] # 参与奖励邮件 if winnerPlayerIDList: @@ -822,9 +849,10 @@ # 大奖获得者邮件 superItemID, superItemCount = 0, 0 - if superItemPlayerID and superItemInfo and len(superItemInfo) == 3: + if superItemPlayerIDList and superItemInfo and len(superItemInfo) == 3: superItemID, superItemCount = superItemInfo[0], superItemInfo[1] - PlayerCompensation.SendMailByKey("CrossBattlefieldSuperAward", [superItemPlayerID], [superItemInfo], crossMail=True) + for superItemPlayerID in superItemPlayerIDList: + PlayerCompensation.SendMailByKey("CrossBattlefieldSuperAward", [superItemPlayerID], [superItemInfo], crossMail=True) crossZoneName = GameWorld.GetCrossZoneName() zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID) @@ -847,8 +875,8 @@ nextBattleTimeStr = "%02d:%02d" % (nextOpenHour, nextOpenMinute) # 本分区全服:XX阵营胜利,xxx为本场积分王,xxx获得了古神大奖XXX,下个场次预计将在XX点开放。 - if battlePlayerList: - msgParamList = [winnerFaction, scoreKingName, superItemPlayerName, superItemID, superItemCount, nextBattleTimeStr] + if finalSuperItemPlayerName: + msgParamList = [winnerFaction, scoreKingName, finalSuperItemPlayerName, superItemID, superItemCount, nextBattleTimeStr] PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "CrossBattlefieldOver", msgParamList) return @@ -887,9 +915,8 @@ return for playerID, playerData in syncPlayerDataInfo.items(): - highScoreToday, highScoreWeekTotal, enterCountWeek, isCallEnter = playerData if PlayerControl.GetDBPlayerAccIDByID(playerID): - msgInfo = ["BattlefieldOver", [overTime, highScoreToday, highScoreWeekTotal, enterCountWeek, isCallEnter]] + msgInfo = ["BattlefieldOver", [overTime] + playerData] CrossRealmPlayer.MapServer_QueryCrossPlayerResult(playerID, "CrossBattlefield", msgInfo) return @@ -1079,7 +1106,7 @@ openMinute = clientData.Minute tagPlayerID = clientData.TagPlayerID buyPlayerID = playerID - + GameWorld.DebugLog("召集场次踢人: tagPlayerID=%s,openHour=%s,openMinute=%s" % (tagPlayerID, openHour, openMinute), playerID) if buyPlayerID == tagPlayerID: return -- Gitblit v1.8.0