From 549a8b666e258ae45b8e2c2d6cf6ac988f85850e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 02 九月 2025 19:44:57 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(修复报错;寻宝物品权重为0不产出;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
index 65f15e2..cef5c8b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
@@ -17,6 +17,7 @@
 
 import ChConfig
 import GameWorld
+import TurnAttack
 import ShareDefine
 import IpyGameDataPY
 import PlayerControl
@@ -25,6 +26,7 @@
 import IPY_GameWorld
 import NetPackCommon
 import ItemCommon
+import PlayerTask
 import NPCCommon
 import ChEquip
 import ObjPool
@@ -307,6 +309,8 @@
         
     # 刷属性
     ChEquip.RefreshRoleEquipAttr(curPlayer)
+    
+    PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_EquipColor)
     return
 
 def __doDecomposeMainEquip(curPlayer, itemIndexList):
@@ -320,6 +324,7 @@
     
     moneyTotal = 0
     
+    decomposeCnt = 0
     decomposeIndexList = []
     for itemIndex in itemIndexList:
         if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount():
@@ -350,11 +355,13 @@
         
         ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), True, ChConfig.ItemDel_EquipDecompose)
         decomposeIndexList.append(itemIndex)
+        decomposeCnt += 1
         
     if not moneyTotal:
         return
     
     PlayerControl.GiveMoney(curPlayer, moneyType, moneyTotal, "DecomposeMainEquip", isSysHint=False)
+    PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_EquipDecompose, decomposeCnt)
     return
 
 def __doPickupMainItem(curPlayer, itemIndexList):
@@ -402,3 +409,48 @@
     clientPack.Count = len(clientPack.DropBootyList)
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
+
+def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg):
+    ## 回合战斗结束
+    
+    if not curPlayer:
+        return
+    
+    #winFaction = turnFight.winFaction
+    isWin = turnFight.isWin
+    
+    playerID = curPlayer.GetPlayerID()
+    mainFightMgr = TurnAttack.GetMainFightMgr(curPlayer)
+    chapterID, levelNum, wave = PlayerControl.GetMainLevelNowInfo(curPlayer)
+    
+    if not isWin:
+        nextWave = max(1, wave - 1)
+        nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave)
+        GameWorld.DebugLog("主线小怪战斗失败,降一波! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s" 
+                           % (chapterID, levelNum, wave, nextWave, nowValue), playerID)
+        return
+    
+    if turnFight.haveNextLineup():
+        GameWorld.DebugLog("主线小怪战斗胜利,有下一小队! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
+        return
+    
+    # 获胜过波
+    if wave < mainFightMgr.waveMax:
+        nextWave = min(mainFightMgr.waveMax, wave + 1)
+        nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave)
+        GameWorld.DebugLog("主线小怪波战斗胜利,下一波! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s" 
+                           % (chapterID, levelNum, wave, nextWave, nowValue), playerID)
+    else:
+        GameWorld.DebugLog("主线小怪波战斗胜利,最后一波循环刷! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
+        
+    # 小怪可能会退波,所以只在有超过已过关卡进度时才更新值
+    hisPassValue = PlayerControl.GetMainLevelPassValue(curPlayer)
+    curPassValue = PlayerControl.ComMainLevelValue(chapterID, levelNum, wave)
+    if curPassValue > hisPassValue:
+        GameWorld.DebugLog("更新当前过关进度! curPassValue=%s,hisPassValue=%s" % (curPassValue, hisPassValue), playerID)
+        PlayerControl.SetMainLevelPassValue(curPlayer, curPassValue)
+    else:
+        GameWorld.DebugLog("未超过当前过关进度,不更新! curPassValue=%s <= hisPassValue=%s" % (curPassValue, hisPassValue), playerID)
+        
+    return
+

--
Gitblit v1.8.0