From d7f44d8d871a90c818bdb3ffe9a60af875b7100a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 30 九月 2025 10:12:23 +0800
Subject: [PATCH] 135 【挑战】战锤秘境-服务端(白骨盈野;副本基础;副本扫荡;广告奖励支持;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py |  566 ++++++++++++++++++++------------------------------------
 1 files changed, 201 insertions(+), 365 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 1f898d3..51b29fe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -16,34 +16,22 @@
 import IPY_GameWorld
 import PlayerControl
 import ItemCommon
-import GameMap
 import NPCCommon
 import ReadChConfig
-import BuffSkill
 import ChPyNetSendPack
 import NetPackCommon
-import SkillCommon
 import IpyGameDataPY
-import PlayerFB
 import ShareDefine
-import EventReport
-import PlayerFamily
-import PlayerActivity
-import ItemControler
-import PlayerSuccess
-import GameFuncComm
 import PyGameData
 import GameObj
 import FBLogic
 import ChConfig
 import PlayerGoldInvest
+import ObjPool
 
-import datetime
 import random
 import json
 import math
-import time
-import copy
 #---------------------------------------------------------------------
 #全局变量
 Def_VSFB_CanEnter = 'VSFB_CanEnter'                   #可以进入
@@ -125,29 +113,25 @@
 
 def GetFBLineEnterPosInfo(mapID, lineID, fbLineIpyData=None):
     # 坐标信息
+    return [10,10]
+def GetPassAwardList(mapID, lineID):
+    # 过关奖励
+    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
+    return [] if not fbLineIpyData else fbLineIpyData.GetPassAwardList()
+def GetSweepAwardList(mapID, lineID, sweepCnt):
+    # 扫荡奖励
+    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
     if not fbLineIpyData:
-        fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-    return None if not fbLineIpyData else fbLineIpyData.GetEnterPosInfo()
-def GetFBLineStepTime(mapID, lineID=0):
-    # 阶段时间信息
-    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-    return None if not fbLineIpyData else fbLineIpyData.GetStepTime()
-def GetFBLineRefreshNPC(mapID, lineID=0): 
-    # 刷怪信息
-    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-    return None if not fbLineIpyData else fbLineIpyData.GetRefreshNPC()
-def GetFBLineGrade(mapID, lineID=0):
-    # 评级规则信息
-    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-    return None if not fbLineIpyData else fbLineIpyData.GetGradeInfo()
-def GetFBLineReward(mapID, lineID):
-    # 奖励信息;支持扫荡取奖励
-    fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-    return None if not fbLineIpyData else fbLineIpyData.GetRewardInfo()
-
-def GetFBGradeRewardRateList(mapID):
-    fbIpyData = GetFBIpyData(mapID)
-    return [] if not fbIpyData else fbIpyData.GetRewardRate()
+        return []
+    awardItemList = fbLineIpyData.GetSweepAwardList()
+    if not awardItemList:
+        awardItemList = fbLineIpyData.GetPassAwardList()
+        
+    sweepItemList = []
+    for itemInfo in awardItemList:
+        itemID, itemCount = itemInfo[:2]
+        sweepItemList.append([itemID, itemCount * sweepCnt])
+    return sweepItemList
 
 def GetFBFuncOpenState(dataMapID):
     ## 获取副本开启状态 @return: 0-关闭;1-开启
@@ -165,38 +149,40 @@
 
 def IsFBPass(curPlayer, mapID, lineID):
     ## 副本线路是否已过关
-    passLineID = 0
     if mapID == ChConfig.Def_FBMapID_Main:
         return PlayerControl.IsMainLevelPass(curPlayer, lineID)
     
-    ipyData = IpyGameDataPY.GetIpyGameDataNotLog('FBGeneralTrain', mapID, lineID)
-    if ipyData:
-        passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
-    else:
-        grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
+    if mapID in ChConfig.PassByStarMapIDList:
+        grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_FBStar, lineID, False, [mapID])
         if grade:
             return True
-            
-    if passLineID >= lineID:
-        return True
-    
+    else:
+        passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
+        if passLineID >= lineID:
+            return True
+        
     return False
+
+def SetFBPass(curPlayer, mapID, funcLineID, isNotify=True):
+    passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
+    if funcLineID > passLineID:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBPassLineID % mapID, funcLineID)
+    if isNotify:
+        Sync_FBPlayerFBInfoData(curPlayer, mapID)
+    return
 
 def CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, reqEnterCnt=1, isNotify=True, isTeamAsk=False):
     # 可否进入副本通用检查, 扫荡通用
     playerID = curPlayer.GetPlayerID()
     
-    if not FBLogic.OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
-        return ShareDefine.EntFBAskRet_OK
-    
     # 总表通用检查
     if fbIpyData:
         #开服天开放检查
