From d0d6f28bee730ee64bf46adffa4f768d6af6ac0c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 19 九月 2024 10:56:34 +0800
Subject: [PATCH] 10267 【越南】【英文】【砍树】仙官新增膜拜
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorship.py | 185 ++++++++++++--------------
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py | 23 +-
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActXianXiaMJ.py | 5
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerRecData.py | 48 ++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 10 +
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameXiangong.py | 14 -
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActHorsePetTrain.py | 5
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActGubao.py | 5
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py | 5
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Xiangong.py | 3
ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py | 2
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py | 1
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py | 33 ++--
ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py | 3
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Worship.py | 12 +
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 10 +
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameRecData.py | 20 ++
17 files changed, 218 insertions(+), 166 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py b/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
index 9b7ba1e..3ce25fe 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
@@ -521,6 +521,9 @@
#查询无限制家族的行为类型列表
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]
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Worship.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Worship.py
index 78911de..d1a07ae 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Worship.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Worship.py
@@ -36,8 +36,12 @@
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', '')
@@ -94,7 +98,7 @@
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
@@ -115,13 +119,13 @@
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", ""),
})
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Xiangong.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Xiangong.py
index 6457ac6..d8a2cac 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Xiangong.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/Xiangong.py
@@ -20,6 +20,7 @@
import IpyGameDataPY
import PyDataManager
import GameXiangong
+import ChConfig
import random
import time
@@ -107,7 +108,7 @@
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))
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index 62cfc6b..12c07f6 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -477,6 +477,8 @@
return 0
def CheckServerIDInList(serverID, serverIDList):
+ if serverIDList == None:
+ return False
if not serverIDList:
return True
for serverIDInfo in serverIDList:
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py
index 200effc..e852efe 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py
@@ -1955,10 +1955,14 @@
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:
@@ -2001,21 +2005,14 @@
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
@@ -2056,7 +2053,7 @@
PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "ChampionshipOver")
# 通知新添加的膜拜
- GameWorship.SyncAddCrossWorship(worshipList)
+ GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
GameWorld.Log("===================================================================")
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameRecData.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameRecData.py
index 80f819d..8690970 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameRecData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameRecData.py
@@ -21,7 +21,6 @@
import CommFunc
import time
-import json
class GameRecData():
@@ -68,22 +67,31 @@
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):
# 检查记录值列表是否配置该记录
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
index 2f734ae..d20a603 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py
@@ -1318,6 +1318,7 @@
CrossChampionship.OnServerStart()
#跨服战场
CrossBattlefield.OnServerStart()
+ GameWorship.OnServerStart()
#红包
PlayerFamilyRedPacket.OnServerStart()
#云购
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorship.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorship.py
index 433b35b..1924699 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorship.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorship.py
@@ -20,12 +20,12 @@
import NetPackCommon
import PlayerControl
import ChPyNetSendPack
-import CrossChampionship
import PlayerViewCache
import PlayerRecData
import CrossRealmMsg
import IpyGameDataPY
import GameWorld
+import ChConfig
import random
import time
@@ -38,33 +38,30 @@
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():
+ return
+
+def GetPlayerViewInfo(playerID):
+ ## 获取膜拜对象的外观显示信息 - 本服跨服通用
+ return PlayerViewCache.GetShotCacheDict(playerID, "AccID", "VIPLV", "FightPower", "Model")
def OnPlayerLogin(curPlayer):
@@ -136,9 +133,9 @@
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())
@@ -153,14 +150,8 @@
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():
@@ -171,7 +162,7 @@
GameWorld.ErrLog("跨服服务器不允许添加非跨服膜拜! worshipType=%s" % (worshipType))
return
- ipyData = IpyGameDataPY.GetIpyGameData("Worship", worshipType, worshipValue)
+ ipyData = IpyGameDataPY.GetIpyGameDataNotLog("Worship", worshipType, worshipValue)
if not ipyData:
return
@@ -181,23 +172,41 @@
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):
## 删除膜拜玩家,本服跨服通用
@@ -259,7 +268,9 @@
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)
# 同步地图发放货币
@@ -270,63 +281,37 @@
## 检查玩家是否可膜拜该对象
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):
## 同步膜拜结果
@@ -372,13 +357,15 @@
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)
@@ -409,8 +396,10 @@
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
@@ -432,13 +421,13 @@
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
@@ -450,7 +439,7 @@
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:
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameXiangong.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameXiangong.py
index 96d3670..3db46f0 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameXiangong.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameXiangong.py
@@ -25,11 +25,9 @@
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
@@ -74,8 +72,8 @@
# 确保玩家自身一定能看到自己,跨服排位赛历史分区问题
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))
@@ -133,7 +131,7 @@
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))
@@ -173,8 +171,8 @@
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()
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
index f3f8f5d..17ac49a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
@@ -28,6 +28,7 @@
import PlayerFamily
import PyDataManager
import GameXiangong
+import GameWorship
def OnActStart(actNum):
## 活动开启
@@ -595,6 +596,8 @@
if not orderIpyDataList:
return
+ worshipType = ShareDefine.Def_WorshipType_CrossBossTrial
+ syncNewWorshipList = []
syncNewXiangongDict = {}
rankPre = 0
billboardIndex = 0
@@ -637,6 +640,8 @@
billboardIndex += 1
GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict)
+ GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList)
+ GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActGubao.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActGubao.py
index 221f58b..cf08de3 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActGubao.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActGubao.py
@@ -27,6 +27,7 @@
import PyDataManager
import CrossRealmMsg
import GameXiangong
+import GameWorship
import GameWorld
def OnActStart(actNum, ipyData):
@@ -344,6 +345,8 @@
if not orderIpyDataList:
return
+ worshipType = ShareDefine.Def_WorshipType_CrossGubaoTrain
+ syncNewWorshipList = []
syncNewXiangongDict = {}
rankPre = 0
billboardIndex = 0
@@ -386,6 +389,8 @@
billboardIndex += 1
GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict)
+ GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList)
+ GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActHorsePetTrain.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActHorsePetTrain.py
index 52d56cc..f4f4961 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActHorsePetTrain.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActHorsePetTrain.py
@@ -26,6 +26,7 @@
import PyDataManager
import CrossRealmMsg
import GameXiangong
+import GameWorship
import GameWorld
def OnActStart(actNum, ipyData):
@@ -343,6 +344,8 @@
if not orderIpyDataList:
return
+ worshipType = ShareDefine.Def_WorshipType_CrossHorsePetTrain
+ syncNewWorshipList = []
syncNewXiangongDict = {}
rankPre = 0
billboardIndex = 0
@@ -385,6 +388,8 @@
billboardIndex += 1
GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict)
+ GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList)
+ GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActXianXiaMJ.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActXianXiaMJ.py
index 02f46f9..042e119 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActXianXiaMJ.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActXianXiaMJ.py
@@ -26,6 +26,7 @@
import PyDataManager
import CrossRealmMsg
import GameXiangong
+import GameWorship
import GameWorld
def OnActStart(actNum, ipyData):
@@ -343,6 +344,8 @@
if not orderIpyDataList:
return
+ worshipType = ShareDefine.Def_WorshipType_CrossXianXiaMJ
+ syncNewWorshipList = []
syncNewXiangongDict = {}
rankPre = 0
billboardIndex = 0
@@ -385,6 +388,8 @@
billboardIndex += 1
GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, playerRank, syncNewXiangongDict)
+ GameWorship.AddWorshipPlayer(worshipType, playerRank, playerID, serverIDRangeList, syncList=syncNewWorshipList)
+ GameWorship.SendNewWorshipPlayer(syncNewWorshipList)
GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerRecData.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerRecData.py
index a471d0b..fbe659c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerRecData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerRecData.py
@@ -32,11 +32,13 @@
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
@@ -60,24 +62,39 @@
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):
@@ -258,8 +275,7 @@
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)))
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
index c37c7cc..8e1047a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py
@@ -205,22 +205,23 @@
"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):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 961d8b8..980f6e7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1376,10 +1376,16 @@
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 = (
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 961d8b8..980f6e7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1376,10 +1376,16 @@
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 = (
--
Gitblit v1.8.0