| | |
| | | import IpyGameDataPY
|
| | | import PlayerActivity
|
| | | import ItemControler
|
| | | import PyGameData
|
| | | import EventShell
|
| | |
|
| | | import copy
|
| | |
| | | def OnLogin(curPlayer):
|
| | | NotifyVisitFairyDomainInfo(curPlayer)
|
| | | NotifyFairyAdventuresInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def OnHour(curPlayer):
|
| | | __ResetFairyDomainCntLimit(curPlayer, 1)
|
| | | return
|
| | |
|
| | |
|
| | | def OnDay(curPlayer):
|
| | | __ResetFairyDomainCntLimit(curPlayer, 2)
|
| | | return
|
| | |
|
| | |
|
| | | def __ResetFairyDomainCntLimit(curPlayer, resetType):
|
| | | ## 重置个人缥缈事件出现次数记录
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyMgr.GetFairyDomainCount()):
|
| | | ipyData = ipyMgr.GetFairyDomainByIndex(i)
|
| | | eventID = ipyData.GetID()
|
| | | appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID)
|
| | | if not appearCntInfo:
|
| | | continue
|
| | | hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
|
| | | if resetType == 1:
|
| | | updAppearCntInfo = dayAppearCntPri * 1000
|
| | | elif resetType == 2:
|
| | | updAppearCntInfo = hourAppearCntPri
|
| | | else:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID, updAppearCntInfo)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | if not randomList:
|
| | | continue
|
| | | fdEventIDList += randomList
|
| | | |
| | | #更新个人出现次数
|
| | | for fdEventID in fdEventIDList:
|
| | | appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % fdEventID)
|
| | | hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
|
| | | updAppearCntInfo = (dayAppearCntPri + 1) * 1000 + (hourAppearCntPri + 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventAppearCnt % fdEventID, updAppearCntInfo)
|
| | | #更新全服出现次数
|
| | | msgStr = str(fdEventIDList)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddFairyDomainEvent', msgStr, len(msgStr))
|
| | | #奇遇事件 随机档位数据
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
|
| | | for fdEventID in fdEventIDList:
|
| | |
| | | NotifyFairyAdventuresInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def EndFairyDomain(curPlayer):
|
| | | ##结束寻访
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 0)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainEventState % fdEventID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, 0)
|
| | | return
|
| | |
|
| | |
|
| | | def __RandomFDEventByType(curPlayer, eventType, cnt):
|
| | | ##根据事件类型随机事件
|
| | |
| | | if lvLimit and not (lvLimit[0] <= curLV <= lvLimit[1]):
|
| | | #等级范围不满足
|
| | | continue
|
| | | |
| | | eventID = ipyData.GetID()
|
| | | appearCntInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventAppearCnt % eventID)
|
| | | hourAppearCntPri, dayAppearCntPri = appearCntInfo % 1000, appearCntInfo / 1000
|
| | | if hourAppearCntPri >= ipyData.GetHourCntPriLimit() or dayAppearCntPri >= ipyData.GetDayCntPriLimit():
|
| | | #超过今日或本小时个人可出现次数上限
|
| | | continue
|
| | | if eventID in PyGameData.g_fairyDomainLimit:
|
| | | #超过全服可出现次数
|
| | | continue
|
| | | rate += ipyData.GetWeight()
|
| | | randomRateList.append([rate, ipyData.GetID()])
|
| | | if not randomRateList:
|
| | | GameWorld.DebugLog(' 缥缈仙域刷新池 随机库获取错误 !eventType=%s' % eventType, curPlayer.GetID())
|
| | | GameWorld.DebugLog(' 缥缈仙域刷新池 该类型没有符合条件的事件!eventType=%s' % eventType, curPlayer.GetID())
|
| | | return []
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, cnt, [])
|
| | | |
| | | realCnt = min(len(randomRateList), cnt)
|
| | | randomResultList = GameWorld.GetResultByRandomListEx(randomRateList, realCnt, [])
|
| | | GameWorld.DebugLog('eventType=%s, cnt=%s,randomRateList=%s,randomResultList=%s' % (eventType, cnt, randomRateList, randomResultList))
|
| | | return randomResultList
|
| | |
|
| | |
|
| | | def GetFairyDomainFBEventState(curPlayer, mapID, lineID):
|
| | | ## 获取缥缈相关副本寻访状态
|
| | |
| | | curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FairyDomainEventState % fdeventID)
|
| | | return curState
|
| | |
|
| | |
|
| | | def SetFairyDomainFBEventState(curPlayer, mapID, lineID, state):
|
| | | ## 设置缥缈相关副本寻访状态
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | |
| | | fdeventID = ipyData.GetID()
|
| | | return SetFairyDomainEventState(curPlayer, fdeventID, state)
|
| | |
|
| | |
|
| | | def SetFairyDomainEventState(curPlayer, fdeventID, state):
|
| | | ## 设置缥缈事件状态, return 是否成功
|
| | | if state not in [FDEventState_Visiting, FDEventState_Visited]: # 1-未拜访 2-拜访中 3-已拜访
|