-        if not GetFBFuncOpenState(mapID):
-            GameWorld.Log("当前时间未开放该副本!mapID=%s" % (mapID), playerID)
-            if isNotify:
-                PlayerControl.NotifyCode(curPlayer, "FBIsNotOpen")
-            return ShareDefine.EntFBAskRet_FBClose
+        #if not GetFBFuncOpenState(mapID):
+        #    GameWorld.Log("当前时间未开放该副本!mapID=%s" % (mapID), playerID)
+        #    if isNotify:
+        #        PlayerControl.NotifyCode(curPlayer, "FBIsNotOpen")
+        #    return ShareDefine.EntFBAskRet_FBClose
         
         #进入次数判断
         canEnter, notifyMark = __CheckCanEnterFBByTime(curPlayer, mapID, lineID, fbIpyData, reqEnterCnt, isTeamAsk)
@@ -210,25 +196,18 @@
         #等级判断
         curLV = curPlayer.GetLV()
         lvLimitMin = fbLineIpyData.GetLVLimitMin()
-        lvLimitMax = fbLineIpyData.GetLVLimitMax()
         if lvLimitMin and curLV < lvLimitMin:
             GameWorld.Log("玩家等级不足, 无法进入副本!mapID=%s,lineID=%s,curLV(%s) < lvLimitMin(%s)" 
                           % (mapID, lineID, curLV, lvLimitMin), playerID)
             if isNotify:
                 PlayerControl.NotifyCode(curPlayer, "FbLV", [mapID])
             return ShareDefine.EntFBAskRet_LVLimit
-        if lvLimitMax and curLV > lvLimitMax:
-            GameWorld.Log("玩家等级超过, 无法进入副本!mapID=%s,lineID=%s,curLV(%s) > lvLimitMax(%s)" 
-                          % (mapID, lineID, curLV, lvLimitMax), playerID)
-            if isNotify:
-                PlayerControl.NotifyCode(curPlayer, "FbLV", [mapID])
-            return ShareDefine.EntFBAskRet_LVLimit
         
         #门票判断
-        if not GetFBEnterTicket(curPlayer, mapID, lineID, fbLineIpyData, reqEnterCnt, isTeamAsk)[0]:
-            if isNotify:
-                PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_157069", [mapID])
-            return ShareDefine.EntFBAskRet_NoTicket
+        #if not GetFBEnterTicket(curPlayer, mapID, lineID, fbLineIpyData, reqEnterCnt, isTeamAsk)[0]:
+        #    if isNotify:
+        #        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_157069", [mapID])
+        #    return ShareDefine.EntFBAskRet_NoTicket
         
     return ShareDefine.EntFBAskRet_OK
 
@@ -239,42 +218,39 @@
         return True, ""
     
     #playerID = curPlayer.GetPlayerID()
-    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
+    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbEnterCnt % mapID)
     maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
     if enterCnt + reqEnterCnt <= maxCnt:
         return True, ""
     
-    ### 以下是到达次数上限后的处理
-    fbType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID)
+    if mapID in ChConfig.UnPassFreeMapIDList and not IsFBPass(curPlayer, mapID, lineID):
+        return True, ""
     
-    # 单人副本达到次数后不可再进入
-    if fbType == IPY_GameWorld.fbtSingle:
-        #GameWorld.Log("已达到当日最大进入次数!单人副本 mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
-        #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
-        return False, "GeRen_chenxin_268121"
+#    ### 以下是到达次数上限后的处理
+#    fbType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID)
+#    
+#    # 单人副本达到次数后不可再进入
+#    if fbType == IPY_GameWorld.fbtSingle:
+#        #GameWorld.Log("已达到当日最大进入次数!单人副本 mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
+#        #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
+#        return False, "GeRen_chenxin_268121"
+#    
+#    # 组队副本
+#    if fbType == IPY_GameWorld.fbtTeam:
+#        # 可助战的不可单人进入助战,可发起匹配
+#        if not isTeamAsk and (not curPlayer.GetTeamID() or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TeamMemCount) <= 1):
+#            #GameWorld.Log("已达到当日最大进入次数!组队副本不可单人助战! mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
+#            #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
+#            return False, "TeamSingleEnter"
+#        
+#    if mapID not in ChConfig.Def_NoLimitEnterCntMap:
+#        #GameWorld.Log("已达到当日最大进入次数! mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
+#        #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
+#        return False, "GeRen_chenxin_268121"
     
