hch
2026-01-07 96aea786fc5cfb147a1b5e08f09a1fe2d27d31b0
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -23,18 +23,13 @@
#------------------------------------------------------------------------------ 
#"""Version = 2016-12-02 11:00"""
#------------------------------------------------------------------------------ 
import IPY_GameWorld
import PlayerControl
import GameWorld
import FBCommon
import ChConfig
import FBLogic
import PlayerSuccess
import ItemCommon
import IpyGameDataPY
import ShareDefine
import GameFuncComm
import NPCCommon
import ChConfig
#---------------------------------------------------------------------
def OnLogin(curPlayer):
@@ -60,100 +55,47 @@
#    DWORD        MapID;
#    WORD        LineID;
#    BYTE        Cnt;    // 扫荡次数
#    BYTE        IsFinish;    // 是否立即完成; 0-否;1-花钱立即完成;2-客户端自行倒计时间到后发送2代表领取扫荡完成奖励
#    DWORD        DataEx;    //附带信息
#    BYTE        IsLittleHelper;    // 是否小助手扫荡
#};
def OnPlayerFBWipeOut(playerIndex, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
    
    #if not GameWorld.CheckPlayerTick(curPlayer, ChConfig.TYPE_Player_Tick_BeginFBWipeOut, tick):
    #    GameWorld.DebugLog("玩家副本扫荡请求CD中...", curPlayer.GetPlayerID())
    #    return
    mapID = clientData.MapID
    lineID = clientData.LineID
    cnt = clientData.Cnt
    #isFinish = clientData.IsFinish
    isFinish = 1 # 暂时默认1,之后有需要扫荡等待的再说
    dataEx = clientData.DataEx
    isLittleHelper = clientData.IsLittleHelper
    if isLittleHelper:
        if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_LittleHelper):
            GameWorld.DebugLog("玩家没有小助手功能权限!", curPlayer.GetPlayerID())
            return
    
    if cnt <= 0:
        return
    
    fbIpyData = FBCommon.GetFBIpyData(mapID)
    if FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID()) == FBCommon.GetRecordMapID(mapID):
        if fbIpyData and fbIpyData.GetDayTimes():#没有限制进入次数的不限制在目标地图扫荡
            GameWorld.DebugLog("玩家在扫荡目标地图中,无法扫荡!mapID=%s" % mapID)
            return
    fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID, False)
    if not fbIpyData or not fbLineIpyData:
        GameWorld.DebugLog("不存在该副本或线路无法扫荡!mapID=%s, lineID=%s" % (mapID, lineID))
        return
    
    fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
    if not fbLineIpyData:
        GameWorld.DebugLog("找不到该副本线路,无法扫荡!mapID=%s, lineID=%s" % (mapID, lineID))
    if mapID not in ChConfig.SweepUnCheckPassMapIDList and not FBCommon.IsFBPass(curPlayer, mapID, lineID):
        GameWorld.DebugLog("未过关无法扫荡!mapID=%s, lineID=%s" % (mapID, lineID))
        return
    
    if FBCommon.CheckCanEnterFBComm(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, cnt) != ShareDefine.EntFBAskRet_OK:
        return
    costMoneyList = []
    sweepCostindexList = []
    sweepCostCnt = 0
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    if fbLineIpyData:
        #扫荡等级判断
        sweepLVLimit = fbLineIpyData.GetSweepLVLimit()
        if sweepLVLimit and curPlayer.GetLV() < sweepLVLimit:
            GameWorld.DebugLog('玩家副本扫荡,等级不足!mapID=%s, lineID=%s, playerLV=%s, sweepLVLimit=%s'
                               % (mapID, lineID, curPlayer.GetLV(), sweepLVLimit), curPlayer.GetPlayerID())
            return
        #扫荡道具判断,小助手不消耗扫荡道具
        sweepItemID = fbLineIpyData.GetSweepItemID()
        if sweepItemID and not isLittleHelper:
            sweepItemCnt = fbLineIpyData.GetSweepCostCnt()
            sweepCostCnt = sweepItemCnt * cnt
            #isEnough, sweepCostindexList = ItemCommon.GetItem_FromPack_ByID(sweepItemID, itemPack, sweepCostCnt)
            isEnough, sweepCostindexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(sweepItemID, itemPack, sweepCostCnt)
            if not isEnough:
                itemPrice = ItemCommon.GetShopItemPrice(sweepItemID, IPY_GameWorld.TYPE_Price_Gold_Money)
                if itemPrice:
                    costMoney = itemPrice * lackCnt
                    costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney)
                if not costMoneyList:
                    GameWorld.DebugLog("扫荡消耗道具不足, mapID=%s,lineID=%s,sweepItemID=%s,sweepCostCnt=%s"
                                   % (mapID, lineID, sweepItemID, sweepCostCnt), curPlayer.GetPlayerID())
                    return
    
    # 副本是否可扫荡, 这里只判断副本自身的特殊条件, 公共条件上面已经判断
    if not FBLogic.OnPlayerFBSweepAsk(curPlayer, mapID, lineID, cnt, isFinish, dataEx):
    askRet = FBLogic.OnPlayerFBSweepAsk(curPlayer, mapID, lineID, cnt, dataEx)
    if not askRet:
        GameWorld.DebugLog("该副本当前无法扫荡!mapID=%s, lineID=%s" % (mapID, lineID))
        return
    
    PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FeastRedPack_FBSweep, 1, [mapID])
    #扣除扫荡道具
    if sweepCostindexList and sweepCostCnt:
        ItemCommon.ReduceItem(curPlayer, itemPack, sweepCostindexList, sweepCostCnt, False, 'FBSweepCostItem')
    if costMoneyList:
        infoDict = {"MapID":mapID, "LineID":lineID, 'SweepCount':cnt}
        for moneyType, moneyNum in costMoneyList:
            if not PlayerControl.PayMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_Cost_FBSweep, infoDict):
                return False, hasBind
    #需先扣除门票, 再增加次数, 否则可能导致扣除的数量错误
    FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID, cnt)
    #FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID, cnt)
    #增加副本进入次数
    if fbIpyData and fbIpyData.GetDayTimes():
        FBCommon.AddEnterFBCount(curPlayer, mapID, cnt)
        
    #扫荡结果给奖励等
    FBLogic.OnPlayerFBSweepResult(curPlayer, mapID, lineID, cnt, isFinish, dataEx)
    FBLogic.OnPlayerFBSweepResult(curPlayer, mapID, lineID, cnt, dataEx, askRet)
    return
