| | |
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import FBCommon
|
| | | import EventShell
|
| | | import NPCCommon
|
| | | import PyGameData
|
| | | import PlayerAssist
|
| | | import GameWorldProcess
|
| | | import NPCCustomRefresh
|
| | | import IpyGameDataPY
|
| | | import ItemControler
|
| | | import GameWorldProcess
|
| | | import PlayerFairyDomain
|
| | | import NPCCustomRefresh
|
| | | import IPY_GameWorld
|
| | | import ItemCommon
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | |
| | | if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
|
| | | return True
|
| | |
|
| | | taskID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PiaomiaoMaxGradeTaskID)
|
| | | curMission = curPlayer.FindMission(taskID)
|
| | | if curMission == None:
|
| | | GameWorld.DebugLog("没有该副本任务,无法进入!taskID=%s" % taskID)
|
| | | return False
|
| | | missionState = curMission.GetMissionState()
|
| | | if missionState != IPY_GameWorld.msProcessing:
|
| | | GameWorld.DebugLog("该副本任务非进行中,无法进入!taskID=%s,missionState=%s" % (taskID, missionState))
|
| | | return False
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | if not ipyData:
|
| | | return
|
| | | fdeventID = ipyData.GetID()
|
| | | if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visiting):
|
| | | GameWorld.DebugLog("设置事件寻访中失败,可能没有该事件! fdeventID=%s" % fdeventID)
|
| | | return
|
| | |
|
| | | return True
|
| | |
|
| | |
| | | if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_FightTime] * 1000:
|
| | | return
|
| | |
|
| | | __DoKillDevilOver(False, tick) |
| | | __DoKillDevilOver(tick)
|
| | | return
|
| | |
|
| | | ## 副本关闭
|
| | | def __ProcessCloseFB(tick):
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | fbCfg = FBCommon.GetFBLineStepTime(mapID)
|
| | | closeTime = ChConfig.Def_FBPickupItemTime + fbCfg[Def_ExitTime] * 1000
|
| | | # 间隔未到
|
| | | if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_ExitTime] * 1000:
|
| | | if tick - GameWorld.GetGameFB().GetFBStepTick() < closeTime:
|
| | | return
|
| | |
|
| | | GameWorldProcess.CloseFB(tick)
|
| | |
| | | gameFB.SetGameFBDict(FBDict_KillNPCCount % npcID, gameFB.GetGameFBDictByKey(FBDict_KillNPCCount % npcID) + 1)
|
| | | FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
|
| | |
|
| | | __DoKillDevilOver(True, tick)
|
| | | __DoKillDevilOver(tick, curNPC)
|
| | | return
|
| | |
|
| | | def __DoKillDevilOver(isPass, tick):
|
| | | def __DoKillDevilOver(tick, curNPC=None):
|
| | | # 战斗超时
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | if gameFB.GetFBStep() == FB_Step_Over:
|
| | | return
|
| | | FBCommon.SetFBStep(FB_Step_Over, tick)
|
| | |
|
| | | isPass = curNPC != None
|
| | | lineID = 0
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | fdeventID = ipyData.GetID()
|
| | | GameWorld.DebugLog("副本结算: isPass=%s" % (isPass))
|
| | | |
| | | noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict = PlayerAssist.OnFBAssistOver(isPass, mapID)
|
| | | exitTime = FBCommon.GetFBLineStepTime(mapID)[Def_ExitTime] * 1000
|
| | | rewardInfo = FBCommon.GetFBLineReward(mapID, 0)
|
| | | noAssistItemList, assistItemList = ([], []) if not rewardInfo else rewardInfo
|
| | | assistItemList = [] if not rewardInfo else rewardInfo
|
| | |
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | playerCount = playerManager.GetPlayerCount()
|
| | |
| | | continue
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | overDict = {FBCommon.Over_dataMapID:mapID, FBCommon.Over_isPass: int(isPass)}
|
| | | overDict = {}
|
| | | if isPass and noAssistPlayerID:
|
| | | itemList = []
|
| | | if playerID == noAssistPlayerID:
|
| | | itemList = noAssistItemList
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "fb_pass_%s" % mapID)
|
| | | |
| | | bossID = curNPC.GetNPCID()
|
| | | dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
|
| | | isOnlySelfSee = False
|
| | | isDropDisperse = True
|
| | | dropItemMapInfo = [dropPosX, dropPosY, isOnlySelfSee, isDropDisperse]
|
| | | jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, {bossID:1}, dropItemMapInfo=dropItemMapInfo)
|
| | | if not jsonItemList:
|
| | | # 没有掉落时直接通知结算,防止卡副本
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, exitTime, True)
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | else:
|
| | | PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
|
| | | curPlayer.Sync_TimeTick(ChConfig.tttPickupItem, 0, ChConfig.Def_FBPickupItemTime, True)
|
| | | continue
|
| | | |
| | | elif playerID in assistPlayerMoneyDict:
|
| | | addAssistMoney = assistPlayerMoneyDict[playerID]
|
| | | itemList = assistItemList
|
| | | overDict.update({FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney})})
|
| | | overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(itemList)
|
| | | overDict.update({FBCommon.Over_isAssist:1, FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(assistItemList),
|
| | | FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney})})
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, assistItemList)
|
| | |
|
| | | if itemList:
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, itemList)
|
| | | |
| | | GameWorld.DebugLog("overDict=%s" % overDict, playerID)
|
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | else:
|
| | | pass
|
| | | |
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, exitTime, True)
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | |
|
| | | return
|
| | |
|
| | | def OnPickUpItem(curPlayer, curItem, tick):
|
| | | mapItemType = curItem.GetType()
|
| | | if mapItemType == ChConfig.Def_ItemType_Money:
|
| | | return
|
| | | playerID = curPlayer.GetID()
|
| | | isEquip = ItemCommon.CheckItemIsEquip(curItem)
|
| | | jsonItem = ItemCommon.GetJsonItem(curItem)
|
| | | if playerID in PyGameData.g_fbPickUpItemDict:
|
| | | if isEquip:
|
| | | PyGameData.g_fbPickUpItemDict[playerID].append(jsonItem)
|
| | | else:
|
| | | isIn = False
|
| | | for itemInfo in PyGameData.g_fbPickUpItemDict[playerID]:
|
| | | if itemInfo["ItemID"] == jsonItem["ItemID"] and itemInfo.get("IsBind") == jsonItem.get("IsBind"):
|
| | | itemInfo["Count"] = itemInfo.get("Count", 1) + jsonItem.get("Count", 1)
|
| | | isIn = True
|
| | | break
|
| | | if not isIn:
|
| | | PyGameData.g_fbPickUpItemDict[playerID].append(jsonItem)
|
| | | else:
|
| | | PyGameData.g_fbPickUpItemDict[playerID] = [jsonItem]
|
| | | |
| | | playerItemCount = 0
|
| | | mapItemManager = GameWorld.GetMapItemManager()
|
| | | for index in xrange(mapItemManager.GetMapItemCount()):
|
| | | mapItem = mapItemManager.GetMapItemByIndex(index)
|
| | | if not mapItem or mapItem.IsEmpty():
|
| | | continue
|
| | | |
| | | # 还有属于自己的东西没捡不通知结束
|
| | | if mapItem.GetOwnerID() == curPlayer.GetPlayerID():
|
| | | playerItemCount += 1
|
| | | |
| | | isItemAllPickUp = (playerItemCount <= 1)
|
| | | if not isItemAllPickUp:
|
| | | return
|
| | | |
| | | isPass = 1
|
| | | lineID = 0
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | leaveTick = FBCommon.GetFBLineStepTime(mapID)[Def_ExitTime] * 1000
|
| | | jsonItemList = PyGameData.g_fbPickUpItemDict.get(playerID, [])
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
|
| | | overDict = {FBCommon.Over_itemInfo:jsonItemList}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | | ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
|
| | | def CheckCanAttackTagObjInFB(attacker, defender):
|
| | | return GameWorld.GetGameFB().GetFBStep() == FB_Step_Fight
|