ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
@@ -22,6 +22,7 @@
import PlayerControl
import IPY_GameWorld
import IpyGameDataPY
import PyGameData
import GameWorld
import FBCommon
import FBLogic
@@ -63,7 +64,7 @@
def __ProcessNPCRefresh(pointIndex, npcRefresh, tick):
    funcName = "NPCRefresh_%d" % npcRefresh.GetRefreshMark()
    
    if globals().has_key(funcName):
    if globals().has_key(funcName) and GameWorld.GetMap().GetMapID() != ChConfig.Def_FBMapID_ClearDevil:
        return globals()[funcName](npcRefresh, tick)
    else:
        #GameWorld.DebugLog("__NPCCommonRefresh mark = %s" % npcRefresh.GetRefreshMark())
@@ -315,31 +316,6 @@
def NPCRefresh_219(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
def NPCRefresh_220(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
def ResetActivityBossRefreshCount():
    ## 重置活动boss刷怪个数
    # gameFb 要取活动线
    activityLineIndex = 0 # 活动线, 默认1线
    mapID = GameWorld.GetMap().GetMapID()
    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
    if mapID in activityMapLineDict:
        activityLineIndex = max(0, activityMapLineDict[mapID] - 1)
    gameWorld = IPY_GameWorld.IPY_GameWorld(activityLineIndex)
    gameFB = gameWorld.GetGameFBByFbIndex(activityLineIndex)
    if not gameFB:
        return
    gameNPC = GameWorld.GetNPCManager() # NPC标识点的无所谓,哪条线都可以,因为都一样
    for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
        npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
        refreshMark = npcRefresh.GetRefreshMark()
        if gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark):
            gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, 0)
            GameWorld.DebugLog("重置活动boss刷怪点刷怪个数: activityLineIndex=%s,refreshMark=%s" % (activityLineIndex, refreshMark))
    return
## 世界boss刷怪
#  @param npcRefresh 刷新实例
#  @param tick 当前时间
@@ -351,10 +327,12 @@
    if GameWorld.IsCrossServer():
        __DoRefreshWorldBossCrossServer(npcRefresh, tick)
        return
    rebornLineID = 0
    assignLineID = 0
    mapID = GameWorld.GetMap().GetMapID()
    refreshMark = npcRefresh.GetRefreshMark()
    lineID = GameWorld.GetGameWorld().GetLineID()
    relatedType, relatedID = 0, 0
    relatedType, relatedID = 0, ""
    isNeedShunt = 0
    if mapID == ChConfig.Def_FBMapID_SealDemon:
        bossID = GameLogic_SealDemon.CurFBLineBOSSID()
@@ -366,7 +344,20 @@
        bossID = GameLogic_ZhuXianBoss.CurFBLineBOSSID()
        stoneNPCID = 0
    else:
        ipyData = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, isLogNone=False)
        ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, True, isLogNone=False)
        if not ipyDataList:
            return
        if len(ipyDataList) == 1:
            ipyData = ipyDataList[0]
        else:
            # 同地图同标试点有多条数据的则为不同指定分线
            ipyData = None
            for ipyD in ipyDataList:
                refreshLine = ipyD.GetRefreshLine()
                rebornLineID = refreshLine - 1
                if rebornLineID == lineID:
                    ipyData = ipyD
                    break
        if not ipyData:
            return
        stoneNPCID = ipyData.GetStoneNPCID()