-    # 组队副本
-    if fbType == IPY_GameWorld.fbtTeam:
-        # 无助战的不可再进入
-        if not fbIpyData.GetHelpPoint():
-            #GameWorld.Log("已达到当日最大进入次数!组队副本 mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
-            #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
-            return False, "GeRen_chenxin_268121"
-        
-        # 可助战的不可单人进入助战,可发起匹配
-        if not isTeamAsk and (not curPlayer.GetTeamID() or curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TeamMemCount) <= 1):
-            #GameWorld.Log("已达到当日最大进入次数!组队副本不可单人助战! mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
-            #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
-            return False, "TeamSingleEnter"
-        
-    elif mapID not in ChConfig.Def_NoLimitEnterCntMap:
-        #GameWorld.Log("已达到当日最大进入次数! mapID=%s,enterCnt=%s,reqEnterCnt=%s,maxTimes=%s,maxCnt=%s" 
-        #              % (mapID, enterCnt, reqEnterCnt, maxTimes, maxCnt), playerID)
-        return False, "GeRen_chenxin_268121"
-    
-    # 周进入次数暂不做,待扩展...
-    
-    return True, ""
+    GameWorld.DebugLog("可进入次数不足: mapID=%s, lineID=%s, enterCnt(%s) + reqEnterCnt(%s) <= maxCnt=%s" 
+                       % (mapID, lineID, enterCnt, reqEnterCnt, maxCnt))
+    return False, "GeRen_chenxin_268121"
 
 ## 获取副本进入门票信息
 #  @param curPlayer 玩家实例
@@ -283,38 +259,39 @@
 #  @return [是否可进, [[门票索引列表, delCnt], ...], 删除个数, 是否有绑定, 扣钱信息]
 def GetFBEnterTicket(curPlayer, mapID, lineID=0, fbLineIpyData=None, reqEnterCnt=1, isTeamAsk=False):
     #门票判断
-    if not fbLineIpyData:
-        fbLineIpyData = GetFBLineIpyData(mapID, lineID)
-        
-    ticketID = fbLineIpyData.GetTicketID()
-    if not ticketID:
-        return True, [], 0, False, []
-    
-    ticketCostCntList = fbLineIpyData.GetTicketCostCnt()
-    if not ticketCostCntList:
-        GameWorld.ErrLog("没有配置门票消耗!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
-        return False, [], 0, False, []
-    
-    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
-    costCnt = ticketCostCntList[-1] if enterCnt >= len(ticketCostCntList) else ticketCostCntList[enterCnt]
-    totalCostCnt = costCnt*reqEnterCnt
-    if not totalCostCnt:
-        GameWorld.ErrLog("没有配置门票消耗!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
-        return False, [], 0, False, []
-    
-    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
-    enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(ticketID, itemPack, totalCostCnt)
-    if not enough:
-        ticketPrice = fbLineIpyData.GetTicketPrice()
-        if ticketPrice and not isTeamAsk: #组队进组队副本时必须要有门票道具
-            costMoney = ticketPrice * lackCnt
-            costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney)
-            return bool(costMoneyList), indexList, totalCostCnt, hasBind, costMoneyList
-        GameWorld.DebugLog("门票不足, 无法进入副本!mapID=%s,lineID=%s,ticketID=%s,reqEnterCnt=%s,totalCostCnt=%s" 
-                      % (mapID, lineID, ticketID, reqEnterCnt, totalCostCnt), curPlayer.GetPlayerID())
-        return False, [], 0, False, []
-    
-    return enough, indexList, totalCostCnt, hasBind, []
+    return True, [], 0, False, []
+#    if not fbLineIpyData:
+#        fbLineIpyData = GetFBLineIpyData(mapID, lineID)
+#        
+#    ticketID = fbLineIpyData.GetTicketID()
+#    if not ticketID:
+#        return True, [], 0, False, []
+#    
+#    ticketCostCntList = fbLineIpyData.GetTicketCostCnt()
+#    if not ticketCostCntList:
+#        GameWorld.ErrLog("没有配置门票消耗!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
+#        return False, [], 0, False, []
+#    
+#    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbEnterCnt % mapID)
+#    costCnt = ticketCostCntList[-1] if enterCnt >= len(ticketCostCntList) else ticketCostCntList[enterCnt]
+#    totalCostCnt = costCnt*reqEnterCnt
+#    if not totalCostCnt:
+#        GameWorld.ErrLog("没有配置门票消耗!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
+#        return False, [], 0, False, []
+#    
+#    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
+#    enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(ticketID, itemPack, totalCostCnt)
+#    if not enough:
+#        ticketPrice = fbLineIpyData.GetTicketPrice()
+#        if ticketPrice and not isTeamAsk: #组队进组队副本时必须要有门票道具
+#            costMoney = ticketPrice * lackCnt
+#            costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney)
+#            return bool(costMoneyList), indexList, totalCostCnt, hasBind, costMoneyList
+#        GameWorld.DebugLog("门票不足, 无法进入副本!mapID=%s,lineID=%s,ticketID=%s,reqEnterCnt=%s,totalCostCnt=%s" 
+#                      % (mapID, lineID, ticketID, reqEnterCnt, totalCostCnt), curPlayer.GetPlayerID())
+#        return False, [], 0, False, []
+#    
+#    return enough, indexList, totalCostCnt, hasBind, []
 
 ## 获取副本进入门票信息
 #  @param curPlayer 玩家实例
@@ -1522,28 +1499,22 @@
 
 ## ---------------------------------- TD ---------------------------------------
 def GetEnterFBMaxCnt(curPlayer, mapID):
-    ## 获取副本最大可进入次数: 基本次数 + 时间已恢复次数 + VIP额外次数 + 购买次数 + 找回次数 + 使用道具增加次数
+    ## 获取副本最大可进入次数: 基本次数 + 广告次数 + 购买次数 + 使用道具增加次数 + 其他
     fbIpyData = GetFBIpyData(mapID)
     if not fbIpyData:
         return 0
     maxTimes = fbIpyData.GetDayTimes()
-    
-    mwAddCnt = 0#wmpIpyData.GetEffectValue() if wmpIpyData else 0
-    extraCnt = 0
-    buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
-    itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
-    regainFbCnt = 0
+    adCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBADCnt % mapID)
+    buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBBuyCnt % mapID)
+    itemCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBItemCnt % mapID)
     investFBCnt = PlayerGoldInvest.GetAddFBCnt(curPlayer, mapID)
