| | |
| | | #查询无限制家族的行为类型列表
|
| | | Def_QueryNoLimit_ActionTypeList = [ShareDefine.Def_ActionType_OfficerModelEquip]
|
| | | #------------------------------------------------------------------------------
|
| | | #DBPlayerRecData、DBGameRecData表中UserData数据通用自定义key
|
| | | Def_RecDataKey_ServerIDList = "ServerIDList"
|
| | | Def_RecDataKey_PlayerInfo = "PlayerInfo"
|
| | |
|
| | | #玩家记录上线需要直接同步给前端的类型
|
| | | Def_PlayerRecLoginNotifyList = [ShareDefine.Def_PlayerRecType_PayCoin]
|
| | |
| | | playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
| | | worshipType = GameWorld.ToIntDef(gmCmdDict.get('worshipType', ''), 0)
|
| | | worshipValue = GameWorld.ToIntDef(gmCmdDict.get('worshipValue', ''), 0)
|
| | | zoneID = GameWorld.ToIntDef(gmCmdDict.get('zoneID', ''), 0)
|
| | | days = GameWorld.ToIntDef(gmCmdDict.get('days', ''), 0)
|
| | | try:
|
| | | serverIDList = eval(gmCmdDict.get('serverIDList', '[]'))
|
| | | except:
|
| | | GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
|
| | | return
|
| | |
|
| | | opType = gmCmdDict.get('opType', '')
|
| | |
|
| | |
| | | AccID = cacheDict.get("AccID", "")
|
| | |
|
| | | if opType == "add":
|
| | | if not GameWorship.AddWorshipPlayer(tagPlayerID, worshipType, worshipValue, days, zoneID):
|
| | | if not GameWorship.AddWorshipPlayer(worshipType, worshipValue, tagPlayerID, serverIDList, days=days):
|
| | | GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Unknow, "add error.")
|
| | | return
|
| | |
|
| | |
| | | recDict = playerRecMgr.GetPlayerRecDataDict(ShareDefine.Def_PlayerRecType_WorshipPlayer)
|
| | | for recDataList in recDict.values():
|
| | | for recData in recDataList:
|
| | | playerInfo = GameWorship.GetModelShowInfo(recData)
|
| | | playerInfo = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, {})
|
| | | worshipList.append({"PlayerID":recData.GetPlayerID(),
|
| | | "AddTime":GameWorld.ChangeTimeNumToStr(recData.GetTime()),
|
| | | "WorshipType":GameWorship.GetWorshipType(recData),
|
| | | "WorshipValue":GameWorship.GetWorshipValue(recData),
|
| | | "Days":GameWorship.GetWorshipDays(recData),
|
| | | "ZoneID":GameWorship.GetWorshipZoneID(recData),
|
| | | "ServerIDList":str(recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)),
|
| | | "AccID":playerInfo.get("AccID", ""),
|
| | | "Name":playerInfo.get("Name", ""),
|
| | | })
|
| | |
| | | import IpyGameDataPY
|
| | | import PyDataManager
|
| | | import GameXiangong
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | | import time
|
| | |
| | | curTime = int(time.time())
|
| | | for i, recData in enumerate(recDataList[startIndex:startIndex + 20], startIndex):
|
| | | xgPlayerID = GameXiangong.GetXGPlayerID(recData)
|
| | | serverIDList = recData.GetUserDataByKey(GameXiangong.Def_UserDataKey_ServerIDList)
|
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | addTime = recData.GetTime()
|
| | | passDays = GameWorld.GetDiff_Day(curTime, addTime) + 1
|
| | | GameWorld.DebugAnswerCross(playerID, serverGroupID, " %s,ID:%s,天数:%s,区服:%s" % (i, xgPlayerID, passDays, serverIDList))
|
| | |
| | | return 0
|
| | |
|
| | | def CheckServerIDInList(serverID, serverIDList):
|
| | | if serverIDList == None:
|
| | | return False
|
| | | if not serverIDList:
|
| | | return True
|
| | | for serverIDInfo in serverIDList:
|
| | |
| | | pkZoneIDList = champMgr.GetChampPKZoneIDList()
|
| | | GameWorld.Log("pkZoneIDList=%s" % pkZoneIDList)
|
| | |
|
| | | worshipList = []
|
| | | syncNewWorshipList = []
|
| | | syncNewXiangongDict = {}
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | for zoneID in pkZoneIDList:
|
| | | GameWorld.Log("=== 结算排位分区: zoneID=%s ===" % zoneID, zoneID)
|
| | | zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID)
|
| | | serverIDRangeList = zoneIpyData.GetServerGroupIDList() if zoneIpyData else []
|
| | | |
| | | finalPlayerIDList = []
|
| | | pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
|
| | | if not pkZoneMgr:
|
| | |
| | |
|
| | | offZoneMgr.officialInfo[officialID] = offObj
|
| | |
|
| | | worshipValue = rank
|
| | | if GameWorship.GetWorshipIpyData(worshipType, worshipValue):
|
| | | worshipData = GameWorship.AddWorshipPlayer(playerID, worshipType, worshipValue, zoneID=zoneID, isNotify=False)
|
| | | worshipList.append(worshipData)
|
| | | |
| | | |
| | | # 名次奖励
|
| | | paramList = [rank]
|
| | | PlayerCompensation.SendMailByKey("CrossChampionshipPKRank", [playerID], rankAwardItemList, paramList, crossMail=True)
|
| | |
|
| | | if xiangongID:
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID)
|
| | | serverIDRangeList = zoneIpyData.GetServerGroupIDList() if zoneIpyData else []
|
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, rank, syncNewXiangongDict)
|
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, rank, syncNewXiangongDict)
|
| | | GameWorship.AddWorshipPlayer(worshipType, rank, playerID, serverIDRangeList, syncNewWorshipList)
|
| | | |
| | | # 处理4强竞猜发奖励
|
| | | guessType = 4
|
| | | moneyType = ShareDefine.TYPE_Price_GongdePoint
|
| | |
| | | PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "ChampionshipOver")
|
| | |
|
| | | # 通知新添加的膜拜
|
| | | GameWorship.SyncAddCrossWorship(worshipList)
|
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
|
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
|
| | | GameWorld.Log("===================================================================")
|
| | | return
|
| | |
| | | import CommFunc
|
| | |
|
| | | import time
|
| | | import json
|
| | |
|
| | | class GameRecData():
|
| | |
|
| | |
| | | return self.__userDataDict
|
| | | def GetUserDataByKey(self, key, defaultValue=None):
|
| | | userDataDict = self.__GetUserDataDict()
|
| | | return userDataDict.get(str(key), defaultValue)
|
| | | if key in userDataDict:
|
| | | return userDataDict[key]
|
| | | return defaultValue
|
| | | def SetUserDataByKey(self, key, value):
|
| | | userDataDict = self.__GetUserDataDict()
|
| | | userDataDict[str(key)] = value
|
| | | userDataDict[key] = value
|
| | | self.__userDataChange = True
|
| | | return
|
| | | def GetUserData(self):
|
| | | if self.__userDataChange:
|
| | | self.SaveUserData()
|
| | | return self.dbRecData.UserData
|
| | | def SaveUserData(self):
|
| | | userDataDict = self.__GetUserDataDict()
|
| | | self.dbRecData.UserData = json.dumps(userDataDict, ensure_ascii=False).replace(" ", "")
|
| | | def SetUserData(self, userData):
|
| | | ## 支持直接保存任意格式数据,或者按字典方式读取kv值
|
| | | if type(userData) != str:
|
| | | userData = str(userData)
|
| | | self.dbRecData.UserData = userData.replace(" ", "")
|
| | | self.dbRecData.UserDataLen = len(self.dbRecData.UserData)
|
| | | self.__userDataDict = None
|
| | | self.__userDataChange = False
|
| | | return
|
| | | def SaveUserData(self):
|
| | | if self.__userDataChange:
|
| | | self.SetUserData(self.__userDataDict)
|
| | | return
|
| | |
|
| | | def IsMatchValue(self, valueList):
|
| | | # 检查记录值列表是否配置该记录
|
| | |
| | | CrossChampionship.OnServerStart()
|
| | | #跨服战场
|
| | | CrossBattlefield.OnServerStart()
|
| | | GameWorship.OnServerStart()
|
| | | #红包
|
| | | PlayerFamilyRedPacket.OnServerStart()
|
| | | #云购
|
| | |
| | | import NetPackCommon
|
| | | import PlayerControl
|
| | | import ChPyNetSendPack
|
| | | import CrossChampionship
|
| | | import PlayerViewCache
|
| | | import PlayerRecData
|
| | | import CrossRealmMsg
|
| | | import IpyGameDataPY
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | | import time
|
| | |
| | | def SetWorshipValue(recData, worshipValue): recData.SetValue2(worshipValue)
|
| | | def GetWorshipDays(recData): return recData.GetValue3() # 持续天数: 0永久,>0-天数
|
| | | def SetWorshipDays(recData, days): recData.SetValue3(days)
|
| | | def GetWorshipZoneID(recData): return recData.GetValue4() # 膜拜分区,跨服膜拜类型有用
|
| | | def SetWorshipZoneID(recData, zoneID): recData.SetValue4(zoneID)
|
| | | def GetModelShowInfo(recData): return recData.GetEvalUserData({}) # 模型外观显示信息,备用,缓存没有时取这里
|
| | | def SetModelShowInfo(recData, modelShow): return recData.SetEvalUserData(modelShow)
|
| | | def GetPlayerModelShow(playerID):
|
| | | ## 获取膜拜对象的外观显示信息 - 本服跨服通用
|
| | | cacheDict = PlayerViewCache.GetCachePropDataDict(PlayerViewCache.FindViewCache(playerID))
|
| | | if not cacheDict:
|
| | | return {}
|
| | | modelShow = {
|
| | | "Name":cacheDict.get("Name", ""),
|
| | | "AccID":cacheDict.get("AccID", ""),
|
| | | "LV":cacheDict.get("LV", 0),
|
| | | "RealmLV":cacheDict.get("RealmLV", 0),
|
| | | "Job":cacheDict.get("Job", 0),
|
| | | "VIPLV":cacheDict.get("VIPLV", 0),
|
| | | "TitleID":cacheDict.get("TitleID", 0),
|
| | | "FightPower":cacheDict.get("FightPower", 0),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", []),
|
| | | }
|
| | | return modelShow
|
| | |
|
| | | # 玩家每日膜拜记录 RecType = ShareDefine.Def_PlayerRecType_WorshipDaily
|
| | | def GetTodayWorshipRecord(recData): return recData.GetEvalUserData({}) # 今日已膜拜记录 {tagPlayerID:[[膜拜类型, 膜拜值], ...], ...}
|
| | |
|
| | | # 今日已膜拜记录 {tagPlayerID:[[膜拜类型, 膜拜值], ...], ...}
|
| | | # 今日是否已膜拜过该玩家某个膜拜
|
| | | def HasWorshipRecordToday(recData, tagPlayerID, worshipType, worshipValue):
|
| | | worshipRecordList = recData.GetUserDataByKey(tagPlayerID, [])
|
| | | if not worshipRecordList:
|
| | | return False
|
| | | return [worshipType, worshipValue] in worshipRecordList
|
| | | # 设置今日已膜拜过该玩家某个膜拜
|
| | | def SetWorshipRecordToday(recData, tagPlayerID, worshipType, worshipValue):
|
| | | worshipRecordList = recData.GetUserDataByKey(tagPlayerID, [])
|
| | | recordInfo = [worshipType, worshipValue]
|
| | | if recordInfo not in worshipRecordList:
|
| | | worshipRecordList.append(recordInfo)
|
| | | recData.SetUserDataByKey(tagPlayerID, worshipRecordList)
|
| | | 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):
|
| | | ## 获取膜拜对象的外观显示信息 - 本服跨服通用
|
| | | return PlayerViewCache.GetShotCacheDict(playerID, "AccID", "VIPLV", "FightPower", "Model")
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | |
|
| | |
| | | def __UpdWorshipByDay(isCrossServer, worshipList, recData):
|
| | | ## 过天更新未过期膜拜信息
|
| | | playerID = recData.GetPlayerID()
|
| | | modelShow = GetPlayerModelShow(playerID)
|
| | | if modelShow:
|
| | | SetModelShowInfo(recData, modelShow)
|
| | | playerInfo = GetPlayerViewInfo(playerID)
|
| | | if playerInfo:
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, playerInfo)
|
| | |
|
| | | if isCrossServer:
|
| | | worshipList.append(recData.GetString())
|
| | |
| | | return True
|
| | | return False
|
| | |
|
| | | def GetWorshipIpyData(worshipType, worshipValue):
|
| | | ## 获取膜拜配置数据
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("Worship", worshipType, worshipValue)
|
| | | return ipyData
|
| | |
|
| | | def AddWorshipPlayer(playerID, worshipType, worshipValue, days=None, zoneID=0, isNotify=True):
|
| | | def AddWorshipPlayer(worshipType, worshipValue, playerID, serverIDList, syncList=None, days=None):
|
| | | ## 添加膜拜玩家,本服跨服通用
|
| | | # @param isNotify: 本服-是否通知玩家;跨服-是否通知子服
|
| | |
|
| | | if worshipType in ShareDefine.Def_WorshipTypeCross:
|
| | | if not GameWorld.IsCrossServer():
|
| | |
| | | GameWorld.ErrLog("跨服服务器不允许添加非跨服膜拜! worshipType=%s" % (worshipType))
|
| | | return
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Worship", worshipType, worshipValue)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog("Worship", worshipType, worshipValue)
|
| | | if not ipyData:
|
| | | return
|
| | |
|
| | |
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | recData = playerRecMgr.GetPlayerRecData(ShareDefine.Def_PlayerRecType_WorshipPlayer, playerID, [worshipType, worshipValue])
|
| | | if not recData:
|
| | | GameWorld.Log("添加膜拜数据: playerID=%s,worshipType=%s,worshipValue=%s,days=%s,zoneID=%s" % (playerID, worshipType, worshipValue, days, zoneID))
|
| | | GameWorld.Log("添加膜拜数据: playerID=%s,worshipType=%s,worshipValue=%s,days=%s,%s" % (playerID, worshipType, worshipValue, days, serverIDList))
|
| | | recData = playerRecMgr.AddPlayerRecData(ShareDefine.Def_PlayerRecType_WorshipPlayer, playerID)
|
| | | else:
|
| | | GameWorld.Log("更新膜拜数据: playerID=%s,worshipType=%s,worshipValue=%s,days=%s,zoneID=%s" % (playerID, worshipType, worshipValue, days, zoneID))
|
| | | GameWorld.Log("更新膜拜数据: playerID=%s,worshipType=%s,worshipValue=%s,days=%s,%s" % (playerID, worshipType, worshipValue, days, serverIDList))
|
| | | recData.SetTime(int(time.time()))
|
| | | SetWorshipType(recData, worshipType)
|
| | | SetWorshipValue(recData, worshipValue)
|
| | | SetWorshipDays(recData, days)
|
| | | SetModelShowInfo(recData, GetPlayerModelShow(playerID))
|
| | | SetWorshipZoneID(recData, zoneID)
|
| | |
|
| | | if isNotify:
|
| | | if GameWorld.IsCrossServer():
|
| | | SyncAddCrossWorship([recData])
|
| | | else:
|
| | | Sync_UnWorshipInfo(None, [recData])
|
| | | |
| | | playerInfo = GetPlayerViewInfo(playerID)
|
| | | serverID = GameWorld.GetAccIDServerID(playerInfo.get("AccID", ""))
|
| | | saveServerIDList = [] + serverIDList # 重新创建一份存储,不改变传入值
|
| | | # 确保玩家自身一定能看到自己,跨服排位赛历史分区问题
|
| | | if saveServerIDList and serverID and not GameWorld.CheckServerIDInList(serverID, saveServerIDList):
|
| | | saveServerIDList.append(serverID)
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList, saveServerIDList) # 保存当下的区服ID范围 |
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, playerInfo) # 保存当下的玩家基本信息
|
| | | |
| | | if isinstance(syncList, list):
|
| | | syncList.append(recData)
|
| | | else:
|
| | | SendNewWorshipPlayer([recData])
|
| | | |
| | | return recData
|
| | |
|
| | | def SendNewWorshipPlayer(syncList):
|
| | | ## 同步新膜拜数据
|
| | | if not syncList:
|
| | | return
|
| | | if GameWorld.IsCrossServer():
|
| | | SyncAddCrossWorship(syncList)
|
| | | else:
|
| | | Sync_UnWorshipInfo(None, syncList)
|
| | | return
|
| | |
|
| | |
|
| | | def DelWorshipPlayer(worshipType, worshipValue=None, delPlayerID=None):
|
| | | ## 删除膜拜玩家,本服跨服通用
|
| | |
| | |
|
| | | GameWorld.DebugLog("膜拜: tagPlayerID=%s,worshipType=%s,worshipValue=%s,moneyType=%s,moneyValue=%s"
|
| | | % (tagPlayerID, worshipType, worshipValue, moneyType, moneyValue), playerID)
|
| | | __AddWorshipRecord(playerID, recData)
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID)
|
| | | SetWorshipRecordToday(worshipRecData, tagPlayerID, worshipType, worshipValue)
|
| | |
|
| | | __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 0, moneyType, moneyValue)
|
| | | # 同步地图发放货币
|
| | |
| | | ## 检查玩家是否可膜拜该对象
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | recPlayerID = recData.GetPlayerID()
|
| | | #if playerID == recPlayerID:
|
| | | # GameWorld.DebugLog("不能膜拜自己!", playerID)
|
| | | # return
|
| | | modelShow = GetModelShowInfo(recData)
|
| | | if not modelShow:
|
| | | playerInfo = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, {})
|
| | | if not playerInfo:
|
| | | GameWorld.DebugLog("没有外观展示的不同步! recPlayerID=%s" % recPlayerID, playerID)
|
| | | return
|
| | | accID = modelShow.get("AccID", "")
|
| | | accID = playerInfo.get("AccID", "")
|
| | | if not accID:
|
| | | return
|
| | | serverID = GameWorld.GetAccIDServerID(accID)
|
| | | playerServerID = GameWorld.GetPlayerServerID(curPlayer)
|
| | | |
| | | worshipType = GetWorshipType(recData)
|
| | | worshipValue = GetWorshipValue(recData)
|
| | | zoneID = GetWorshipZoneID(recData)
|
| | | if worshipType == ShareDefine.Def_WorshipType_ServerNaming:
|
| | | #只同步给同ServerID的
|
| | | serverID = GameWorld.GetAccIDServerID(accID)
|
| | | playerServerID = GameWorld.GetPlayerServerID(curPlayer)
|
| | | if serverID != playerServerID:
|
| | | GameWorld.DebugLog("只同步给同ServerID的! recPlayerID=%s,accID=%s,serverID=%s != playerServerID=%s"
|
| | | % (recPlayerID, accID, serverID, playerServerID), playerID)
|
| | | return
|
| | | elif worshipType == ShareDefine.Def_WorshipType_CrossChampionship:
|
| | | #只同步给同分区的
|
| | | playerZoneID = CrossChampionship.GetChampionshipMgr().GetPlayerOfficialZoneID(playerID)
|
| | | if playerZoneID != zoneID:
|
| | | GameWorld.DebugLog("只同步给同分区的! recPlayerID=%s,zoneID=%s != playerZoneID=%s" % (recPlayerID, zoneID, playerZoneID), playerID)
|
| | | else:
|
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | if not GameWorld.CheckServerIDInList(playerServerID, serverIDList):
|
| | | GameWorld.DebugLog("该玩家不能膜拜目标玩家! playerServerID=%s not in %s" % (playerServerID, serverIDList), playerID)
|
| | | return
|
| | |
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID)
|
| | | worshipRecordDict = GetTodayWorshipRecord(worshipRecData)
|
| | | if recPlayerID in worshipRecordDict and [worshipType, worshipValue] in worshipRecordDict[recPlayerID]:
|
| | | GameWorld.DebugLog("已膜拜过! recPlayerID=%s,worshipType=%s, worshipValue=%s,worshipRecordDict=%s" |
| | | % (recPlayerID, worshipType, worshipValue, worshipRecordDict), playerID)
|
| | | if HasWorshipRecordToday(worshipRecData, recPlayerID, worshipType, worshipValue):
|
| | | GameWorld.DebugLog("今日已膜拜过! recPlayerID=%s,worshipType=%s, worshipValue=%s" % (recPlayerID, worshipType, worshipValue), playerID)
|
| | | return
|
| | |
|
| | | return True
|
| | |
|
| | | def __AddWorshipRecord(playerID, recData):
|
| | | ## 添加玩家膜拜目标记录
|
| | | playerRecMgr = PyDataManager.GetDBPlayerRecDataManager()
|
| | | worshipRecData = playerRecMgr.GetPlayerRecDataFirst(ShareDefine.Def_PlayerRecType_WorshipDaily, playerID)
|
| | | worshipRecordDict = GetTodayWorshipRecord(worshipRecData)
|
| | | |
| | | tagPlayerID = recData.GetPlayerID()
|
| | | worshipType = GetWorshipType(recData)
|
| | | worshipValue = GetWorshipValue(recData)
|
| | | recordInfo = [worshipType, worshipValue]
|
| | | |
| | | if tagPlayerID not in worshipRecordDict:
|
| | | worshipRecordDict[tagPlayerID] = []
|
| | | worshipRecordList = worshipRecordDict[tagPlayerID]
|
| | | if recordInfo not in worshipRecordList:
|
| | | worshipRecordList.append(recordInfo)
|
| | | |
| | | #GameWorld.DebugLog("更新今日膜拜记录: %s" % GetTodayWorshipRecord(worshipRecData), playerID)
|
| | | return
|
| | |
|
| | | def __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, result, moneyType=0, moneyValue=0):
|
| | | ## 同步膜拜结果
|
| | |
| | | playerID = recData.GetPlayerID()
|
| | |
|
| | | # 如果存在本服的最新外观数据则已本服的为准
|
| | | modelShow = GetPlayerModelShow(playerID)
|
| | | if modelShow:
|
| | | SetModelShowInfo(recData, modelShow)
|
| | | playerInfo = GetPlayerViewInfo(playerID)
|
| | | if playerInfo:
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, playerInfo)
|
| | |
|
| | | sysnList.append(recData)
|
| | | GameWorld.Log(" 更新跨服膜拜: worshipType=%s,zoneID=%s,playerID=%s,worshipValue=%s,days=%s" |
| | | % (GetWorshipType(recData), GetWorshipZoneID(recData), playerID, GetWorshipValue(recData), GetWorshipDays(recData)))
|
| | | |
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | GameWorld.Log(" 更新跨服膜拜: worshipType=%s,worshipValue=%s,playerID=%s,days=%s,%s" |
| | | % (GetWorshipType(recData), GetWorshipValue(recData), playerID, GetWorshipDays(recData), serverIDList))
|
| | |
|
| | | #更新数据的可不同步,每个人的膜拜记录都不一样,由登录触发及添加新膜拜触发即可
|
| | | #Sync_UnWorshipInfo(None, sysnList)
|
| | |
| | | recData = playerRecMgr.AddPlayerRecDataByDict(attrDict)
|
| | |
|
| | | sysnList.append(recData)
|
| | | GameWorld.Log(" 添加跨服膜拜: worshipType=%s,zoneID=%s,playerID=%s,worshipValue=%s,days=%s" |
| | | % (GetWorshipType(recData), GetWorshipZoneID(recData), playerID, GetWorshipValue(recData), GetWorshipDays(recData)))
|
| | | |
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | GameWorld.Log(" 添加跨服膜拜: worshipType=%s,worshipValue=%s,playerID=%s,days=%s,%s" |
| | | % (GetWorshipType(recData), GetWorshipValue(recData), playerID, GetWorshipDays(recData), serverIDList))
|
| | |
|
| | | Sync_UnWorshipInfo(None, sysnList)
|
| | | return
|
| | |
| | | infoList = []
|
| | | for recData in unWorshipList:
|
| | | recPlayerID = recData.GetPlayerID()
|
| | | modelShow = GetPlayerModelShow(recPlayerID)
|
| | | if modelShow:
|
| | | playerInfo = GetPlayerViewInfo(recPlayerID)
|
| | | if playerInfo:
|
| | | # 更新本服最新的外观显示,跨服玩家由跨服每日同步更新 __UpdWorshipByDay
|
| | | SetModelShowInfo(recData, modelShow)
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, playerInfo)
|
| | | else:
|
| | | modelShow = GetModelShowInfo(recData)
|
| | | if not modelShow:
|
| | | playerInfo = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo)
|
| | | if not playerInfo:
|
| | | # 没有外观展示的不同步
|
| | | continue
|
| | |
|
| | |
| | | infoPack.PlayerID = recPlayerID
|
| | | infoPack.WorshipType = GetWorshipType(recData)
|
| | | infoPack.WorshipValue = GetWorshipValue(recData)
|
| | | infoPack.PlayerInfo = json.dumps(modelShow, ensure_ascii=False).replace(" ", "")
|
| | | infoPack.PlayerInfo = json.dumps(playerInfo, ensure_ascii=False).replace(" ", "")
|
| | | infoPack.InfoLen = len(infoPack.PlayerInfo)
|
| | |
|
| | | if curPlayer:
|
| | |
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | import time
|
| | |
|
| | | Def_UserDataKey_ServerIDList = "ServerIDList"
|
| | | Def_UserDataKey_PlayerInfo = "PlayerInfo"
|
| | |
|
| | | # 仙宫玩家记录
|
| | | def GetXGPlayerID(recData): return recData.GetValue1() # 仙宫玩家ID
|
| | |
| | | # 确保玩家自身一定能看到自己,跨服排位赛历史分区问题
|
| | | if saveServerIDList and serverID and not GameWorld.CheckServerIDInList(serverID, saveServerIDList):
|
| | | saveServerIDList.append(serverID)
|
| | | recData.SetUserDataByKey(Def_UserDataKey_ServerIDList, saveServerIDList) # 保存当下的区服ID范围 |
| | | recData.SetUserDataByKey(Def_UserDataKey_PlayerInfo, playerInfo) # 保存当下的玩家基本信息
|
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList, saveServerIDList) # 保存当下的区服ID范围 |
| | | recData.SetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo, playerInfo) # 保存当下的玩家基本信息
|
| | | GameWorld.Log("新晋仙官玩家: xiangongID=%s,playerID=%s,rank=%s,serverID=%s,saveServerIDList=%s,%s"
|
| | | % (xiangongID, playerID, rank, serverID, saveServerIDList, playerInfo))
|
| | |
|
| | |
| | | if passDays > showDays:
|
| | | GameWorld.DebugLog(" xgPlayerID=%s,addTime=%s,passDays=%s > %s" % (xgPlayerID, addTime, passDays, showDays))
|
| | | break
|
| | | serverIDList = recData.GetUserDataByKey(Def_UserDataKey_ServerIDList)
|
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | if playerServerID:
|
| | | if serverIDList == None:
|
| | | GameWorld.DebugLog(" xgPlayerID=%s,serverIDList is None" % (xgPlayerID))
|
| | |
| | | recDataList = gameRecMgr.GetGameRecDataList(ShareDefine.Def_GameRecType_Xiangong, xiangongID)
|
| | |
|
| | | for recData in recDataList[::-1]:
|
| | | serverIDList = recData.GetUserDataByKey(Def_UserDataKey_ServerIDList)
|
| | | playerInfo = recData.GetUserDataByKey(Def_UserDataKey_PlayerInfo)
|
| | | serverIDList = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_ServerIDList)
|
| | | playerInfo = recData.GetUserDataByKey(ChConfig.Def_RecDataKey_PlayerInfo)
|
| | | if not playerInfo or not GameWorld.CheckServerIDInList(serverID, serverIDList):
|
| | | continue
|
| | | playerInfo["AddTime"] = recData.GetTime()
|
| | |
| | | import PlayerFamily |
| | | import PyDataManager |
| | | import GameXiangong |
| | | import GameWorship |
| | | |
| | | def OnActStart(actNum): |
| | | ## 活动开启 |
| | |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | worshipType = ShareDefine.Def_WorshipType_CrossBossTrial |
| | | syncNewWorshipList = [] |
| | | syncNewXiangongDict = {} |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | |
| | | billboardIndex += 1 |
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList) |
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |
| | |
| | | import PyDataManager |
| | | import CrossRealmMsg |
| | | import GameXiangong |
| | | import GameWorship |
| | | import GameWorld |
| | | |
| | | def OnActStart(actNum, ipyData): |
| | |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | worshipType = ShareDefine.Def_WorshipType_CrossGubaoTrain |
| | | syncNewWorshipList = [] |
| | | syncNewXiangongDict = {} |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | |
| | | billboardIndex += 1 |
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList) |
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |
| | |
| | | import PyDataManager |
| | | import CrossRealmMsg |
| | | import GameXiangong |
| | | import GameWorship |
| | | import GameWorld |
| | | |
| | | def OnActStart(actNum, ipyData): |
| | |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | worshipType = ShareDefine.Def_WorshipType_CrossHorsePetTrain |
| | | syncNewWorshipList = [] |
| | | syncNewXiangongDict = {} |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | |
| | | billboardIndex += 1 |
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList) |
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |
| | |
| | | import PyDataManager |
| | | import CrossRealmMsg |
| | | import GameXiangong |
| | | import GameWorship |
| | | import GameWorld |
| | | |
| | | def OnActStart(actNum, ipyData): |
| | |
| | | if not orderIpyDataList: |
| | | return |
| | | |
| | | worshipType = ShareDefine.Def_WorshipType_CrossXianXiaMJ |
| | | syncNewWorshipList = [] |
| | | syncNewXiangongDict = {} |
| | | rankPre = 0 |
| | | billboardIndex = 0 |
| | |
| | | billboardIndex += 1 |
| | | |
| | | GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict) |
| | | GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList) |
| | | GameWorship.SendNewWorshipPlayer(syncNewWorshipList) |
| | | GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict) |
| | | return |
| | | |
| | |
| | | if not dbRecData:
|
| | | dbRecData = PyGameDataStruct.tagDBPlayerRecData()
|
| | | self.dbRecData = dbRecData
|
| | | self.evalUserData = None
|
| | | self.__userDataDict = None
|
| | | self.__userDataChange = False
|
| | | return
|
| | | def clear(self):
|
| | | self.dbRecData.clear()
|
| | | self.evalUserData = None
|
| | | self.__userDataDict = None
|
| | | self.__userDataChange = False
|
| | | return
|
| | | def GetPlayerID(self): return self.dbRecData.PlayerID
|
| | | def SetPlayerID(self, playerID): self.dbRecData.PlayerID = playerID
|
| | |
| | | def SetValue7(self, value7): self.dbRecData.Value7 = value7
|
| | | def GetValue8(self): return self.dbRecData.Value8
|
| | | def SetValue8(self, value8): self.dbRecData.Value8 = value8
|
| | | def GetUserData(self): return self.dbRecData.UserData
|
| | | def __GetUserDataDict(self):
|
| | | if self.__userDataDict == None:
|
| | | try:
|
| | | self.__userDataDict = eval(self.dbRecData.UserData)
|
| | | except:
|
| | | self.__userDataDict = {}
|
| | | return self.__userDataDict
|
| | | def GetUserDataByKey(self, key, defaultValue=None):
|
| | | userDataDict = self.__GetUserDataDict()
|
| | | if key in userDataDict:
|
| | | return userDataDict[key]
|
| | | return defaultValue
|
| | | def SetUserDataByKey(self, key, value):
|
| | | userDataDict = self.__GetUserDataDict()
|
| | | userDataDict[key] = value
|
| | | self.__userDataChange = True
|
| | | return
|
| | | def GetUserData(self):
|
| | | if self.__userDataChange:
|
| | | self.SaveUserData()
|
| | | return self.dbRecData.UserData
|
| | | def SetUserData(self, userData):
|
| | | ## 支持直接保存任意格式数据,或者按字典方式读取kv值
|
| | | if type(userData) != str:
|
| | | userData = str(userData)
|
| | | self.dbRecData.UserData = userData.replace(" ", "")
|
| | | self.dbRecData.UserDataLen = len(self.dbRecData.UserData)
|
| | | if self.evalUserData != None:
|
| | | self.evalUserData = None
|
| | | self.__userDataDict = None
|
| | | self.__userDataChange = False
|
| | | return
|
| | | def GetEvalUserData(self, defValue={}):
|
| | | if self.evalUserData == None:
|
| | | try:
|
| | | self.evalUserData = eval(self.dbRecData.UserData)
|
| | | except:
|
| | | self.evalUserData = defValue
|
| | | return self.evalUserData
|
| | | def SetEvalUserData(self, eValue):
|
| | | self.evalUserData = eValue
|
| | | def SaveUserData(self):
|
| | | if self.__userDataChange:
|
| | | self.SetUserData(self.__userDataDict)
|
| | | return
|
| | |
|
| | | def IsMatchValue(self, valueList):
|
| | |
| | | for recDataList in playerRecDataDict.values():
|
| | | for recData in recDataList:
|
| | | cnt += 1
|
| | | if recData.evalUserData != None:
|
| | | recData.SetUserData(recData.evalUserData)
|
| | | recData.SaveUserData()
|
| | | savaData += recData.dbRecData.getBuffer()
|
| | |
|
| | | GameWorld.Log("Save DBPlayerRecData count :%s len=%s" % (cnt, len(savaData)))
|
| | |
| | | "LV":cacheDict["LV"],
|
| | | "RealmLV":cacheDict["RealmLV"],
|
| | | }
|
| | | if "PlayerID" in exAttrs:
|
| | | shotCacheDict["PlayerID"] = playerID
|
| | | if "FightPower" in exAttrs:
|
| | | shotCacheDict["FightPower"] = cacheDict["FightPower"]
|
| | | if "ServerID" in exAttrs:
|
| | | shotCacheDict["ServerID"] = GameWorld.GetAccIDServerID(cacheDict["AccID"])
|
| | | if "OfflineValue" in exAttrs:
|
| | | olMgr = ChPlayer.GetOnlinePlayerMgr()
|
| | | shotCacheDict["OfflineValue"] = olMgr.GetOfflineValue(playerID, viewCache)
|
| | | # 附带外观模型展示相关
|
| | | if "Model" in exAttrs:
|
| | | shotCacheDict.update({
|
| | | "TitleID":cacheDict.get("TitleID", 0),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", []),
|
| | | })
|
| | | for attrName in exAttrs:
|
| | | if attrName == "PlayerID":
|
| | | shotCacheDict["PlayerID"] = playerID
|
| | | elif attrName == "ServerID":
|
| | | shotCacheDict["ServerID"] = GameWorld.GetAccIDServerID(cacheDict["AccID"])
|
| | | elif attrName == "OfflineValue":
|
| | | olMgr = ChPlayer.GetOnlinePlayerMgr()
|
| | | shotCacheDict["OfflineValue"] = olMgr.GetOfflineValue(playerID, viewCache)
|
| | | # 附带外观模型展示相关
|
| | | elif attrName == "Model":
|
| | | shotCacheDict.update({
|
| | | "TitleID":cacheDict.get("TitleID", 0),
|
| | | "EquipShowSwitch":cacheDict.get("EquipShowSwitch", 0),
|
| | | "EquipShowID":cacheDict.get("EquipShowID", []),
|
| | | })
|
| | | elif attrName in cacheDict:
|
| | | shotCacheDict[attrName] = cacheDict[attrName]
|
| | | return shotCacheDict
|
| | |
|
| | | def GetSyncCrossCacheBase(curPlayer):
|
| | |
| | | Def_WorshipTypeList = (
|
| | | Def_WorshipType_ServerNaming, # 服务器冠名 1
|
| | | Def_WorshipType_CrossChampionship, # 跨服排位冠军 2
|
| | | ) = range(1, 1 + 2)
|
| | | Def_WorshipType_CrossBossTrial, # 跨服boss凭证 3
|
| | | Def_WorshipType_CrossXianXiaMJ, # 跨服秘境寻宝 4
|
| | | Def_WorshipType_CrossHorsePetTrain, # 跨服骑宠养成 5
|
| | | Def_WorshipType_CrossGubaoTrain, # 跨服古宝养成 6
|
| | | ) = range(1, 1 + 6)
|
| | |
|
| | | #跨服膜拜类型
|
| | | Def_WorshipTypeCross = [Def_WorshipType_CrossChampionship]
|
| | | Def_WorshipTypeCross = [Def_WorshipType_CrossChampionship, Def_WorshipType_CrossBossTrial, Def_WorshipType_CrossXianXiaMJ, |
| | | Def_WorshipType_CrossHorsePetTrain, Def_WorshipType_CrossGubaoTrain,
|
| | | ]
|
| | |
|
| | | #玩家记录类型
|
| | | Def_PlayerRecTypeList = (
|
| | |
| | | Def_WorshipTypeList = (
|
| | | Def_WorshipType_ServerNaming, # 服务器冠名 1
|
| | | Def_WorshipType_CrossChampionship, # 跨服排位冠军 2
|
| | | ) = range(1, 1 + 2)
|
| | | Def_WorshipType_CrossBossTrial, # 跨服boss凭证 3
|
| | | Def_WorshipType_CrossXianXiaMJ, # 跨服秘境寻宝 4
|
| | | Def_WorshipType_CrossHorsePetTrain, # 跨服骑宠养成 5
|
| | | Def_WorshipType_CrossGubaoTrain, # 跨服古宝养成 6
|
| | | ) = range(1, 1 + 6)
|
| | |
|
| | | #跨服膜拜类型
|
| | | Def_WorshipTypeCross = [Def_WorshipType_CrossChampionship]
|
| | | Def_WorshipTypeCross = [Def_WorshipType_CrossChampionship, Def_WorshipType_CrossBossTrial, Def_WorshipType_CrossXianXiaMJ, |
| | | Def_WorshipType_CrossHorsePetTrain, Def_WorshipType_CrossGubaoTrain,
|
| | | ]
|
| | |
|
| | | #玩家记录类型
|
| | | Def_PlayerRecTypeList = (
|