@@ -374,36 +365,59 @@
        relatedType = ipyData.GetRelatedType()
        relatedID = ipyData.GetRelatedID()
        isNeedShunt = ipyData.GetIsNeedShunt()
        assignLineID = ipyData.GetRefreshLine() # 指定刷新的线路
        if assignLineID > 0:
            rebornLineID = assignLineID - 1
    if not bossID and not stoneNPCID:
        return
    gameFB = GameWorld.GetGameFB()
    gameWorldMgr = GameWorld.GetGameWorld()
    isActivityBoss = False # 是否活动boss
    forceReborn = False # 强制重生
    actBossRebornSign = 0
    mapActBossRebornSign = 0
    # 关联日常活动
    if relatedType == 1:
        relatedID = int(relatedID)
        actionKey = ShareDefine.Def_Notify_WorldKey_DailyActionState % relatedID
        rebornBossState = 1 if gameWorldMgr.GetGameWorldDictByKey(actionKey) else 0
        isActivityBoss = True
    # 关联运营活动,待扩展
    elif relatedType == 2:
        pass
        actNameInfo = relatedID.split("|")
        actName = actNameInfo[0]
        if actName in ShareDefine.MultiActNumOperationActNameList:
            actNum = GameWorld.ToIntDef(actNameInfo[1] if len(actNameInfo) > 1 else "10")
            actInfo = GameWorld.GetActInfo(actName, actNum)
            operationActionState = actInfo.get(ShareDefine.ActKey_State, 0)
        else:
            operationActionInfo = PyGameData.g_operationActionDict.get(actName, {})
            operationActionState = operationActionInfo.get(ShareDefine.ActKey_State, 0)
        rebornBossState = 1 if operationActionState else 0
    else:
        bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
        rebornBossState = gameWorldMgr.GetGameWorldDictByKey(bosskey)
        
    rebornLineID = 0
    activityLineID = 0 # 活动线, 默认1线
    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
    if mapID in activityMapLineDict:
        activityLineID = max(0, activityMapLineDict[mapID] - 1)
        
    # 活动boss只在活动线路刷
    if isActivityBoss:
        activityBossRebornCount = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark)
        rebornLineID = activityLineID # 活动boss只刷在活动线
    # 关联活动boss
    if relatedType:
        if assignLineID == 0: # 没有指定刷新线路的,活动boss固定刷在活动线
            rebornLineID = activityLineID # 活动boss只刷在活动线
        # 不是活动线 
        if rebornBossState and lineID != rebornLineID:
            rebornBossState = 0
        # 关联活动boss只要复活标记与上次不同,则强制重生
        actBossRebornSign = gameWorldMgr.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % relatedID)
        mapActBossRebornSign = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark)
        rebornBossState = rebornBossState and actBossRebornSign
        if rebornBossState and actBossRebornSign != mapActBossRebornSign:
            forceReborn = True
            
    # 非活动boss活动线不刷, 1线除外
    else:
@@ -420,7 +434,7 @@
    # 复活状态
    if rebornBossState:
        if curNPC:
            if curNPC.GetNPCID() == bossID:
            if not forceReborn and curNPC.GetNPCID() == bossID:
                return
            #去掉非bossNPC
            NPCCommon.SetDeadEx(curNPC)
@@ -429,9 +443,9 @@
        if lineID != rebornLineID and not isNeedShunt and mapID not in [ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
            return
        
        if isActivityBoss and activityBossRebornCount > 0:
            #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,activityBossRebornCount=%s"
            #                   % (lineID, rebornLineID, refreshMark, bossID, activityBossRebornCount))
        if mapActBossRebornSign and actBossRebornSign == mapActBossRebornSign:
            #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,actBossRebornSign=%s"
            #                   % (lineID, rebornLineID, refreshMark, bossID, actBossRebornSign))
            return
        
    # 死亡状态
@@ -443,9 +457,12 @@
            if curNPC.GetNPCID() == stoneNPCID:
                return 
            # 活动的boss
            if curNPC.GetNPCID() == bossID and isActivityBoss:
            if curNPC.GetNPCID() == bossID and relatedType:
                GameWorld.Log("活动boss,活动结束,系统设置boss死亡!bossID=%s" % bossID)
                PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
                if relatedID == ShareDefine.DailyActionID_FamilyRobBoss:
                    PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
                elif relatedID == ShareDefine.OperationActionName_BossReborn:
                    pass
                
            #去掉非墓碑NPC
            NPCCommon.SetDeadEx(curNPC)
@@ -472,8 +489,8 @@
    __InitNewBornNPC(npcRefresh, tick)
    gameFB.SetGameFBDict(key, tick)
    
    if isActivityBoss and rebornBossState:
        gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, activityBossRebornCount + 1)
    if actBossRebornSign and rebornBossState:
        gameFB.SetGameFBDict(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark, actBossRebornSign)
        
    GameWorld.DebugLog("BossRefresh mapID=%s,rebornLineID=%s,refreshMark=%s,rebornNPCID=%s,isNeedShunt=%s,OK!" 
                       % (mapID, rebornLineID, refreshMark, rebornNPCID, isNeedShunt), lineID)