| | |
| | | import ChConfig
|
| | | import FBCommon
|
| | | import ItemControler
|
| | | import random
|
| | |
|
| | | FBDict_SyncFBNPC = 'SyncFBNPC' #是否需要同步副本NPC
|
| | |
|
| | |
| | | return
|
| | |
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState not in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]:
|
| | | GameWorld.DebugLog("缥缈无法扫荡! 不存在该事件或无法进入! mapID=%s,lineID=%s,curState=%s" % (mapID, lineID, curState))
|
| | | return False
|
| | | return True
|
| | |
|
| | | ## 扫荡结果
|
| | | def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | |
| | | jsonItemList = []
|
| | | refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
|
| | | npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
|
| | | GameWorld.DebugLog("草园扫荡: mapID=%s,lineID=%s,npcCountDict=%s" % (mapID, lineID, npcCountDict))
|
| | | if npcCountDict:
|
| | | npcIDList = npcCountDict.keys()
|
| | | doCount = sum(npcCountDict.values()) * 2
|
| | | while npcIDList and doCount >= 0:
|
| | | doCount -= 1
|
| | | npcID = random.choice(npcIDList)
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | if not collectNPCIpyData:
|
| | | npcIDList.remove(npcID)
|
| | | continue
|
| | | awardItemInfo = NPCCommon.DoGiveCollectNPCAward(curPlayer, npcID, collectNPCIpyData, isSweep=True)
|
| | | if awardItemInfo == None:
|
| | | npcIDList.remove(npcID)
|
| | | GameWorld.DebugLog(" 扫荡npcID=%s,没有奖励了,移除! npcIDList=%s" % (npcID, npcIDList))
|
| | | continue
|
| | | jsonItemList.extend(awardItemInfo)
|
| | | GameWorld.DebugLog(" npcID=%s,awardItemInfo=%s" % (npcID, awardItemInfo))
|
| | | GameWorld.DebugLog(" 扫荡jsonItemList=%s" % jsonItemList)
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | if ipyData:
|
| | | fdeventID = ipyData.GetID()
|
| | | PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
|
| | | |
| | | isPass = 1
|
| | | overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_isSweep:1}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | |
|