hch
2019-04-19 f3fd1d3c52fc2c3c49254db83a8fba108f3acc8b
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -14,12 +14,43 @@
#-------------------------------------------------------------------------------
#"""Version = 2019-04-15 16:30"""
#-------------------------------------------------------------------------------
import GameWorld
import GameWorldProcess
import PlayerFairyDomain
import NPCCustomRefresh
import IpyGameDataPY
import PyGameData
import NPCCommon
import PlayerControl
import ChConfig
def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
    ## 草园重置
    resetCollectType = 10 + eventType
    NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType])
    # 宝箱怪次数重置
    if eventType == PlayerFairyDomain.FDEventType_GrasslandXian:
        npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
        if npcID:
            NPCCommon.UpdateNPCAttackCount(curPlayer, [npcID], 0)
    return
def __SetGrasslandVisitState(curPlayer, mapID, lineID, state):
    ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
    if not ipyData:
        return False
    eventID = ipyData.GetID()
    if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, eventID, state):
        return False
    return True
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
    if not __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting):
        return False
    return True
## 开启副本
@@ -52,7 +83,6 @@
## 副本总逻辑计时器
def OnProcess(tick):
    #gameFB = GameWorld.GetGameFB()
    return
## 关闭副本
@@ -82,4 +112,60 @@
        
    return
## 客户端进入自定义场景
def OnEnterCustomScene(curPlayer, mapID, lineID):
    __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
    return
def DoCheckUpdateGrasslandEnd(curPlayer):
    ## 检查更新草园已拜访完成
    grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
    clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
    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)
    else:
        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 == ChConfig.Def_FBMapID_CrossGrasslandXian:
        boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
        boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
        if not boxNPCIpyData:
            return
        attackCountDropWeightInfo = boxNPCIpyData.GetAttackCountDropWeightInfo()
        if not attackCountDropWeightInfo:
            return
        maxAttackCount = max(attackCountDropWeightInfo)
        attackCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % boxNPCID)
        if attackCount < maxAttackCount:
            GameWorld.DebugLog("草园宝箱怪攻击次数未用完! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount))
            return
    __SetGrasslandVisitState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
    GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
    return