| | |
| | | # 今日已膜拜记录 {tagPlayerID:[[膜拜类型, 膜拜值], ...], ...}
|
| | | # 今日是否已膜拜过该玩家某个膜拜
|
| | | def HasWorshipRecordToday(recData, tagPlayerID, worshipType, worshipValue):
|
| | | if not recData:
|
| | | return False
|
| | | worshipRecordList = recData.GetUserDataByKey(tagPlayerID, [])
|
| | | if not worshipRecordList:
|
| | | return False
|
| | |
| | | return
|
| | | ##--------------------------------------------------------------------------------------------------
|
| | | def OnServerStart():
|
| | | ## 修改了膜拜UserData的存储内容及格式,需要对老数据进行处理
|
| | | # 因为活动类的活动结束后无法根据分区ID识别是否可膜拜,故改为同仙宫一样指定可膜拜的服务器ID列表
|
| | | |
| | | isCrossServer = GameWorld.IsCrossServer()
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | recDict = playerRecMgr.GetPlayerRecDataDict(ShareDefine.Def_PlayerRecType_WorshipPlayer)
|
| | | for recDataList in recDict.values():
|
| | | for recData in recDataList:
|
| | | playerID = recData.GetPlayerID()
|
| | | worshipType = GetWorshipType(recData)
|
| | | worshipValue = GetWorshipValue(recData)
|
| | | if isCrossServer:
|
| | | if worshipType != ShareDefine.Def_WorshipType_CrossChampionship:
|
| | | # 跨服服务器只修正跨服排位膜拜
|
| | | continue
|
| | | else:
|
| | | if worshipType != ShareDefine.Def_WorshipType_ServerNaming:
|
| | | # 子服服务器只修正服务器冠名膜拜
|
| | | continue
|
| | | |
| | | userData = recData.GetUserData()
|
| | | try:
|
| | | userDataOld = eval(userData)
|
| | | except:
|
| | | userDataOld = {}
|
| | | |
| | | if ChConfig.Def_RecDataKey_PlayerInfo in userDataOld:
|
| | | GameWorld.Log("该膜拜数据已经被修正过了! worshipType=%s,worshipValue=%s" % (worshipType, worshipValue), playerID)
|
| | | continue
|
| | | |
| | | recData.SetUserData({})
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, userDataOld)
|
| | | |
| | | if worshipType == ShareDefine.Def_WorshipType_CrossChampionship:
|
| | | zoneID = recData.GetValue4()
|
| | | zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID)
|
| | | serverIDRangeList = zoneIpyData.GetServerGroupIDList() if zoneIpyData else []
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList, serverIDRangeList)
|
| | | |
| | | userDataNew = recData.GetUserData()
|
| | | GameWorld.Log("修正膜拜数据! worshipType=%s,worshipValue=%s,userData=%s,userDataNew=%s" |
| | | % (worshipType, worshipValue, userData, userDataNew), playerID)
|
| | | return
|
| | |
|
| | | def GetPlayerViewInfo(playerID):
|
| | |
| | | GameWorld.DebugLog("膜拜: tagPlayerID=%s,worshipType=%s,worshipValue=%s,moneyType=%s,moneyValue=%s"
|
| | | % (tagPlayerID, worshipType, worshipValue, moneyType, moneyValue), playerID)
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID)
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID, True)
|
| | | SetWorshipRecordToday(worshipRecData, tagPlayerID, worshipType, worshipValue)
|
| | |
|
| | | __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 0, moneyType, moneyValue)
|
| | |
| | | return
|
| | |
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID)
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID, False)
|
| | | if HasWorshipRecordToday(worshipRecData, recPlayerID, worshipType, worshipValue):
|
| | | GameWorld.DebugLog("今日已膜拜过! recPlayerID=%s,worshipType=%s, worshipValue=%s" % (recPlayerID, worshipType, worshipValue), playerID)
|
| | | return
|