-    maxCnt = maxTimes + regainFbCnt + extraCnt + buyCnt + mwAddCnt + itemAddCnt + investFBCnt
+    maxCnt = maxTimes + adCnt + buyCnt + itemCnt + investFBCnt
     return maxCnt
 
-## 玩家进入副本次数
-#  @param curPlayer 玩家实例
-#  @param fbID 副本id
-#  @return bool
 def GetEnterFBCount(curPlayer, fbID, lineBit=-1):
+    ## 玩家进入副本次数
     fbID = GetRecordMapID(fbID)
-    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % fbID)
+    enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbEnterCnt % fbID)
     if lineBit >= 0:
         return GameWorld.GetDataByDigitPlace(enterCnt, lineBit)
     return enterCnt
@@ -1551,23 +1522,19 @@
 def AddFBCntByItem(curPlayer, itemID, mapID, addCnt):
     ## 物品增加副本次数
     mapID = GetRecordMapID(mapID)
-    itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID, itemAddCnt + addCnt)
+    itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBItemCnt % mapID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBItemCnt % mapID, itemAddCnt + addCnt)
     Sync_FBPlayerFBInfoData(curPlayer, mapID)
     PlayerControl.NotifyCode(curPlayer, 'AddActivityCount_1', [itemID, mapID, addCnt])
     return
 
-## 增加玩家进入副本次数
-#  @param curPlayer 玩家实例
-#  @param fbID 副本id
-#  @param addCount 增加次数
-#  @return 返回值无意义
 def AddEnterFBCount(curPlayer, fbID, addCount=1, lineBit=-1, isFree=False):
+    ## 增加玩家进入副本次数
     ## @param isFree: 是否免费进入的,免费的不增加实际进入次数,但需要触发进入次数额外处理,如活跃、成就等
-    addCountEx = addCount
+    #addCountEx = addCount
     addCount = 0 if isFree else addCount
     fbID = GetRecordMapID(fbID)
-    enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % fbID
+    enterCntKey = ChConfig.Def_Player_Dict_FbEnterCnt % fbID
     enterCnt = curPlayer.NomalDictGetProperty(enterCntKey)
     if lineBit >= 0:
         curLineEnterCnt = GameWorld.GetDataByDigitPlace(enterCnt, lineBit)
@@ -1582,48 +1549,21 @@
         addCount = updCnt-enterCnt
         PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, updCnt)
         
-        PlayerActivity.OnEnterFBActivity(curPlayer, fbID, updCnt, addCountEx)
-        PlayerSuccess.AddEnterFBSuccess(curPlayer, fbID, addCountEx)
+        #PlayerActivity.OnEnterFBActivity(curPlayer, fbID, updCnt, addCountEx)
+        #PlayerSuccess.AddEnterFBSuccess(curPlayer, fbID, addCountEx)
         updValue = updCnt
-    enterCntTotalKey = ChConfig.Def_Player_Dict_EnterFbCntTotal % fbID
-    enterCntTotal = min(curPlayer.NomalDictGetProperty(enterCntTotalKey) + addCount, ChConfig.Def_UpperLimit_DWord)
-    PlayerControl.NomalDictSetProperty(curPlayer, enterCntTotalKey, enterCntTotal)
-    GameWorld.DebugLog("    AddEnterFBCount fbID=%s, addCount=%s, lineBit=%s, enterCnt=%s,updValue=%s,enterCntTotal=%s" 
-                       % (fbID, addCount, lineBit, enterCnt, updValue, enterCntTotal), curPlayer.GetPlayerID())
+    GameWorld.DebugLog("    AddEnterFBCount fbID=%s, addCount=%s, lineBit=%s, enterCnt=%s,updValue=%s" 
+                       % (fbID, addCount, lineBit, enterCnt, updValue), curPlayer.GetPlayerID())
     Sync_FBPlayerFBInfoData(curPlayer, fbID)
     return True
 
 def FBOnWeek(curPlayer, onWeekType):
