10382 【后台】称号和头像管理支持升星(支持升星、设置星级,支持离线设置;优化设置结果返回信息;支持在线查询玩家当前称号、头像、头像框状态明细;)
| | |
| | | return
|
| | |
|
| | | if not tagPlayer:
|
| | | if opType == "query":
|
| | | GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_PlayerOfLine)
|
| | | return
|
| | | # 玩家不在线,先记录,等玩家上线后处理
|
| | | GMShell.AddOfflinePlayerGMTInfo(orderId, queryType, playerFind, gmCmdDict)
|
| | | return
|
| | |
| | | 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', '')
|
| | |
|
| | |
| | | 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
|
| | |
| | | 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
|
| | |
| | | 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 = []
|
| | |
| | | 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:
|
| | |
| | | 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)
|
| | |
| | |
|
| | | 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
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #执行结果
|
| | | ## 执行结果
|
| | |
| | | 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
|
| | |
|
| | |
| | | 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)
|