#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package PyMongoDB.GMToolLogicProcess.Commands.GMT_Face # # @todo:GM¹¤¾ßÃüÁî - »Ã¾³¸ó # @author hxp # @date 2025-10-15 # @version 1.0 # # ÏêϸÃèÊö: GM¹¤¾ßÃüÁî - »Ã¾³¸ó # #------------------------------------------------------------------------------- #"""Version = 2025-10-15 09:30""" #------------------------------------------------------------------------------- import GMCommon import GameWorld import PlayerFace import PlayerHJG import ChConfig ## ÊÕµ½gmÃüÁîÖ´ÐÐ # @param gmCmdDict:gmÃüÁî×Öµä # @return None def OnExec(gmCmdDict): #ÃüÁî²âÊÔûͨ¹ý£¬ºóÐøÔÙµ÷ÊÔ GameWorld.Log("GMT_Face: %s" % gmCmdDict) errorMsg = "" from GMToolLogicProcess import ProjSpecialProcess Result, curPlayer = ProjSpecialProcess.GMCmdPlayerValidation(gmCmdDict, False) if Result != GMCommon.Def_Success: return Result, errorMsg faceType = gmCmdDict.get('faceType', '') opType = gmCmdDict.get('opType', '') opID = GameWorld.ToIntDef(gmCmdDict.get('opID', '0')) expireTime = GameWorld.ToIntDef(gmCmdDict.get('expireTime', '0')) setValue = GameWorld.ToIntDef(gmCmdDict.get('setValue', '0')) state, endTime, star = 0, 0, 0 isOK = False errorMsg = "" if faceType == "face": if opType == "add": isOK = PlayerFace.AddFace(curPlayer, opID, expireTime, isFree=True) elif opType == "del": isOK = PlayerFace.DelFace(curPlayer, opID) elif opType == "starUp": setValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceStar % opID) + 1 isOK = PlayerFace.SetFaceStar(curPlayer, opID, setValue) elif opType == "setStar": isOK = PlayerFace.SetFaceStar(curPlayer, opID, setValue) elif opType == "query": isOK = True state = PlayerFace.IsFaceCanUse(curPlayer, 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, isFree=True) elif opType == "del": isOK = PlayerFace.DelFacePic(curPlayer, opID) elif opType == "starUp": setValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicStar % opID) + 1 isOK = PlayerFace.SetFacePicStar(curPlayer, opID, setValue) elif opType == "setStar": isOK = PlayerFace.SetFacePicStar(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) elif faceType == "title": if opType == "add": isOK = PlayerHJG.AddTitle(curPlayer, opID, expireTime, isFree=True) elif opType == "del": isOK = PlayerHJG.DelTitle(curPlayer, opID) elif opType == "starUp": setValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TitleStar % opID) + 1 isOK = PlayerHJG.SetTitleStar(curPlayer, opID, setValue) elif opType == "setStar": isOK = PlayerHJG.SetTitleStar(curPlayer, opID, setValue) elif opType == "query": isOK = True state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_TitleState, opID) endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TitleEndTime % opID) star = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TitleStar % opID) if not isOK: 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) return GMCommon.Def_ParamErr, errorMsg endTimeStr = "δ¼¤»î" if state: endTimeStr = "ÓÀ¾Ã" if not endTime else GameWorld.ChangeTimeNumToStr(endTime) resultDict = {"opID":opID, "expireTime":expireTime, "opType":opType, "faceType":faceType, "state":state, "endTimeStr":endTimeStr, "star":star} GameWorld.Log("GMT_Face: resultDict=%s" % resultDict, curPlayer.GetPlayerID()) return Result, resultDict