-    
-    mapIDInfo = []
-    ipyDataMgr = IpyGameDataPY.IPY_Data()
-    for i in xrange(ipyDataMgr.GetFBFuncCount()):
-        ipyData = ipyDataMgr.GetFBFuncByIndex(i)
-        mapID = ipyData.GetDataMapID()
-        weekTimes = ipyData.GetWeekTimes()
-        # 没有周次数限制的不处理
-        if not weekTimes:
-            continue
-        # 重置类型不同的不处理
-        if ipyData.GetWeekResetType() != onWeekType:
-            continue
-        
-        # 重置周次数
-        enterCntWeekKey = ChConfig.Def_Player_Dict_EnterFbCntWeek % mapID
-        if curPlayer.NomalDictGetProperty(enterCntWeekKey):
-            PlayerControl.NomalDictSetProperty(curPlayer, enterCntWeekKey, 0)
-            mapIDInfo.append(mapID)
-            
-    if mapIDInfo:
-        Sync_FBPlayerFBInfoData(curPlayer, mapIDInfo)
-        
     return
 
-## 玩家通用副本OnDay处理
-#  @param curPlayer: 玩家实例
-#  @return: None
 def FBOnDay(curPlayer, onDayType):
     GameWorld.Log("副本过天处理,FBOnDay...", curPlayer.GetPlayerID())
+    if onDayType != ShareDefine.Def_OnEventType:
+        return
     FBLogic.OnFBPlayerOnDay(curPlayer, onDayType) # 在重置次数之前,可用于处理资源找回
     
     mapIDInfo = []
@@ -1631,44 +1571,18 @@
     for i in xrange(ipyDataMgr.GetFBFuncCount()):
         ipyData = ipyDataMgr.GetFBFuncByIndex(i)
         mapID = ipyData.GetDataMapID()
-        
-        dayTimes = ipyData.GetDayTimes()
+        enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbEnterCnt % mapID)
         # 没有日次数限制的不处理
-        if not dayTimes and not ipyData.GetBuyTimesVIPPriID() and not ipyData.GetExtraTimesVIPPriID() and not ipyData.GetExtraTimesMWPriID():
-            #GameWorld.DebugLog("    不需要重置的副本,mapID=%s,dayTimes=%s,vipBuyPriID=%s,vipExtraTime=%s" 
-            #                   % (mapID, dayTimes, ipyData.GetBuyTimesVIPPriID(), ipyData.GetExtraTimesVIPPriID()))
+        if not enterCnt and not ipyData.GetDayTimes() and not ipyData.GetPayCntMax():
             continue
-        
-        # 重置类型不同的不处理
-        if ipyData.GetDayResetType() != onDayType:
-            #GameWorld.DebugLog("    重置时间点不同,不处理,mapID=%s" % mapID)
-            continue
-        
-        maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
-        
-        # 进入次数
-        enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % mapID
-        enterCnt = curPlayer.NomalDictGetProperty(enterCntKey)
-        PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, 0)
-            
-        # 购买次数
-        buyCntKey = ChConfig.Def_Player_Dict_BuyFbCntDay % mapID
-        buyCnt = curPlayer.NomalDictGetProperty(buyCntKey)
-        PlayerControl.NomalDictSetProperty(curPlayer, buyCntKey, 0)
-        
-        # 物品增加次数
-        itemAddCntKey = ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID
-        itemAddCnt = curPlayer.NomalDictGetProperty(itemAddCntKey)
-        PlayerControl.NomalDictSetProperty(curPlayer, itemAddCntKey, 0)
-        
-        GameWorld.DebugLog("    重置:mapID=%s,dayTimes=%s,buyCnt=%s,itemAddCnt=%s,maxCnt=%s,enterCnt=%s" 
-                           % (mapID, dayTimes, buyCnt, itemAddCnt, maxCnt, enterCnt))
-        
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbEnterCnt % mapID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBADCnt % mapID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBBuyCnt % mapID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBItemCnt % mapID, 0)
         mapIDInfo.append(mapID)
         
     if mapIDInfo:
         Sync_FBPlayerFBInfoData(curPlayer, mapIDInfo)
-        Sync_FBPlayerFBBuyCount(curPlayer, mapIDInfo)
     
     return
 
@@ -1678,7 +1592,6 @@
 def FBOnLogin(curPlayer):
     FBLogic.OnFBPlayerOnLogin(curPlayer)
     Sync_FBPlayerFBInfoData(curPlayer)
