| | |
| | | # @return
|
| | | def SetFBPropertyMark(propertyMark, setPlayer=None):
|
| | | GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_FBDict_PropertyMark, propertyMark + 1) # 存储时+1才能判断是否存储过
|
| | | if setPlayer != None:
|
| | | PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
|
| | | GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | if not curPlayer.GetPlayerID():
|
| | | continue
|
| | | PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
|
| | | GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
|
| | | # if setPlayer != None:
|
| | | # PlayerControl.SetFBFuncLineID(setPlayer, propertyMark)
|
| | | # GameWorld.DebugLog("SetFBPropertyMark 设置玩家副本功能线路ID: %s" % propertyMark, setPlayer.GetPlayerID())
|
| | | # return
|
| | | # |
| | | # playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | # for index in xrange(playerManager.GetPlayerCount()):
|
| | | # curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | # if not curPlayer.GetPlayerID():
|
| | | # continue
|
| | | # PlayerControl.SetFBFuncLineID(curPlayer, propertyMark)
|
| | | # GameWorld.DebugLog("SetFBPropertyMark 广播玩家副本功能线路ID: %s" % propertyMark, curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | ## 是否已经扣除入场券/进入次数等
|
| | |
| | | # @return
|
| | | def SetHadDelTicket(curPlayer, delSign=1):
|
| | | GameWorld.GetGameFB().SetPlayerGameFBDict(curPlayer.GetID(), ChConfig.FBPlayerDict_IsDelTicket, delSign)
|
| | | return
|
| | |
|
| | | ## 自定义场景阶段
|
| | | def GetCustomMapStep(curPlayer, mapID, lineID):
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_CustomMapStep % (mapID, lineID))
|
| | | def SetCustomMapStep(curPlayer, mapID, lineID, step):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_CustomMapStep % (mapID, lineID), step)
|
| | | if step == ChConfig.CustomMapStep_Over:
|
| | | PlayerControl.SetCustomMap(curPlayer, 0, 0)
|
| | | return
|
| | |
|
| | | def GetCurSingleFBPlayer():
|
| | |
| | | #可以进入
|
| | | return True
|
| | | #---------------------------------------------------------------------
|
| | | def Sync_FBNPC(mapID=0, npcIDList=[], curPlayer=None):
|
| | | ## 同步当前副本NPC给副本中的所有玩家
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = GetRecordMapID(mapID)
|
| | | npcCntDict = {}
|
| | | gameNPCManager = GameWorld.GetNPCManager()
|
| | | for index in xrange(gameNPCManager.GetNPCCount()):
|
| | | curNPC = gameNPCManager.GetNPCByIndex(index)
|
| | | npcID = curNPC.GetNPCID()
|
| | | if not npcID:
|
| | | continue
|
| | | if curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
|
| | | continue
|
| | | if npcIDList and npcID not in npcIDList:
|
| | | continue
|
| | | npcCntDict[npcID] = npcCntDict.get(npcID, 0) + 1
|
| | | |
| | | if curPlayer:
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
|
| | | else:
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | | if curPlayer.GetID() == 0:
|
| | | continue
|
| | | NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcCntDict)
|
| | | return npcCntDict
|
| | |
|
| | | ##获得地图上的NPC列表
|
| | | # @param 无参数
|
| | | # @return 返回值, NPC实例列表[curNPC,curNPC,,,,,]
|
| | |
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | maxCanAdd = max(0, maxDayTimes - (maxCnt-enterCnt))
|
| | | #GameWorld.DebugLog('封魔坛最大可恢复次数 %s'%maxCanAdd)
|
| | | if not maxCanAdd:
|
| | | return
|
| | |
|
| | | curTime = int(time.time())
|
| | | recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | |
| | | passTime = curTime - lastRegainTime
|
| | | if passTime < needTime:
|
| | | return
|
| | | recoverCnt = min(maxCanAdd, 1 + (passTime-needTime) / recoverInterval) # 恢复次数
|
| | | recoverCnt = 1 + (passTime-needTime) / recoverInterval # 恢复次数
|
| | | if recoverCnt > maxCanAdd:
|
| | | #记录超出的次数,用于资源找回
|
| | | beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID)
|
| | | updBeyondTimes = recoverCnt - maxCanAdd + beyondTimes
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, updBeyondTimes)
|
| | | if not maxCanAdd:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | GameWorld.DebugLog(' 封魔坛恢复次数 记录超出的次数addOverCnt=%s, updBeyondTimes=%s'%(recoverCnt-maxCanAdd, updBeyondTimes))
|
| | | |
| | | if not maxCanAdd:
|
| | | return
|
| | | recoverCnt = min(maxCanAdd, recoverCnt)
|
| | | |
| | | enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % mapID
|
| | | newEnterCnt = max(0, enterCnt-recoverCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
|
| | | if recoverCnt == maxCanAdd:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | else:
|
| | | startTime = curTime- (passTime-needTime)%recoverInterval
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, startTime)
|
| | |
| | | if mapID in [ChConfig.Def_FBMapID_SealDemon]:
|
| | | newEnterCnt = max(0, dayTimes - (maxCnt - enterCnt))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, 0)
|
| | | GameWorld.DebugLog(" 特殊副本已进入次数更新: newEnterCnt=%s" % newEnterCnt)
|
| | | elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
|
| | |
| | | def AddFbEncourageBuff(curPlayer, key, tick, ownerID=0):
|
| | | curPlayerID = curPlayer.GetID()
|
| | | GameWorld.Log("AddFbEncourageBuff() curPlayerID=%s" % curPlayerID)
|
| | | |
| | | ownerID = ownerID or curPlayer.GetID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
|
| | | if not encourageLV:
|