From 649b36b642546062ab5102b6225b9f78ea72309d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 04 十一月 2025 18:11:02 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(优化完整战报仅包含战斗相关封包,结算奖励相关如物品,经验,货币,挑战次数等统一放在战报数据B430后同步)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py | 34 +++++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py | 11 +++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py | 19 +++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 4 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py | 44 +++++++++-----
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py | 18 +++++
6 files changed, 99 insertions(+), 31 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index afde48b..398e8b0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -182,6 +182,7 @@
self.isNeedReport = isNeedReport # 是否需要战报
self.msgDict = {} # 扩展信息字典,一般由MapID绑定的功能决定信息内容 {k:v, ...}
self._kvDict = {} # 自定义信息字典,不会被重置 {k:v, ...}
+ self.awardData = None # 战斗奖励设置的数据,可以是任意数据格式,由功能自行决定,会传递给 OnTurnFightAward 处理
self.factionDict = {} # 战斗阵营 {faction:BatFaction, ...},一般是只有两个阵营,faction为1或2,每个阵营支持多个阵容
self.actionSortList = [] # 阵容行动顺序 [[faction, num], ...]
@@ -211,6 +212,7 @@
self.setPVP()
self.msgDict = {}
self._kvDict = {}
+ self.awardData = None
self.nextTurnFight(msgDict)
return
@@ -1012,6 +1014,7 @@
PlayerOnline.GetOnlinePlayer(curPlayer).SetLastBatBuffer(guid, turnFight.batBuffer)
SyncTurnFightReport(curPlayer, guid, turnFight.batBuffer)
+ FBLogic.OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, turnFight.awardData)
tfMgr.delTurnFight(guid)
return True
@@ -1050,6 +1053,7 @@
PlayerOnline.GetOnlinePlayer(curPlayer).SetLastBatBuffer(guid, turnFight.batBuffer)
SyncTurnFightReport(curPlayer, guid, turnFight.batBuffer)
+ FBLogic.OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, turnFight.awardData)
tfMgr.delTurnFight(guid)
return True
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index abb555a..65e75c9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -2303,3 +2303,14 @@
return callFunc(curPlayer, turnFight, mapID, funcLineID, overMsg)
+def OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, awardData):
+ ## 回合战斗结算奖励
+
+ do_FBLogic_ID = __GetFBLogic_MapID(mapID)
+
+ callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnTurnFightAward"))
+
+ if callFunc == None:
+ return
+
+ return callFunc(curPlayer, turnFight, mapID, funcLineID, awardData)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
index f597e7e..fb0c287 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Arena.py
@@ -124,26 +124,12 @@
atkAddScore, defDecScore = winScoreInfo
GameWorld.DebugLog("scoreIndex=%s,winScoreInfo=%s" % (scoreIndex, winScoreInfo), playerID)
- if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_ArenaTicket, 1):
- return
-
# 无论胜负,只要挑战都给固定奖励
awardItemList = IpyGameDataPY.GetFuncEvalCfg("ArenaSet", 4)
- ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["Arena", False, {}], isNotifyAward=False)
-
- __updArenaBatRecord(curPlayer, turnFight, tagPlayerID, isWin, atkAddScore, defDecScore)
-
overMsg.update({"tagPlayerID":tagPlayerID, "atkAddScore":atkAddScore, "defDecScore":defDecScore,
FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(awardItemList)})
- PlayerArena.Sync_ArenaInfo(curPlayer)
-
- # 战斗结束系统强制刷新匹配
- PlayerArena.DoArenaMatchRefresh(curPlayer, True, isSys=True)
-
- PlayerZhanling.AddZhanlingValue(curPlayer, PlayerZhanling.ZhanlingType_ArenaCnt, 1)
- PlayerGubao.AddGubaoSpecEffLayer(curPlayer, PlayerGubao.GubaoEffType_Arena, 1)
- PlayerActivity.AddDailyTaskValue(curPlayer, ChConfig.DailyTask_Arena, 1)
+ turnFight.awardData = [tagPlayerID, isWin, atkAddScore, defDecScore, awardItemList]
return
def __updArenaBatRecord(curPlayer, turnFight, tagPlayerID, isWin, atkAddScore, defDecScore):
@@ -212,3 +198,31 @@
if defDecScore: # 防守方仅变更时更新
PlayerBillboard.UpdateBillboardByID(tagPlayerID, ShareDefine.Def_BT_Arena, updScore)
return
+
+def OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, awardData):
+ ## 回合战斗结算奖励
+ if not curPlayer:
+ return
+
+ if not awardData:
+ return
+
+ tagPlayerID, isWin, atkAddScore, defDecScore, awardItemList = awardData
+
+ if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_ArenaTicket, 1):
+ return
+
+ # 无论胜负,只要挑战都给固定奖励
+ ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["Arena", False, {}], isNotifyAward=False)
+
+ __updArenaBatRecord(curPlayer, turnFight, tagPlayerID, isWin, atkAddScore, defDecScore)
+
+ PlayerArena.Sync_ArenaInfo(curPlayer)
+
+ # 战斗结束系统强制刷新匹配
+ PlayerArena.DoArenaMatchRefresh(curPlayer, True, isSys=True)
+
+ PlayerZhanling.AddZhanlingValue(curPlayer, PlayerZhanling.ZhanlingType_ArenaCnt, 1)
+ PlayerGubao.AddGubaoSpecEffLayer(curPlayer, PlayerGubao.GubaoEffType_Arena, 1)
+ PlayerActivity.AddDailyTaskValue(curPlayer, ChConfig.DailyTask_Arena, 1)
+ return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
index e3563de..91b8967 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevelBoss.py
@@ -113,6 +113,28 @@
% (chapterID, levelNum, nextChapterID, nextLevelNum), playerID)
isAllPass = True
+ # 发放过关奖励
+ levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
+ itemList = levelIpyData.GetAwardItemList() if levelIpyData else []
+ GameWorld.DebugLog("过关奖励: chapterID=%s,levelNum=%s,itemList=%s" % (chapterID, levelNum, itemList), playerID)
+ overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList)})
+
+ turnFight.awardData = [nextChapterID, nextLevelNum, isAllPass, itemList]
+ return
+
+def OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, awardData):
+ ## 回合战斗结算奖励
+ if not curPlayer:
+ return
+
+ if not awardData:
+ return
+
+ playerID = curPlayer.GetPlayerID()
+
+ nextChapterID, nextLevelNum, isAllPass, itemList = awardData
+ GameWorld.DebugLog("处理奖励数据: nextChapterID=%s,nextLevelNum=%s,isAllPass=%s,itemList=%s" % (nextChapterID, nextLevelNum, isAllPass, itemList))
+
updPassValue = PlayerControl.SetMainLevelPassInfo(curPlayer, nextChapterID, nextLevelNum, 0)
if isAllPass:
# 已通关的刷怪进度保持不变
@@ -120,17 +142,7 @@
GameWorld.DebugLog("已通关的刷怪进度保持不变: updNowValue=%s" % updNowValue, playerID)
else:
updNowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, nextChapterID, nextLevelNum, 1)
- GameWorld.DebugLog("为通关的刷怪进度设置为下一关的第1波: updNowValue=%s" % updNowValue, playerID)
+ GameWorld.DebugLog("未通关的刷怪进度设置为下一关的第1波: updNowValue=%s" % updNowValue, playerID)
GameWorld.DebugLog("updPassValue=%s,updNowValue=%s" % (updPassValue, updNowValue), playerID)
-
- # 发放过关奖励
- levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
- if not levelIpyData:
- return
- itemList = levelIpyData.GetAwardItemList()
- GameWorld.DebugLog("过关奖励: chapterID=%s,levelNum=%s,itemList=%s" % (chapterID, levelNum, itemList), playerID)
-
ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["MainLevelBoss", False, {}], isNotifyAward=False)
-
- overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList)})
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
index f700730..f5d9a48 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Tianzi.py
@@ -181,10 +181,24 @@
#更新榜单
PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Tianzi, todayHurtEx, todayHurt)
- itemList = __getTianziAwardList(todayHurt, bossID)
+ itemList = __getTianziAwardList(totalHurt, bossID)
+ overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList), "totalHurt":totalHurt, "todayHurtTotal":todayHurtTotal})
+
+ turnFight.awardData = [lineID, bossID, itemList]
+ return
+
+def OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, awardData):
+ ## 回合战斗结算奖励
+ if not curPlayer:
+ return
+
+ if not awardData:
+ return
+
+ lineID, bossID, itemList = awardData
+
FBCommon.AddEnterFBCount(curPlayer, mapID)
ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["Tianzi", False, {}], isNotifyAward=False)
- overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList), "totalHurt":totalHurt, "todayHurtTotal":todayHurtTotal})
SyncTianziInfo(curPlayer, lineID, bossID)
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
index 8d6271e..542529b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Zhanchui.py
@@ -45,14 +45,27 @@
itemList = FBCommon.GetPassAwardList(mapID, funcLineID)
GameWorld.DebugLog("过关奖励: mapID=%s,funcLineID=%s,itemList=%s" % (mapID, funcLineID, itemList))
+ overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList)})
+
+ turnFight.awardData = [itemList]
+ return
+
+def OnTurnFightAward(curPlayer, turnFight, mapID, funcLineID, awardData):
+ ## 回合战斗结算奖励
+ if not curPlayer:
+ return
+
+ if not awardData:
+ return
+
+ itemList = awardData[0]
+
# 首通不扣次数
FBCommon.AddEnterFBCount(curPlayer, mapID, isFree=True)
FBCommon.SetFBPass(curPlayer, mapID, funcLineID)
ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["Zhanchui", False, {}], isNotifyAward=False)
- overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList)})
-
return
-
+
def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, dataEx):
## 可否扫荡
--
Gitblit v1.8.0