-    Sync_FBPlayerFBBuyCount(curPlayer)
     return
 
 #//A5 75 购买副本进入次数#tagCMBuyEnterCount
@@ -1688,63 +1601,38 @@
 #    tagHead        Head;
 #    DWORD        FBID;   // 副本ID
 #};
-
 def BuyFBEnterCount(playerIndex, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
     mapID = clientData.FBID
-    if mapID == ChConfig.Def_FBMapID_Love:
-        coupleID = PlayerControl.GetCoupleID(curPlayer)
-        if not coupleID:
-            GameWorld.DebugLog("没有伴侣无法购买情缘副本次数!")
-            return
     ipyData = GetFBIpyData(mapID)
     if not ipyData:
         return
-    canBuyCnt = 0
+    canBuyCnt = ipyData.GetPayCntMax()
     canBuyCnt += PlayerGoldInvest.GetAddFBBuyCnt(curPlayer, mapID)
-    GameWorld.DebugLog("购买副本进入次数: mapID=%s,canBuyCnt=%s" % (mapID, canBuyCnt))
-    if canBuyCnt <= 0:
-        GameWorld.DebugLog("mapID:%s 不可以购买进入次数"%mapID)
-        return
-    
-    hasBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
-    maxDayTimes = ipyData.GetDayTimes()
-    maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
-    enterCnt = GetEnterFBCount(curPlayer, mapID)
-    if mapID == ChConfig.Def_FBMapID_SealDemon and maxDayTimes and maxCnt - enterCnt >= maxDayTimes:
-        GameWorld.DebugLog('当前次数已满,无需购买。。')
-        return
-    
+    hasBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBBuyCnt % mapID)
+    GameWorld.DebugLog("购买副本进入次数: mapID=%s,canBuyCnt=%s,hasBuyCnt=%s" % (mapID, canBuyCnt, hasBuyCnt))
     if hasBuyCnt >= canBuyCnt:
-        GameWorld.DebugLog("购买次数已经用完mapID=%s,hasBuyCnt=%s >= canBuyCnt=%s" % (mapID, hasBuyCnt, canBuyCnt))
+        GameWorld.DebugLog("副本购买次数已经用完! mapID=%s,hasBuyCnt=%s >= canBuyCnt=%s" % (mapID, hasBuyCnt, canBuyCnt))
         return
-    costGoldDict = IpyGameDataPY.GetFuncEvalCfg('BuyFBCntCost', 1, {})
-    costGold = costGoldDict.get(str(mapID), '0')
-    costGold = eval(costGold)
-    costMoneyTypeInfo = IpyGameDataPY.GetFuncEvalCfg('BuyFBCntCost', 2, {})
-    costType = costMoneyTypeInfo.get(str(mapID), ShareDefine.TYPE_Price_Gold_Paper_Money)
-    if costGold <= 0:
-        GameWorld.DebugLog("没有配置购买副本次数消耗货币数! mapID=%s,costType=%s,costGold=%s" % (mapID, costType, costGold))
+    costType = ipyData.GetPayMoneyType()
+    payMoneyList = ipyData.GetPayMoneyValues()
+    if not costType or not payMoneyList:
+        GameWorld.DebugLog("没有配置购买副本次数消耗货币数! mapID=%s,costType=%s,payMoneyList=%s" % (mapID, costType, payMoneyList))
         return
-    costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, costType, costGold)
-    #GameWorld.Log('costMoneyList=%s,costGold=%s'%(costMoneyList,costGold))
-    if not costMoneyList:
+    costMoney = payMoneyList[hasBuyCnt] if len(payMoneyList) > hasBuyCnt else payMoneyList[-1]
+    if not PlayerControl.PayMoney(curPlayer, costType, costMoney, ChConfig.Def_Cost_BuyFBCnt, {"MapID":mapID}):
         return
-    infoDict = {"MapID":mapID}
-    
-    for moneyType, moneyNum in costMoneyList:
-        if not PlayerControl.PayMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_Cost_BuyFBCnt, infoDict):
-            GameWorld.DebugLog("仙玉不足!costGold=%s" % costGold)
-            return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_BuyFbCntDay % mapID, hasBuyCnt + 1)
-    Sync_FBPlayerFBBuyCount(curPlayer, [mapID])
-    PlayerControl.NotifyCode(curPlayer, 'FBEnterTimeBuy', [mapID])
-    if mapID == ChConfig.Def_FBMapID_Love:
-        coupleID = PlayerControl.GetCoupleID(curPlayer)
-        if coupleID:
-            addItemList = IpyGameDataPY.GetFuncEvalCfg("LoveFB", 3)
-            paramList = [curPlayer.GetPlayerName()]
-            PlayerControl.SendMailByKey("BuyLoveFBCntCoupleMail", [coupleID], addItemList, paramList)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBBuyCnt % mapID, hasBuyCnt + 1)
+    Sync_FBPlayerFBInfoData(curPlayer, mapID)
+    return
+
+def AddFBADCnt(curPlayer, mapID):
+    fbIpyData = GetFBIpyData(mapID)
+    if not fbIpyData:
+        return
+    adCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBADCnt % mapID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBADCnt % mapID, adCnt + 1)
+    Sync_FBPlayerFBInfoData(curPlayer, mapID)
     return
 
 ## 获取记录值的mapID
