| | |
| | | npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | if npcID:
|
| | | NPCCommon.UpdateNPCAttackCount(curPlayer, npcID, 0)
|
| | | |
| | | |
| | | ResetGrasslandAwardRecord(curPlayer) |
| | | return
|
| | |
|
| | | ## 是否需要做进入副本通用检查条件逻辑,默认需要检查
|
| | |
| | |
|
| | | ## 客户端进入自定义场景
|
| | | def OnEnterCustomScene(curPlayer, mapID, lineID):
|
| | | 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)
|
| | | |
| | | if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
|
| | | FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
|
| | | |
| | | SyncCustomSceneNPCCount(curPlayer, mapID)
|
| | | if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
|
| | | boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | if boxNPCID:
|
| | | NPCCommon.SyncNPCAttackCount(curPlayer, [boxNPCID])
|
| | | |
| | | return
|
| | |
|
| | | def DoCheckUpdateGrasslandEnd(curPlayer):
|
| | | ## 检查更新草园已拜访完成
|
| | | def DecCustomSceneNPCCount(curPlayer, npcID):
|
| | | ## 减少草园自定义场景NPC,默认减少一个
|
| | | mapID = GetGrasslandMapID(curPlayer)[0]
|
| | | 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)
|
| | | return
|
| | |
|
| | | def SyncCustomSceneNPCCount(curPlayer, mapID):
|
| | | ## 通知自定义场景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)
|
| | | if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
|
| | | boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
|
| | | npcCountDict[boxNPCID] = 1
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCountDict)
|
| | | return
|
| | |
|
| | | def RecordGrasslandAward(curPlayer, addItemList):
|
| | | ## 记录草园奖励信息
|
| | | mapID = GetGrasslandMapID(curPlayer)[0]
|
| | | if not mapID:
|
| | | return
|
| | |
|
| | | for itemInfo in addItemList:
|
| | | if not isinstance(itemInfo, list):
|
| | | continue
|
| | | itemID, itemCount = itemInfo[:2]
|
| | | |
| | | newIndex = None
|
| | | for i in xrange(20):
|
| | | itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
|
| | | if not itemCountInfo:
|
| | | newIndex = i
|
| | | break
|
| | | recItemID = itemCountInfo/100
|
| | | if recItemID == itemID:
|
| | | updRecValue = itemCountInfo + itemCount
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % i, updRecValue)
|
| | | break
|
| | | if newIndex != None:
|
| | | newRecValue = itemID*100 + itemCount
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % newIndex, newRecValue)
|
| | | |
| | | return
|
| | |
|
| | | def ResetGrasslandAwardRecord(curPlayer):
|
| | | ## 重置草园奖励信息记录
|
| | | for i in xrange(20):
|
| | | itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
|
| | | if not itemCountInfo:
|
| | | break
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % i, 0)
|
| | | return
|
| | |
|
| | | |
| | | def GetGrasslandMapID(curPlayer):
|
| | | grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
|
| | | crossMapID = PlayerControl.GetCrossMapID(curPlayer)
|
| | | clientCustomSceneMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneMapID)
|
| | |
| | | mapID = clientCustomSceneMapID
|
| | | lineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneLineID)
|
| | | else:
|
| | | return 0, 0
|
| | | return mapID, lineID
|
| | |
|
| | | def DoCheckUpdateGrasslandEnd(curPlayer):
|
| | | ## 检查更新草园已拜访完成
|
| | | |
| | | mapID, lineID = GetGrasslandMapID(curPlayer)
|
| | | if not mapID:
|
| | | return
|
| | |
|
| | | # 采集次数是否已用完
|
| | |
| | |
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
|
| | | |
| | | # 通知结算
|
| | | awardItemList = []
|
| | | for i in xrange(20):
|
| | | itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
|
| | | if not itemCountInfo:
|
| | | break
|
| | | isAuctionItem = 0
|
| | | itemID, itemCount = itemCountInfo/100, itemCountInfo%100
|
| | | awardItemList.append([itemID, itemCount, isAuctionItem])
|
| | | overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(awardItemList)}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, 1, overDict)
|
| | | ResetGrasslandAwardRecord(curPlayer)
|
| | | return
|
| | |
|
| | | def DoFB_NPCDead(curNPC):
|
| | |
| | | GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | |
|