From fb1c33cc437d24b27f5e4e550005e40132019b60 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 06 二月 2025 16:48:58 +0800
Subject: [PATCH] 10382 【后台】称号和头像管理支持升星(支持升星、设置星级,支持离线设置;优化设置结果返回信息;支持在线查询玩家当前称号、头像、头像框状态明细;)
---
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Face.py | 10 +++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py | 24 +++++++++++
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py | 30 ++++++++++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py | 46 +++++++++++++++++++++++
5 files changed, 103 insertions(+), 10 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
index 15483ec..7ee2500 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddTitle.py
@@ -56,6 +56,9 @@
return
if not tagPlayer:
+ if opType == "query":
+ GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_PlayerOfLine)
+ return
# 玩家不在线,先记录,等玩家上线后处理
GMShell.AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Face.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Face.py
index e41df48..8c45be3 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Face.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_Face.py
@@ -30,6 +30,7 @@
playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
opID = GameWorld.ToIntDef(gmCmdDict.get('opID', ''), 0)
expireTime = GameWorld.ToIntDef(gmCmdDict.get('expireTime', ''), None)
+ setValue = GameWorld.ToIntDef(gmCmdDict.get('setValue', ''), 0)
faceType = gmCmdDict.get('faceType', '')
opType = gmCmdDict.get('opType', '')
@@ -53,23 +54,26 @@
return
if not tagPlayer:
- #GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_PlayerOfLine)
+ if opType == "query":
+ GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_PlayerOfLine)
+ return
# 玩家不在线,先记录,等玩家上线后处理
GMShell.AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict)
return
isOnlineGMT = True # 是否是在线接收的GM工具命令
- GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTFace", [orderId, isOnlineGMT, faceType, opID, expireTime, opType], False)
+ GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, "GMTFace", [orderId, isOnlineGMT, faceType, opID, expireTime, opType, setValue], False)
return
def OnOfflineGMTInfo(curPlayer, tagMapID, gmCmdDict):
orderId = gmCmdDict.get('orderId', '')
opID = GameWorld.ToIntDef(gmCmdDict.get('opID', ''), 0)
expireTime = GameWorld.ToIntDef(gmCmdDict.get('expireTime', ''), None)
+ setValue = GameWorld.ToIntDef(gmCmdDict.get('setValue', ''), 0)
faceType = gmCmdDict.get('faceType', '')
opType = gmCmdDict.get('opType', '')
isOnlineGMT = False # 是否是在线接收的GM工具命令
- cmdStr = str([orderId, isOnlineGMT, faceType, opID, expireTime, opType])
+ cmdStr = str([orderId, isOnlineGMT, faceType, opID, expireTime, opType, setValue])
GameWorld.GetPlayerManager().MapServer_QueryPlayer(0, 0, curPlayer.GetPlayerID(), tagMapID, 'GMTFace',
cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex())
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py
index dbb05f3..db104b2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py
@@ -419,6 +419,29 @@
SyncFaceInfo(curPlayer, [faceID])
return
+def GMSetFaceStar(curPlayer, faceID, setValue=None):
+ ## GM设置星级
+
+ if not IsFaceCanUse(curPlayer, faceID):
+ return False, "The player has not activated the faceID(%s)" % faceID
+
+ if setValue == None:
+ curStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceStar % faceID)
+ setStar = curStar + 1 # 没指定星级时默认升星
+ else:
+ setStar = setValue
+
+ if setStar > 0:
+ if not IpyGameDataPY.GetIpyGameData("PlayerFaceStar", faceID, setStar):
+ return False, "The faceID(%s) star(%s) is not exist." % (faceID, setStar)
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceStar % faceID, setStar)
+ GameWorld.Log("GM设置头像星级: faceID=%s,setStar=%s" % (faceID, setStar), curPlayer.GetPlayerID())
+
+ RefreshFaceAttr(curPlayer)
+ SyncFaceInfo(curPlayer, [faceID])
+ return True, ""
+
#// B2 28 头像框幻化 #tagCMFacePicChange
#
#struct tagCMFacePicChange
@@ -479,6 +502,29 @@
SyncFacePicInfo(curPlayer, [facePicID])
return
+def GMSetFacePicStar(curPlayer, facePicID, setValue=None):
+ ## GM设置星级
+
+ if not IsFacePicCanUse(curPlayer, facePicID):
+ return False, "The player has not activated the facePicID(%s)" % facePicID
+
+ if setValue == None:
+ curStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicStar % facePicID)
+ setStar = curStar + 1 # 没指定星级时默认升星
+ else:
+ setStar = setValue
+
+ if setStar > 0:
+ if not IpyGameDataPY.GetIpyGameData("PlayerFacePicStar", facePicID, setStar):
+ return False, "The setStar(%s) star(%s) is not exist." % (setStar, setStar)
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicStar % facePicID, setStar)
+ GameWorld.Log("GM设置头像框星级: facePicID=%s,setStar=%s" % (facePicID, setStar), curPlayer.GetPlayerID())
+
+ RefreshFacePicAttr(curPlayer)
+ SyncFacePicInfo(curPlayer, [facePicID])
+ return True, ""
+
def SyncFaceInfo(curPlayer, faceIDList=None):
if faceIDList == None:
syncIDList = []
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
index e0f158d..2c3032d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTAddTitle.py
@@ -52,6 +52,8 @@
isOK, errorMsg = PlayerDienstgrad.GMSetTitleStar(curPlayer, titleID)
elif opType == "setStar":
isOK, errorMsg = PlayerDienstgrad.GMSetTitleStar(curPlayer, titleID, setValue)
+ elif opType == "query":
+ isOK = True
if not isOK:
if errorMsg:
@@ -63,8 +65,15 @@
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
return
+ curDienstgradMgr = curPlayer.GetDienstgradManager()
+ curGrad = curDienstgradMgr.GetDienstgrad(titleID)
+ endTimeStr = "未激活"
+ if curGrad:
+ endTime = GetEndTime(curGrad, titleID)
+ endTimeStr = "永久" if not endTime else GameWorld.ChangeTimeNumToStr(endTime)
+
curStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TitleStar % titleID)
- resultDict = {"titleID":titleID, "expireTime":expireTime, "isOnlineGMT":isOnlineGMT, "opType":opType, "star":curStar}
+ resultDict = {"titleID":titleID, "expireTime":expireTime, "isOnlineGMT":isOnlineGMT, "opType":opType, "star":curStar, "endTimeStr":endTimeStr}
GameWorld.Log("GMT_AddTitle, isOnlineGMT=%s,resultDict=%s" % (isOnlineGMT, resultDict), curPlayer.GetPlayerID())
#流向 记录
DataRecordPack.DR_ToolGMOperate(query_ID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_AddTitle', resultDict)
@@ -75,6 +84,19 @@
return
+def GetEndTime(curGrad, titleID):
+ if not curGrad:
+ return 0
+ curExpireTime = curGrad.GetExpireTime() # 特殊指定有效期
+ if not curExpireTime:
+ curDienstgradData = PlayerDienstgrad.GetDienstgradData(titleID)
+ if curDienstgradData:
+ curExpireTime = curDienstgradData.GetExpireTime()
+ if curExpireTime <= 0:
+ return 0
+ createTimeStr = curGrad.GetCreateTimeStr()
+ return GameWorld.ChangeTimeStrToNum(createTimeStr) + curExpireTime
+
#---------------------------------------------------------------------
#执行结果
## 执行结果
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py
index 607aeb8..d1acb80 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py
@@ -40,29 +40,47 @@
return
Result = GMCommon.Def_Success
- orderId, isOnlineGMT, faceType, opID, expireTime, opType = packCMDList
+ orderId, isOnlineGMT, faceType, opID, expireTime, opType, setValue = packCMDList
- state, endTime = 0, 0
+ state, endTime, star = 0, 0, 0
isOK = False
+ errorMsg = ""
if faceType == "face":
if opType == "add":
isOK = PlayerFace.AddFace(curPlayer, opID, expireTime)
elif opType == "del":
isOK = PlayerFace.DelFace(curPlayer, opID)
+ elif opType == "starUp":
+ isOK, errorMsg = PlayerFace.GMSetFaceStar(curPlayer, opID)
+ elif opType == "setStar":
+ isOK, errorMsg = PlayerFace.GMSetFaceStar(curPlayer, opID, setValue)
+ elif opType == "query":
+ isOK = True
state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, opID)
endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % opID)
+ star = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceStar % opID)
elif faceType == "facePic":
if opType == "add":
isOK = PlayerFace.AddFacePic(curPlayer, opID, expireTime)
elif opType == "del":
isOK = PlayerFace.DelFacePic(curPlayer, opID)
+ elif opType == "starUp":
+ isOK, errorMsg = PlayerFace.GMSetFacePicStar(curPlayer, opID)
+ elif opType == "setStar":
+ isOK, errorMsg = PlayerFace.GMSetFacePicStar(curPlayer, opID, setValue)
+ elif opType == "query":
+ isOK = True
state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, opID)
endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % opID)
+ star = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicStar % opID)
if not isOK:
- errorMsg = "%s %s fail! Please check that the ID(%s) is correct." % (opType, faceType, opID)
- GameWorld.Log("GMT_AddTitle, errorMsg=%s" % errorMsg, curPlayer.GetPlayerID())
- resultMsg = str([orderId, errorMsg, 'GMT_AddTitle', GMCommon.Def_Unknow])
+ if errorMsg:
+ errorMsg = "%s %s fail! %s" % (opType, faceType, errorMsg)
+ else:
+ errorMsg = "%s %s fail! Please check that the ID(%s) is correct." % (opType, faceType, opID)
+ GameWorld.Log("GMT_Face, errorMsg=%s" % errorMsg, curPlayer.GetPlayerID())
+ resultMsg = str([orderId, errorMsg, 'GMT_Face', GMCommon.Def_Unknow])
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
return
@@ -70,7 +88,7 @@
if state:
endTimeStr = "永久" if not endTime else GameWorld.ChangeTimeNumToStr(endTime)
resultDict = {"opID":opID, "expireTime":expireTime, "isOnlineGMT":isOnlineGMT, "opType":opType,
- "faceType":faceType, "state":state, "endTimeStr":endTimeStr}
+ "faceType":faceType, "state":state, "endTimeStr":endTimeStr, "star":star}
GameWorld.Log("GMT_Face, isOnlineGMT=%s,resultDict=%s" % (isOnlineGMT, resultDict), curPlayer.GetPlayerID())
#流向 记录
DataRecordPack.DR_ToolGMOperate(query_ID, curPlayer.GetPlayerName(), curPlayer.GetAccID(), 'GMT_Face', resultDict)
--
Gitblit v1.8.0