@@ -1752,42 +1640,42 @@
 #  @return
 #  @remarks 一般用于几张地图公用一份存储记录,如组队副本进入次数,CD时间等数据需共享
 def GetRecordMapID(mapID):
-    DataMapIDDict = IpyGameDataPY.GetConfigEx("DataMapIDDict")
-    if not DataMapIDDict:
-        mIDToDataMapIDDict = {} # 场景ID对应功能地图ID
-        dMapIDDict = {}
-        ipyDataMgr = IpyGameDataPY.IPY_Data()
-        for i in xrange(ipyDataMgr.GetFBLineCount()):
-            ipyData = ipyDataMgr.GetFBLineByIndex(i)
-            dMapID = ipyData.GetDataMapID()
-            mID = ipyData.GetMapID()
-            mIDList= dMapIDDict.get(dMapID, [])
-            if mID not in mIDList:
-                mIDList.append(mID)
-                dMapIDDict[dMapID] = mIDList
-                
-            dMIDList= mIDToDataMapIDDict.get(mID, [])
-            if dMapID not in dMIDList:
-                dMIDList.append(dMapID)
-                mIDToDataMapIDDict[mID] = dMIDList
-                
-        unMIDList = []
-        for mID, dMIDList in mIDToDataMapIDDict.items():
-            if len(dMIDList) > 1:
-                unMIDList.append(mID)
-                #GameWorld.DebugLog("----------- 同个场景对应到多个功能地图的,视为无意义的地图! mID=%s, to dMIDList=%s" % (mID, dMIDList))
-        for dMapID, mIDList in dMapIDDict.items():
-            for unMID in unMIDList:
-                if unMID in mIDList:
-                    mIDList.remove(unMID)
-            if len(mIDList) <= 1:
-                dMapIDDict.pop(dMapID)
-        DataMapIDDict = IpyGameDataPY.SetConfigEx("DataMapIDDict", dMapIDDict)
-        #GameWorld.Log("加载DataMapIDDict=%s" % DataMapIDDict)
-        
-    for dataMapID, mapIDList in DataMapIDDict.items():
-        if mapID in mapIDList:
-            return dataMapID
+#    DataMapIDDict = IpyGameDataPY.GetConfigEx("DataMapIDDict")
+#    if not DataMapIDDict:
+#        mIDToDataMapIDDict = {} # 场景ID对应功能地图ID
+#        dMapIDDict = {}
+#        ipyDataMgr = IpyGameDataPY.IPY_Data()
+#        for i in xrange(ipyDataMgr.GetFBLineCount()):
+#            ipyData = ipyDataMgr.GetFBLineByIndex(i)
+#            dMapID = ipyData.GetDataMapID()
+#            mID = ipyData.GetMapID()
+#            mIDList= dMapIDDict.get(dMapID, [])
+#            if mID not in mIDList:
+#                mIDList.append(mID)
+#                dMapIDDict[dMapID] = mIDList
+#                
+#            dMIDList= mIDToDataMapIDDict.get(mID, [])
+#            if dMapID not in dMIDList:
+#                dMIDList.append(dMapID)
+#                mIDToDataMapIDDict[mID] = dMIDList
+#                
+#        unMIDList = []
+#        for mID, dMIDList in mIDToDataMapIDDict.items():
+#            if len(dMIDList) > 1:
+#                unMIDList.append(mID)
+#                #GameWorld.DebugLog("----------- 同个场景对应到多个功能地图的,视为无意义的地图! mID=%s, to dMIDList=%s" % (mID, dMIDList))
+#        for dMapID, mIDList in dMapIDDict.items():
+#            for unMID in unMIDList:
+#                if unMID in mIDList:
+#                    mIDList.remove(unMID)
+#            if len(mIDList) <= 1:
+#                dMapIDDict.pop(dMapID)
+#        DataMapIDDict = IpyGameDataPY.SetConfigEx("DataMapIDDict", dMapIDDict)
+#        #GameWorld.Log("加载DataMapIDDict=%s" % DataMapIDDict)
+#        
+#    for dataMapID, mapIDList in DataMapIDDict.items():
+#        if mapID in mapIDList:
+#            return dataMapID
     return mapID
 
 def GetGeneralTrainMapIDList():
