#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # ##@package GM.Commands.Face # # @todo:Í·ÏñÍ·Ïñ¿ò # @author hxp # @date 2024-09-12 # @version 1.0 # # ÏêϸÃèÊö: Í·ÏñÍ·Ïñ¿ò # #------------------------------------------------------------------------------- #"""Version = 2024-09-12 12:00""" #------------------------------------------------------------------------------- import GameWorld import IpyGameDataPY import PlayerControl import PlayerFace import ChConfig #Âß¼­ÊµÏÖ ## GMÃüÁîÖ´ÐÐÈë¿Ú # @param curPlayer µ±Ç°Íæ¼Ò # @param msgList ²ÎÊýÁбí # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def OnExec(curPlayer, msgList): if not msgList: GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr()) GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·Ïñ: Face f1 Í·ÏñID [ÓÐЧÃë]") GameWorld.DebugAnswer(curPlayer, "ɾ³ýÍ·Ïñ: Face f0 [Í·ÏñID]") GameWorld.DebugAnswer(curPlayer, "Í·ÏñÐǼ¶: Face fs Í·ÏñID ÐǼ¶") GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·¿ò: Face p1 Í·¿òID [ÓÐЧÃë]") GameWorld.DebugAnswer(curPlayer, "ɾ³ýÍ·¿ò: Face p0 [Í·¿òID]") GameWorld.DebugAnswer(curPlayer, "Í·¿òÐǼ¶: Face ps Í·¿òID ÐǼ¶") GameWorld.DebugAnswer(curPlayer, "ÓÐЧÃë:²»Ìî¶Á±í,0-ÓÀ¾Ã,>0Ö¸¶¨ÓÐЧÃë") return syncFaceIDList = [] syncFacePicIDList = [] ipyDataMgr = IpyGameDataPY.IPY_Data() value1 = msgList[0] # ɾ³ýÍ·Ïñ if value1 == "f0": faceID = msgList[1] if len(msgList) > 1 else 0 if not faceID: for index in range(ipyDataMgr.GetPlayerFaceCount()): ipyData = ipyDataMgr.GetPlayerFaceByIndex(index) faceID = ipyData.GetFaceID() if ipyData.GetUnlockDefault(): continue if ipyData.GetCustomPlayerID(): continue if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID): continue GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceEndTime % faceID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceStar % faceID, 0) syncFaceIDList.append(faceID) else: ipyData = IpyGameDataPY.GetIpyGameData("PlayerFace", faceID) if not ipyData: GameWorld.DebugAnswer(curPlayer, "¸ÃÍ·Ïñ²»´æÔÚ:%s" % faceID) return if ipyData.GetUnlockDefault(): GameWorld.DebugAnswer(curPlayer, "¸ÃÍ·ÏñĬÈϼ¤»î:%s" % faceID) return if ipyData.GetCustomPlayerID(): GameWorld.DebugAnswer(curPlayer, "¶¨ÖÆÍ·Ïñ²»´¦Àí:%s" % faceID) return GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceEndTime % faceID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceStar % faceID, 0) syncFaceIDList.append(faceID) GameWorld.DebugAnswer(curPlayer, "ɾ³ýÍ·Ïñ:%s" % syncFaceIDList) # Ìí¼ÓÍ·Ïñ elif value1 == "f1": faceID = msgList[1] if len(msgList) > 1 else 0 expireTimes = msgList[2] if len(msgList) > 2 else None if PlayerFace.AddFace(curPlayer, faceID, expireTimes): endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % faceID) endTimeStr = "ÓÀ¾Ã" if not endTime else GameWorld.ChangeTimeNumToStr(endTime) GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·Ïñ³É¹¦:%s,µ½ÆÚ:%s" % (faceID, endTimeStr)) else: GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·Ïñʧ°Ü:%s" % (faceID)) # Í·ÏñÐǼ¶ elif value1 == "fs": faceID = msgList[1] if len(msgList) > 1 else 0 faceStar = msgList[2] if len(msgList) > 2 else 0 starIpyData = IpyGameDataPY.GetIpyGameData("PlayerFaceStar", faceID, faceStar) if not starIpyData: GameWorld.DebugAnswer(curPlayer, "Í·ÏñÐǼ¶²»´æÔÚ:%s,star:%s" % (faceID, faceStar)) return GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍ·ÏñÐǼ¶:%s,ÐÇ:%s" % (faceID, faceStar)) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceStar % faceID, faceStar) syncFaceIDList.append(faceID) # ɾ³ýÍ·Ïñ¿ò elif value1 == "p0": facePicID = msgList[1] if len(msgList) > 1 else 0 if not facePicID: for index in range(ipyDataMgr.GetPlayerFacePicCount()): ipyData = ipyDataMgr.GetPlayerFacePicByIndex(index) facePicID = ipyData.GetFacePicID() if ipyData.GetUnlockDefault(): continue if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID): continue GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicEndTime % facePicID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicStar % facePicID, 0) syncFacePicIDList.append(facePicID) else: ipyData = IpyGameDataPY.GetIpyGameData("PlayerFacePic", facePicID) if not ipyData: GameWorld.DebugAnswer(curPlayer, "¸ÃÍ·Ïñ¿ò²»´æÔÚ:%s" % facePicID) return if ipyData.GetUnlockDefault(): GameWorld.DebugAnswer(curPlayer, "¸ÃÍ·Ïñ¿òĬÈϼ¤»î:%s" % facePicID) return GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicEndTime % facePicID, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicStar % facePicID, 0) syncFacePicIDList.append(facePicID) GameWorld.DebugAnswer(curPlayer, "ɾ³ýÍ·Ïñ¿ò:%s" % syncFacePicIDList) # Ìí¼ÓÍ·Ïñ¿ò elif value1 == "p1": facePicID = msgList[1] if len(msgList) > 1 else 0 expireTimes = msgList[2] if len(msgList) > 2 else None if PlayerFace.AddFacePic(curPlayer, facePicID, expireTimes): endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % facePicID) endTimeStr = "ÓÀ¾Ã" if not endTime else GameWorld.ChangeTimeNumToStr(endTime) GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·Ïñ¿ò³É¹¦:%s,µ½ÆÚ:%s" % (facePicID, endTimeStr)) else: GameWorld.DebugAnswer(curPlayer, "Ìí¼ÓÍ·Ïñ¿òʧ°Ü:%s" % (facePicID)) # Í·Ïñ¿òÐǼ¶ elif value1 == "ps": facePicID = msgList[1] if len(msgList) > 1 else 0 facePicStar = msgList[2] if len(msgList) > 2 else 0 starIpyData = IpyGameDataPY.GetIpyGameData("PlayerFacePicStar", facePicID, facePicStar) if not starIpyData: GameWorld.DebugAnswer(curPlayer, "Í·Ïñ¿òÐǼ¶²»´æÔÚ:%s,star:%s" % (facePicID, facePicStar)) return GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÍ·Ïñ¿òÐǼ¶:%s,ÐÇ:%s" % (facePicID, facePicStar)) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicStar % facePicID, facePicStar) syncFacePicIDList.append(facePicID) if syncFaceIDList: PlayerFace.RefreshFaceAttr(curPlayer) PlayerFace.SyncFaceInfo(curPlayer, syncFaceIDList) if syncFacePicIDList: PlayerFace.RefreshFacePicAttr(curPlayer) PlayerFace.SyncFacePicInfo(curPlayer, syncFacePicIDList) return