#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GameWorship # # @todo:Ĥ°Ý # @author hxp # @date 2024-07-02 # @version 1.0 # # ÏêϸÃèÊö: Ĥ°Ý # #------------------------------------------------------------------------------- #"""Version = 2024-7-02 16:30""" #------------------------------------------------------------------------------- import ShareDefine import PyDataManager import NetPackCommon import PlayerControl import ChPyNetSendPack import CrossChampionship import PlayerViewCache import PlayerRecData import CrossRealmMsg import IpyGameDataPY import GameWorld import random import time # ±»Ä¤°ÝÍæ¼Ò RecType = ShareDefine.Def_PlayerRecType_WorshipPlayer def GetWorshipType(recData): return recData.GetValue1() # Ĥ°ÝÀàÐÍ def SetWorshipType(recData, worshipType): recData.SetValue1(worshipType) def GetWorshipValue(recData): return recData.GetValue2() # Ĥ°ÝÀàÐÍÏµĹ¦ÄÜÖµ£¬¼´Ä¤°Ýʲô£¬¹¦ÄÜ×Ô¶¨Ò壬ÈçÅÅÃû»òÆäËû£¬¿ÉÑ¡ 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), "EquipShowID":cacheDict.get("EquipShowID", []), } return modelShow # Íæ¼ÒÿÈÕĤ°Ý¼Ç¼ RecType = ShareDefine.Def_PlayerRecType_WorshipDaily def GetTodayWorshipRecord(recData): return recData.GetEvalUserData({}) # ½ñÈÕÒÑĤ°Ý¼Ç¼ {tagPlayerID:[[Ĥ°ÝÀàÐÍ, Ĥ°ÝÖµ], ...], ...} ##-------------------------------------------------------------------------------------------------- def OnPlayerLogin(curPlayer): playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() unWorshipList = [] # δĤ°ÝÁбí recDict = playerRecMgr.GetPlayerRecDataDict(ShareDefine.Def_PlayerRecType_WorshipPlayer) for recDataList in recDict.values(): for recData in recDataList: if not __CheckPlayerCanWorship(curPlayer, recData): continue unWorshipList.append(recData) Sync_UnWorshipInfo(curPlayer, unWorshipList) return def DoOnDay(): ''' ±¾·þÏȹýÌì ÒѹýÆÚµÄ¿ç·þĤ°ÝÒ²»á±»ÏÈɾ³ý£¬Ï൱ÓÚÌύɾ³ý¹ýÆÚµÄ¿ç·þĤ°Ý δ¹ýÆÚµÄ¿ç·þĤ°Ýµ±¿ç·þ·þÎñÆ÷¹ýÌìʱͬÑùÒ²ÊÇδ¹ýÆÚ£¬¹ÊÒ²¿ÉÕý³£Ä¤°Ý£¬Ã¿ÌìµÄĤ°Ý¼Ç¼ÊÇ´æÔÚ±¾·þÍæ¼Ò£¬Ï൱ÓÚÌáǰĤ°Ý ¿ç·þÏȹýÌì ÒѹýÆÚµÄ¿ç·þĤ°Ý»á±»É¾³ý£¬È»ºóͬ²½¸ø×Ó·þÏÈͬ²½É¾³ýµô¼´¿É δ¹ýÆÚµÄ¿ç·þĤ°Ý²»´¦Àí¼´¿É ËùÒÔ£¬¹ýÌìʱ£¬±¾·þ¼°¿ç·þ¸÷×Ô´¦Àí¸÷×ÔµÄÂß¼­¼´¿É ''' isCrossServer = GameWorld.IsCrossServer() playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() worshipList = [] curTime = int(time.time()) recDict = playerRecMgr.GetPlayerRecDataDict(ShareDefine.Def_PlayerRecType_WorshipPlayer) for recDataList in recDict.values(): for recData in recDataList[::-1]: # µ¹Ðò´¦Àíɾ³ýµ½ÆÚµÄĤ°Ý¶ÔÏó recTime = recData.GetTime() tagPlayerID = recData.GetPlayerID() worshipType = GetWorshipType(recData) worshipValue = GetWorshipValue(recData) worshipDays = GetWorshipDays(recData) if not worshipDays: # ÓÀ¾ÃĤ°Ý²»´¦Àí£¬Ö±µ½±»Ìæ»» GameWorld.DebugLog("ÓÀ¾ÃĤ°Ý²»´¦Àí: worshipType=%s,worshipValue=%s,tagPlayerID=%s" % (worshipType, worshipValue, tagPlayerID)) __UpdWorshipByDay(isCrossServer, worshipList, recData) continue diffDays = GameWorld.GetDiff_Day(curTime, recTime) if diffDays < worshipDays: GameWorld.DebugLog("Ĥ°Ýδµ½ÆÚ: worshipType=%s,worshipValue=%s,tagPlayerID=%s,diffDays=%s < %s" % (worshipType, worshipValue, tagPlayerID, diffDays, worshipDays)) __UpdWorshipByDay(isCrossServer, worshipList, recData) continue GameWorld.DebugLog("ɾ³ýĤ°Ý: worshipType=%s,worshipValue=%s,tagPlayerID=%s" % (worshipType, worshipValue, tagPlayerID)) playerRecMgr.DelRecData(recData) if isCrossServer: # ͬ²½¸ø×Ó·þ dataMsg = {"msgType":"AllCrossWorship", "worshipDataList":worshipList} CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Worship, dataMsg) return # ±¾·þ´¦Àí playerRecMgr.DelRecDataByType(ShareDefine.Def_PlayerRecType_WorshipDaily) # ɾ³ý±¾·þËùÓÐÍæ¼ÒµÄÿÈÕĤ°Ý¼Ç¼ Sync_UnWorshipInfo(None, worshipList) return def __UpdWorshipByDay(isCrossServer, worshipList, recData): ## ¹ýÌì¸üÐÂδ¹ýÆÚĤ°ÝÐÅÏ¢ playerID = recData.GetPlayerID() modelShow = GetPlayerModelShow(playerID) if modelShow: SetModelShowInfo(recData, modelShow) if isCrossServer: worshipList.append(recData.GetString()) else: worshipList.append(recData) return def IsWorshipPlayer(playerID): ## ÊÇ·ñĤ°ÝÍæ¼Ò playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() if playerRecMgr.GetPlayerRecDataList(ShareDefine.Def_PlayerRecType_WorshipPlayer, playerID): 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): ## Ìí¼ÓĤ°ÝÍæ¼Ò£¬±¾·þ¿ç·þͨÓà # @param isNotify: ±¾·þ-ÊÇ·ñÍ¨ÖªÍæ¼Ò£»¿ç·þ-ÊÇ·ñ֪ͨ×Ó·þ if worshipType in ShareDefine.Def_WorshipTypeCross: if not GameWorld.IsCrossServer(): GameWorld.ErrLog("·Ç¿ç·þ·þÎñÆ÷²»ÔÊÐíÌí¼Ó¿ç·þĤ°Ý! worshipType=%s" % (worshipType)) return else: if GameWorld.IsCrossServer(): GameWorld.ErrLog("¿ç·þ·þÎñÆ÷²»ÔÊÐíÌí¼Ó·Ç¿ç·þĤ°Ý! worshipType=%s" % (worshipType)) return ipyData = IpyGameDataPY.GetIpyGameData("Worship", worshipType, worshipValue) if not ipyData: return if days == None: days = ipyData.GetWorshipDays() # ûÓÐÖ¸¶¨ÌìÊýµÄ»°È¡Åä±í 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)) 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)) 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]) return recData def DelWorshipPlayer(worshipType, worshipValue=None, delPlayerID=None): ## ɾ³ýĤ°ÝÍæ¼Ò£¬±¾·þ¿ç·þͨÓà valueList = [worshipType] if worshipValue != None: valueList.append(worshipValue) playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() playerRecMgr.DelRecDataByTypeValue(ShareDefine.Def_PlayerRecType_WorshipPlayer, valueList, delPlayerID) if GameWorld.IsCrossServer(): dataMsg = {"msgType":"DelCrossWorship", "worshipType":worshipType, "worshipValue":worshipValue, "delPlayerID":delPlayerID} CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Worship, dataMsg) return #// B0 20 ÇëÇóĤ°ÝÍæ¼Ò #tagCGWorship # #struct tagCGWorship #{ # tagHead Head; # DWORD PlayerID; // Ä¿±êÍæ¼ÒID # BYTE WorshipType; // Ĥ°ÝÀàÐÍ # DWORD WorshipValue; // Ĥ°ÝÀàÐͶÔÓ¦µÄ¹¦ÄÜÖµ£¬ÈçÃû´Î»òÆäËû£¬ÓɾßÌåĤ°ÝÀàÐͶ¨Òå¶ÔÓ¦Öµº¬Òå #}; def OnWorship(index, clientData, tick): curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) playerID = curPlayer.GetPlayerID() tagPlayerID = clientData.PlayerID worshipType = clientData.WorshipType worshipValue = clientData.WorshipValue ipyData = IpyGameDataPY.GetIpyGameData("Worship", worshipType, worshipValue) if not ipyData: __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 1) return findWorshipData = None playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() recDataList = playerRecMgr.GetPlayerRecDataList(ShareDefine.Def_PlayerRecType_WorshipPlayer, tagPlayerID) for recData in recDataList: if worshipType == GetWorshipType(recData) and worshipValue == GetWorshipValue(recData): findWorshipData = recData break if not findWorshipData: __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 2) GameWorld.DebugLog("²»´æÔÚ¸ÃÄ¿±êÍæ¼ÒµÄĤ°Ý! tagPlayerID=%s,worshipType=%s,worshipValue=%s" % (tagPlayerID, worshipType, worshipValue), playerID) return if not __CheckPlayerCanWorship(curPlayer, recData): __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 3) return moneyType = ipyData.GetMoneyType() moneyRange = ipyData.GetMoneyRange() if len(moneyRange) != 2: return moneyValue = random.randint(moneyRange[0], moneyRange[1]) GameWorld.DebugLog("Ĥ°Ý: tagPlayerID=%s,worshipType=%s,worshipValue=%s,moneyType=%s,moneyValue=%s" % (tagPlayerID, worshipType, worshipValue, moneyType, moneyValue), playerID) __AddWorshipRecord(playerID, recData) __SyncWorshipResult(curPlayer, tagPlayerID, worshipType, worshipValue, 0, moneyType, moneyValue) # ͬ²½µØÍ¼·¢·Å»õ±Ò PlayerControl.MapServerGiveAward(curPlayer, "Worship", {moneyType:moneyValue}) return def __CheckPlayerCanWorship(curPlayer, recData): ## ¼ì²éÍæ¼ÒÊÇ·ñ¿ÉĤ°Ý¸Ã¶ÔÏó playerID = curPlayer.GetPlayerID() recPlayerID = recData.GetPlayerID() if playerID == recPlayerID: GameWorld.DebugLog("²»ÄÜĤ°Ý×Ô¼º!", playerID) return modelShow = GetModelShowInfo(recData) if not modelShow: GameWorld.DebugLog("ûÓÐÍâ¹ÛչʾµÄ²»Í¬²½! recPlayerID=%s" % recPlayerID, playerID) return accID = modelShow.get("AccID", "") if not accID: return 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) 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) 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): ## ͬ²½Ä¤°Ý½á¹û # @param result: Ĥ°Ý½á¹û£º0-³É¹¦£»1-²»´æÔÚ¸ÃĤ°Ý£»2-²»ÄÜĤ°ÝÄ¿±ê clientPack = ChPyNetSendPack.tagGCWorshipResult() clientPack.PlayerID = tagPlayerID clientPack.WorshipType = worshipType clientPack.WorshipValue = worshipValue clientPack.Result = result clientPack.MoneyType = moneyType clientPack.MoneyValue = moneyValue NetPackCommon.SendFakePack(curPlayer, clientPack) return def CrossServerMsg_Worship(msgData): ## ×Ó·þÊÕµ½¿ç·þÐÅÏ¢ msgType = msgData["msgType"] if msgType == "AddCrossWorship": __Client_AddCrossWorship(msgData) elif msgType == "AllCrossWorship": __Client_AllCrossWorship(msgData) elif msgType == "DelCrossWorship": __Client_DelCrossWorship(msgData) return def __Client_AllCrossWorship(msgData): ## ×Ó·þ¸üÐÂËùÓпç·þĤ°Ý worshipDataList = msgData["worshipDataList"] GameWorld.Log("×Ó·þ¸üÐÂËùÓпç·þĤ°Ý: count=%s" % len(worshipDataList)) playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() for crossWorshipType in ShareDefine.Def_WorshipTypeCross: playerRecMgr.DelRecDataByTypeValue(ShareDefine.Def_PlayerRecType_WorshipPlayer, [crossWorshipType]) sysnList = [] for attrDict in worshipDataList: recData = playerRecMgr.AddPlayerRecDataByDict(attrDict) playerID = recData.GetPlayerID() # Èç¹û´æÔÚ±¾·þµÄ×îÐÂÍâ¹ÛÊý¾ÝÔòÒѱ¾·þµÄΪ׼ modelShow = GetPlayerModelShow(playerID) if modelShow: SetModelShowInfo(recData, modelShow) sysnList.append(recData) GameWorld.Log(" ¸üпç·þĤ°Ý: worshipType=%s,zoneID=%s,playerID=%s,worshipValue=%s,days=%s" % (GetWorshipType(recData), GetWorshipZoneID(recData), playerID, GetWorshipValue(recData), GetWorshipDays(recData))) #¸üÐÂÊý¾ÝµÄ¿É²»Í¬²½£¬Ã¿¸öÈ˵ÄĤ°Ý¼Ç¼¶¼²»Ò»Ñù£¬ÓɵǼ´¥·¢¼°Ìí¼ÓÐÂĤ°Ý´¥·¢¼´¿É #Sync_UnWorshipInfo(None, sysnList) return def __Client_AddCrossWorship(msgData): ## ×Ó·þÌí¼Ó¿ç·þĤ°Ý worshipDataList = msgData["worshipDataList"] GameWorld.Log("×Ó·þÌí¼Ó¿ç·þĤ°Ý: addCount=%s" % len(worshipDataList)) playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() tempData = PlayerRecData.PlayerRecDataTemp sysnList = [] for attrDict in worshipDataList: tempData.SetAttr(attrDict, True) playerID = tempData.GetPlayerID() worshipType = GetWorshipType(tempData) worshipValue = GetWorshipValue(tempData) if not playerID or not worshipType: continue # Èç¹ûÒѾ­´æÔÚ¸ÃĤ°ÝÔòÖ±½Ó¸üÐÂÊý¾Ý£¬·ñÔòÌí¼ÓÐÂÊý¾Ý recData = playerRecMgr.GetPlayerRecData(ShareDefine.Def_PlayerRecType_WorshipPlayer, playerID, [worshipType, worshipValue]) if recData: recData.SetAttr(attrDict, True) else: 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))) Sync_UnWorshipInfo(None, sysnList) return def __Client_DelCrossWorship(msgData): ## ×Ó·þɾ³ý¿ç·þĤ°Ý worshipType = msgData["worshipType"] worshipValue = msgData["worshipValue"] delPlayerID = msgData["delPlayerID"] GameWorld.Log("×Ó·þɾ³ý¿ç·þĤ°Ý: worshipType=%s,worshipValue=%s,delPlayerID=%s" % (worshipType, worshipValue, delPlayerID)) DelWorshipPlayer(worshipType, worshipValue, delPlayerID) return def Sync_UnWorshipInfo(curPlayer, unWorshipList): ## curPlayer ¿ÉÄÜΪNone if not unWorshipList: return infoList = [] for recData in unWorshipList: recPlayerID = recData.GetPlayerID() modelShow = GetPlayerModelShow(recPlayerID) if modelShow: # ¸üб¾·þ×îеÄÍâ¹ÛÏÔʾ£¬¿ç·þÍæ¼ÒÓÉ¿ç·þÿÈÕͬ²½¸üР__UpdWorshipByDay SetModelShowInfo(recData, modelShow) else: modelShow = GetModelShowInfo(recData) if not modelShow: # ûÓÐÍâ¹ÛչʾµÄ²»Í¬²½ continue if curPlayer: if not __CheckPlayerCanWorship(curPlayer, recData): continue infoPack = ChPyNetSendPack.tagGCWorshipInfo() infoPack.PlayerID = recPlayerID infoPack.WorshipType = GetWorshipType(recData) infoPack.WorshipValue = GetWorshipValue(recData) infoPack.PlayerInfo = str(modelShow).replace(" ", "") infoPack.InfoLen = len(infoPack.PlayerInfo) if curPlayer: infoList.append(infoPack) else: infoList.append([recData, infoPack]) if not infoList: return clientPack = ChPyNetSendPack.tagGCWorshipInfoList() if not curPlayer: # È«·þ¹ã²¥ÔÚÏßÍæ¼Ò£¬Ã¿¸öÈËͬ²½µÄ¿ÉÄܲ»Ò»Ñù playerManager = GameWorld.GetPlayerManager() for i in range(0, playerManager.GetPlayerCount()): curPlayer = playerManager.GetPlayerByIndex(i) if curPlayer == None or not curPlayer.GetInitOK(): continue clientPack.WorshipInfoList = [] for info in infoList: recData, infoPack = info if not __CheckPlayerCanWorship(curPlayer, recData): continue clientPack.WorshipInfoList.append(infoPack) if not clientPack.WorshipInfoList: continue clientPack.WorshipCount = len(clientPack.WorshipInfoList) NetPackCommon.SendFakePack(curPlayer, clientPack) else: clientPack.WorshipInfoList = infoList clientPack.WorshipCount = len(clientPack.WorshipInfoList) NetPackCommon.SendFakePack(curPlayer, clientPack) return ##-------------------------------------------------------------------------------------------------- def Sync_CrossWorshipToClientServer(serverGroupID=0): ''' ͬ²½¿ç·þĤ°ÝÊý¾Ýµ½×Ó·þÎñÆ÷ @param serverGroupID: Ϊ0ʱͬ²½ËùÓÐ×Ó·þ ''' GameWorld.Log("ͬ²½¸ø×Ó·þĤ°ÝÊý¾Ý: syncServerGroupID=%s" % (serverGroupID)) playerRecMgr = PyDataManager.GetDBPlayerRecDataManager() recDataDict = playerRecMgr.GetPlayerRecDataDict(ShareDefine.Def_PlayerRecType_WorshipPlayer) worshipDataList = [] for recDataList in recDataDict.values(): for recData in recDataList: if not recData: continue if GetWorshipType(recData) not in ShareDefine.Def_WorshipTypeCross: continue worshipDataList.append(recData.GetString()) dataMsg = {"msgType":"AllCrossWorship", "worshipDataList":worshipDataList} CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Worship, dataMsg) return def SyncAddCrossWorship(addRecDataList): # ͬ²½×Ó·þ worshipDataList = [] for recData in addRecDataList: if not recData: continue worshipDataList.append(recData.GetString()) if not worshipDataList: return dataMsg = {"msgType":"AddCrossWorship", "worshipDataList":worshipDataList} CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Worship, dataMsg) return