@@ -1806,11 +1694,8 @@
         
     return GeneralTrainMapIDList
 
-## 通知个人通用副本信息
-#  @param curPlayer: 玩家实例
-#  @param runTime: 已经进行时间
-#  @return: None
 def Sync_FBPlayerFBInfoData(curPlayer, mapIDInfo=None):
+    ## 通知个人通用副本信息
     if not mapIDInfo:
         ipyDataMgr = IpyGameDataPY.IPY_Data()
         mapIDList = [ipyDataMgr.GetFBFuncByIndex(i).GetDataMapID() for i in xrange(ipyDataMgr.GetFBFuncCount())]
@@ -1819,74 +1704,25 @@
             return
         mapIDList = [mapIDInfo] if type(mapIDInfo) == int else mapIDInfo
         
-    fbInfoData = ChPyNetSendPack.tagMCPlayerFBInfoData()
-    fbInfoData.Clear()
-    fbInfoData.FBDataCnt = len(mapIDList)
-    fbInfoData.FBDataList = []
+    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCFBInfoList)
+    clientPack.FBDataList = []
     
-    for mID in mapIDList:
-        mapInfo = ChPyNetSendPack.tagMCFBInfo()
-        mapInfo.Clear()
-        mapInfo.FBID = mID
-        mapInfo.EnterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mID)
-        mapInfo.EnterCntTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntTotal % mID)
-        mapInfo.RecoverCnt = 0
-        mapInfo.ItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mID)
-        mapInfo.PassLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mID)
-        
+    for mapID in mapIDList:
+        fbInfo = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCFBInfo)
+        fbInfo.MapID = mapID
+        fbInfo.EnterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbEnterCnt % mapID)
+        fbInfo.ADAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBADCnt % mapID)
+        fbInfo.BuyAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBBuyCnt % mapID)
+        fbInfo.ItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBItemCnt % mapID)
+        fbInfo.PassLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
         for keyNum in range(ChConfig.Def_FBStar_MaxKeyCnt):
-            gradeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PlayerFBStar_MapId % (mID, keyNum))
-            mapInfo.PassGrade.append(gradeValue)
-        mapInfo.PassGradeCnt = len(mapInfo.PassGrade)
-        #GameWorld.DebugLog("FBID:%s---:%s"%(mapInfo.FBID,mapInfo.EnterCnt))
-        fbInfoData.FBDataList.append(mapInfo)
+            gradeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBStar % (mapID, keyNum))
+            fbInfo.PassGrade.append(gradeValue)
+        fbInfo.PassGradeCnt = len(fbInfo.PassGrade)
+        clientPack.FBDataList.append(fbInfo)
         
-    NetPackCommon.SendFakePack(curPlayer, fbInfoData)
-    return
-
-#// A3 BD 通知玩家购买副本进入次数 #tagMCBuyEnterInfo
-#
-#struct    tagMCBuyEnterInfo
-#{
-#    tagHead            Head;
-#    BYTE        FBCount;    // 副本个数
-#    DWORD            tagMCFBInfo[FBCount];    // 副本信息
-#};
-#
-#struct    tagMCBuyInfo
-#{
-#    tagHead            Head;
-#    DWORD            FBID;        // 副本ID
-#    BYTE        BuyCount;    // 已购买次数
-#};
-## 通知个人购买副本次数信息
-#  @param curPlayer: 玩家实例
-#  @param runTime: 已经进行时间
-#  @return: None
-def Sync_FBPlayerFBBuyCount(curPlayer, mapIDList=[]):
-    if not mapIDList:
-        mapIDList = []
-        ipyDataMgr = IpyGameDataPY.IPY_Data()
-        for i in xrange(ipyDataMgr.GetFBFuncCount()):
-            ipyData = ipyDataMgr.GetFBFuncByIndex(i)
-            if not ipyData.GetBuyTimesVIPPriID():
-                continue
-            mapIDList.append(ipyData.GetDataMapID())
-   
-        
-    fbInfoData = ChPyNetSendPack.tagMCBuyEnterInfo()
-    fbInfoData.Clear()
-    fbInfoData.FBInfo = []
-    for mID in mapIDList:
-        mapInfo = ChPyNetSendPack.tagMCBuyInfo()
-        mapInfo.Clear()
-        mapInfo.FBID = mID
-        mapInfo.BuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mID)
-        fbInfoData.FBInfo.append(mapInfo)
-        #GameWorld.DebugLog("FBID:%s---BuyCount:%s"%(mapInfo.FBID,mapInfo.BuyCount))
-    fbInfoData.FBCount = len(fbInfoData.FBInfo)
-    if fbInfoData.FBCount > 0:
-        NetPackCommon.SendFakePack(curPlayer, fbInfoData)
+    clientPack.FBDataCnt = len(clientPack.FBDataList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
 
 ## 根据人数分组

--
Gitblit v1.8.0