hch
2019-05-29 93813adb387e6f879836d517240e883cefd93b32
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -131,26 +131,18 @@
    curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
    PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
    
    boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
    refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
    refreshCount, npcIDRateList = refreshMapNPCDict.get(mapID, [0, []])
    npcIDList = [rate[1] for rate in npcIDRateList]
    if curState == PlayerFairyDomain.FDEventState_CanVisit:
        # 随机采集物数量
        for npcID in npcIDList:
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, 0)
        npcCountDict = {}
        for _ in xrange(refreshCount):
            npcID = GameWorld.GetResultByRandomList(npcIDRateList)
            if npcID:
                npcCount = npcCountDict.get(npcID, 0) + 1
                npcCountDict[npcID] = npcCount
                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, npcCount)
        refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
        npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
        for npcID, npcCount in npcCountDict.items():
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, npcCount)
        if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
            FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
    SyncCustomSceneNPCCount(curPlayer, mapID)
    else:
        DoCheckUpdateGrasslandEnd(curPlayer)
    SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
        if boxNPCID:
@@ -158,29 +150,39 @@
            
    return
## 自定义场景采集OK,需自带是否允许采集的判断
def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
    curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
    if curState != PlayerFairyDomain.FDEventState_Visiting:
        return False
    curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
    if not curCount:
        return False
    return True
def DecCustomSceneNPCCount(curPlayer, npcID):
    ## 减少草园自定义场景NPC,默认减少一个
    mapID = GetGrasslandMapID(curPlayer)[0]
    mapID, lineID = GetGrasslandMapID(curPlayer)
    if not mapID:
        return
    curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
    updCount = max(0, curCount - 1)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, updCount)
    SyncCustomSceneNPCCount(curPlayer, mapID)
    SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
    return
def SyncCustomSceneNPCCount(curPlayer, mapID):
def SyncCustomSceneNPCCount(curPlayer, mapID, lineID):
    ## 通知自定义场景NPC数
    refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
    npcIDRateList = refreshMapNPCDict.get(mapID, [0, []])[1]
    npcCountDict = {}
    for npcRate in npcIDRateList:
        npcID = npcRate[1]
        npcCountDict[npcID] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
    npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
    npcNowCountDict = {}
    for npcID in npcCountDict.keys():
        npcNowCountDict[npcID] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
        npcCountDict[boxNPCID] = 1
    NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCountDict)
        if boxNPCID:
            npcNowCountDict[boxNPCID] = 1
    NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcNowCountDict)
    return
def RecordGrasslandAward(curPlayer, addItemList):
@@ -224,13 +226,13 @@
def GetGrasslandMapID(curPlayer):
    grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
    clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
    customMapID = PlayerControl.GetCustomMapID(curPlayer)
    if crossMapID in grasslandMapIDList:
        mapID = crossMapID
        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine)
    elif clientCustomSceneMapID in grasslandMapIDList:
        mapID = clientCustomSceneMapID
        lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
    elif customMapID in grasslandMapIDList:
        mapID = customMapID
        lineID = PlayerControl.GetCustomLineID(curPlayer)
    else:
        return 0, 0
    return mapID, lineID
@@ -243,25 +245,32 @@
        return
    
    # 采集次数是否已用完
    collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
    if not collNPCIpyDataList:
        return
    for collIpyData in collNPCIpyDataList:
        npcIDList = collIpyData.GetNPCIDList()
        for npcID in npcIDList:
            collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
            if not collectNPCIpyData:
                return
            limitMaxTime = collectNPCIpyData.GetMaxCollectCount()
            totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID)
            if totalCollTime < limitMaxTime:
                GameWorld.DebugLog("草园NPC采集次数未用完! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime))
                return
    if mapID == PlayerControl.GetCustomMapID(curPlayer):
        refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
        npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
        npcIDList = npcCountDict.keys()
    else:
        collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
        if not collNPCIpyDataList:
            return
        npcIDList = []
        for collIpyData in collNPCIpyDataList:
            npcIDList += collIpyData.GetNPCIDList()
    for npcID in npcIDList:
        collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
        if not collectNPCIpyData:
            return
        limitMaxTime = collectNPCIpyData.GetMaxCollectCount()
        totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID)
        if totalCollTime < limitMaxTime:
            GameWorld.DebugLog("草园NPC采集次数未用完! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime))
            return
            
    # 宝箱怪攻击次数是否已用完
    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
    boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
    if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian and boxNPCID:
        boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
        if not boxNPCIpyData:
            return
@@ -275,6 +284,7 @@
            return
        
    PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
    PlayerControl.SetCustomMap(curPlayer, 0, 0)
    GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
    
    # 通知结算