#// B1 08 快速一键过关副本 #tagCMFBQuickPass
@@ -177,21 +119,20 @@
        return
    
    reqRet = FBLogic.OnPlayerFBQuickPass(curPlayer, mapID, lineID)
    if not reqRet or len(reqRet) != 2:
    if not reqRet:
        GameWorld.DebugLog("无法一键过关副本: mapID=%s,lineID=%s" % (mapID, lineID), playerID)
        return
    bossID, quickCnt = reqRet
    if bossID:
        npcData = GameWorld.GetGameData().FindNPCDataByID(bossID)
        if not npcData:
            return
        npcFightPower = NPCCommon.GetSuppressFightPower(npcData)
    lineID = reqRet[0]
    quickCnt = reqRet[1] if len(reqRet) > 1 else 0
    quickFightPower = reqRet[2] if len(reqRet) > 2 else 0
    quickData = reqRet[3] if len(reqRet) > 3 else []
    if quickFightPower:
        quickNeedRatio = IpyGameDataPY.GetFuncCfg("FBQuickPass", 1)
        quickNeedFightPower = int(npcFightPower * quickNeedRatio)
        quickNeedFightPower = int(quickFightPower * quickNeedRatio)
        curFightPower = PlayerControl.GetFightPower(curPlayer)
        if quickNeedFightPower and curFightPower < quickNeedFightPower:
            GameWorld.DebugLog("无法一键过关副本! 战力限制: mapID=%s,lineID=%s,bossID=%s,npcFightPower=%s,quickNeedFightPower=%s > %s"
                               % (mapID, lineID, bossID, npcFightPower, quickNeedFightPower, curFightPower), playerID)
            GameWorld.DebugLog("无法一键过关副本! 战力限制: mapID=%s,lineID=%s,quickFightPower=%s,quickNeedFightPower=%s > %s"
                               % (mapID, lineID, quickFightPower, quickNeedFightPower, curFightPower), playerID)
            PlayerControl.NotifyCode(curPlayer, 'TaskFeedback4')
            return
        
@@ -203,6 +144,6 @@
        FBCommon.AddEnterFBCount(curPlayer, mapID, quickCnt)
        
    #扫荡结果给奖励等
    FBLogic.OnPlayerFBQuickPassResult(curPlayer, mapID, lineID)
    FBLogic.OnPlayerFBQuickPassResult(curPlayer, mapID, lineID, quickData)
    return