From 209a1fb4415b46739be6bef5432cf6caddb91931 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 13 九月 2024 18:23:33 +0800
Subject: [PATCH] 10261 【越南】【砍树】【英文】仙盟徽章、头像、头像框(存储激活状态及到期时间方式修改;)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyEmblem.py                                |   93 ++++--------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Face.py                    |   30 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                     |   34 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTFace.py |   15 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py                   |  192 +++++++++++----------------
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                          |   34 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                            |   10 
 7 files changed, 178 insertions(+), 230 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index e617a17..d80c511 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -49984,9 +49984,9 @@
     _pack_ = 1
     _fields_ = [
                   ("FaceID", c_int),    #头像ID
-                  ("LightTime", c_int),    #点亮时间戳
-                  ("ExpireTime", c_int),    #有效时间秒,0为配表固定时间,如果配表时间也为0即代表永久;到期时间=点亮时间+有效时间
-                  ("Star", c_ubyte),    # 星级
+                  ("State", c_ubyte),    #是否已激活
+                  ("EndTime", c_int),    #到期时间戳,0为永久
+                  ("Star", c_ubyte),    #星级
                   ]
 
     def __init__(self):
@@ -50000,8 +50000,8 @@
 
     def Clear(self):
         self.FaceID = 0
-        self.LightTime = 0
-        self.ExpireTime = 0
+        self.State = 0
+        self.EndTime = 0
         self.Star = 0
         return
 
@@ -50014,14 +50014,14 @@
     def OutputString(self):
         DumpString = '''// B1 17 头像信息 //tagMCFaceInfo:
                                 FaceID:%d,
-                                LightTime:%d,
-                                ExpireTime:%d,
+                                State:%d,
+                                EndTime:%d,
                                 Star:%d
                                 '''\
                                 %(
                                 self.FaceID,
-                                self.LightTime,
-                                self.ExpireTime,
+                                self.State,
+                                self.EndTime,
                                 self.Star
                                 )
         return DumpString
@@ -50100,8 +50100,8 @@
     _pack_ = 1
     _fields_ = [
                   ("FacePicID", c_int),    #头像框ID
-                  ("LightTime", c_int),    #点亮时间戳
-                  ("ExpireTime", c_int),    #有效时间秒,0为配表固定时间,如果配表时间也为0即代表永久;到期时间=点亮时间+有效时间
+                  ("State", c_ubyte),    #是否已激活
+                  ("EndTime", c_int),    #到期时间戳,0为永久
                   ("Star", c_ubyte),    #星级
                   ]
 
@@ -50116,8 +50116,8 @@
 
     def Clear(self):
         self.FacePicID = 0
-        self.LightTime = 0
-        self.ExpireTime = 0
+        self.State = 0
+        self.EndTime = 0
         self.Star = 0
         return
 
@@ -50130,14 +50130,14 @@
     def OutputString(self):
         DumpString = '''// B1 18 头像框信息 //tagMCFacePicInfo:
                                 FacePicID:%d,
-                                LightTime:%d,
-                                ExpireTime:%d,
+                                State:%d,
+                                EndTime:%d,
                                 Star:%d
                                 '''\
                                 %(
                                 self.FacePicID,
-                                self.LightTime,
-                                self.ExpireTime,
+                                self.State,
+                                self.EndTime,
                                 self.Star
                                 )
         return DumpString
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyEmblem.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyEmblem.py
index 50df712..87b8a0a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyEmblem.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamilyEmblem.py
@@ -26,8 +26,8 @@
 
 def GetActionEmblemID(emblemActionObj): return emblemActionObj.GetValue1()
 def SetActionEmblemID(emblemActionObj, emblemID): return emblemActionObj.SetValue1(emblemID)
-def GetActionEmblemExpireTimes(emblemActionObj): return emblemActionObj.GetValue2()
-def SetActionEmblemExpireTimes(emblemActionObj, endTime): return emblemActionObj.SetValue2(endTime)
+def GetActionEmblemEndTime(emblemActionObj): return emblemActionObj.GetValue2()
+def SetActionEmblemEndTime(emblemActionObj, endTime): return emblemActionObj.SetValue2(endTime)
 
 def GetDefaultFamilyEmblemIDList():
     ## 获取默认的仙盟徽章ID列表,即所有解锁等级为1的徽章ID
@@ -57,8 +57,8 @@
         for index in range(familyAction.Count())[::-1]: # 可能触发删除,倒序遍历
             emblemActionObj = familyAction.At(index)
             emblemID = GetActionEmblemID(emblemActionObj)
-            isExpired, endTime = IsEmblemExpired(emblemActionObj, curTime)
-            if not isExpired:
+            endTime = GetActionEmblemEndTime(emblemActionObj)
+            if not endTime or endTime > curTime:
                 #GameWorld.Log("检查仙盟徽章未过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
                 continue
             familyAction.DelAction(index)
@@ -71,40 +71,6 @@
                 PlayerFamily.SetFamilyEmblemID(family, updEmblemID)
                 family.Broadcast_FamilyChange()
     return
-
-def IsEmblemExpired(emblemActionObj, curTime):
-    ## 勋章是否过期
-    # @return: 是否过期, endTime
-        
-    endTime = -1
-    if not emblemActionObj:
-        return True, endTime
-    
-    createTime = emblemActionObj.GetTime()
-    expireTimes = GetEmblemExpireTimes(emblemActionObj)
-    if expireTimes == 0:
-        # 永久的
-        return False, 0
-    
-    if expireTimes > 0:
-        endTime = createTime + expireTimes
-        if endTime >= curTime:
-            # 未过期
-            return False, endTime
-        
-    return True, endTime
-
-def GetEmblemExpireTimes(emblemActionObj):
-    ## 获取勋章有效时长,秒
-    # @return: 0-永久;-1-无效;>0-有效秒数
-    expireTimes = GetActionEmblemExpireTimes(emblemActionObj) # 有效时长,秒
-    if not expireTimes:
-        emblemID = GetActionEmblemID(emblemActionObj)
-        ipyData = IpyGameDataPY.GetIpyGameData("FamilyEmblem", emblemID)
-        if not ipyData:
-            return -1
-        expireTimes = ipyData.GetExpireMinutes() * 60
-    return expireTimes
 
 def GetFamilyEmblemActionData(familyID, emblemID):
     ## 获取仙盟时效徽章Action数据
@@ -130,12 +96,7 @@
     if unlockFamilyLV:
         GameWorld.Log("仙盟解锁的徽章不需要添加! familyID=%s,emblemID=%s" % (familyID, emblemID))
         return
-    if setExpireTimes >= 0:
-        expireTimes = setExpireTimes
-    else:        
-        expireTimes = ipyData.GetExpireMinutes() * 60
-    GameWorld.Log("添加仙盟徽章! familyID=%s,emblemID=%s,setExpireTimes=%s,expireTimes=%s" 
-                  % (familyID, emblemID, setExpireTimes, expireTimes))
+    ipyExpireSeconds = ipyData.GetExpireMinutes() * 60
     
     curTime = int(time.time())
     emblemActionObj = GetFamilyEmblemActionData(familyID, emblemID)
@@ -146,22 +107,31 @@
         emblemActionObj.SetTime(curTime)
         emblemActionObj.SetFamilyId(familyID)
         emblemActionObj.SetActionType(actionType)
+            
+    if not emblemActionObj:
+        return
+    endTime = GetActionEmblemEndTime(emblemActionObj)
+    updEndTime = endTime
+    
+    # 指定时长的,如GM指定
+    if setExpireTimes > 0:
+        updEndTime = curTime + setExpireTimes
+        
+    # 永久
+    elif ipyExpireSeconds == 0 or setExpireTimes == 0:
+        updEndTime = 0
+        
     else:
-        isExpired, endTime = IsEmblemExpired(emblemActionObj, curTime)
-        if setExpireTimes >= 0:
-            emblemActionObj.SetTime(curTime)
-            GameWorld.Log("直接设置勋章剩余时长,重新设置获得时间! familyID=%s,emblemID=%s" % (familyID, emblemID))
-        elif isExpired:
-            emblemActionObj.SetTime(curTime)
-            GameWorld.Log("获得勋章时已过期,重新设置获得时间! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
+        # 未过期
+        if endTime > curTime:
+            updEndTime = endTime + ipyExpireSeconds
         else:
-            # 未过期,非永久的直接累加时长
-            if expireTimes > 0:
-                expireTimes += GetActionEmblemExpireTimes(emblemActionObj)
-                GameWorld.Log("获得勋章时未过期,累加有效时长! familyID=%s,emblemID=%s,expireTimes=%s" % (familyID, emblemID, expireTimes))
-                
+            updEndTime = curTime + ipyExpireSeconds
+            
+    GameWorld.Log("添加仙盟徽章! familyID=%s,emblemID=%s,setExpireTimes=%s,endTime=%s,updEndTime=%s" 
+                  % (familyID, emblemID, setExpireTimes, endTime, updEndTime))
     SetActionEmblemID(emblemActionObj, emblemID)
-    SetActionEmblemExpireTimes(emblemActionObj, expireTimes)
+    SetActionEmblemEndTime(emblemActionObj, updEndTime)
     
     # 通知
     PlayerFamilyAction.SendFamilyAction(emblemActionObj)
@@ -198,9 +168,12 @@
             return
     else:
         emblemActionObj = GetFamilyEmblemActionData(familyID, emblemID)
-        isExpired, endTime = IsEmblemExpired(emblemActionObj, int(time.time()))
-        if isExpired:
-            GameWorld.DebugLog("该徽章不存在或已过期! emblemID=%s,endTime=%s" % (emblemID, endTime), playerID)
+        if not emblemActionObj:
+            GameWorld.DebugLog("该徽章未激活! emblemID=%s" % (emblemID), playerID)
+            return
+        endTime = GetActionEmblemEndTime(emblemActionObj)
+        if endTime and endTime <= int(time.time()):
+            GameWorld.Log("该徽章已过期! familyID=%s,emblemID=%s,endTime=%s" % (familyID, emblemID, endTime))
             return
         
     GameWorld.DebugLog("更换仙盟徽章! familyID=%s,emblemID=%s" % (familyID, emblemID), playerID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 9789450..6e33d44 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4008,12 +4008,12 @@
 Def_PDict_WishingWellItemCnt = "WishingWellItemCnt_%s_%s"  # 物品数量记录 参数(类型,物品数据)
 
 #头像
-Def_PDict_FaceLightTime = "FaceLightTime_%s"  # 头像点亮时间戳,参数(头像ID)
-Def_PDict_FaceExpireTimes = "FaceExpireTimes_%s"  # 头像有效时长秒,参数(头像ID)
+Def_PDict_FaceState = "FaceState_%s"  # 头像状态,参数(key编号)
+Def_PDict_FaceEndTime = "FaceEndTime_%s"  # 头像到期时间戳,0为永久,参数(头像ID)
 Def_PDict_FaceStar = "FaceStar_%s"  # 头像星级,参数(头像ID)
-Def_PDict_FacePicLightTime = "FacePicLightTime_%s"  # 头像框点亮时间戳,参数(头像ID)
-Def_PDict_FacePicExpireTimes = "FacePicExpireTimes_%s"  # 头像框有效时长秒,参数(头像ID)
-Def_PDict_FacePicStar = "FacePicStar_%s"  # 头像框星级,参数(头像ID)
+Def_PDict_FacePicState = "FacePicState_%s"  # 头像框状态,参数(key编号)
+Def_PDict_FacePicEndTime = "FacePicEndTime_%s"  # 头像框到期时间戳,0为永久,参数(头像框ID)
+Def_PDict_FacePicStar = "FacePicStar_%s"  # 头像框星级,参数(头像框ID)
 
 #聊天气泡
 Def_PDict_ChatBubbleBoxState = "ChatBubbleBoxState_%s"  # 聊天气泡状态, 参数(key编号)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index e617a17..d80c511 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -49984,9 +49984,9 @@
     _pack_ = 1
     _fields_ = [
                   ("FaceID", c_int),    #头像ID
-                  ("LightTime", c_int),    #点亮时间戳
-                  ("ExpireTime", c_int),    #有效时间秒,0为配表固定时间,如果配表时间也为0即代表永久;到期时间=点亮时间+有效时间
-                  ("Star", c_ubyte),    # 星级
+                  ("State", c_ubyte),    #是否已激活
+                  ("EndTime", c_int),    #到期时间戳,0为永久
+                  ("Star", c_ubyte),    #星级
                   ]
 
     def __init__(self):
@@ -50000,8 +50000,8 @@
 
     def Clear(self):
         self.FaceID = 0
-        self.LightTime = 0
-        self.ExpireTime = 0
+        self.State = 0
+        self.EndTime = 0
         self.Star = 0
         return
 
@@ -50014,14 +50014,14 @@
     def OutputString(self):
         DumpString = '''// B1 17 头像信息 //tagMCFaceInfo:
                                 FaceID:%d,
-                                LightTime:%d,
-                                ExpireTime:%d,
+                                State:%d,
+                                EndTime:%d,
                                 Star:%d
                                 '''\
                                 %(
                                 self.FaceID,
-                                self.LightTime,
-                                self.ExpireTime,
+                                self.State,
+                                self.EndTime,
                                 self.Star
                                 )
         return DumpString
@@ -50100,8 +50100,8 @@
     _pack_ = 1
     _fields_ = [
                   ("FacePicID", c_int),    #头像框ID
-                  ("LightTime", c_int),    #点亮时间戳
-                  ("ExpireTime", c_int),    #有效时间秒,0为配表固定时间,如果配表时间也为0即代表永久;到期时间=点亮时间+有效时间
+                  ("State", c_ubyte),    #是否已激活
+                  ("EndTime", c_int),    #到期时间戳,0为永久
                   ("Star", c_ubyte),    #星级
                   ]
 
@@ -50116,8 +50116,8 @@
 
     def Clear(self):
         self.FacePicID = 0
-        self.LightTime = 0
-        self.ExpireTime = 0
+        self.State = 0
+        self.EndTime = 0
         self.Star = 0
         return
 
@@ -50130,14 +50130,14 @@
     def OutputString(self):
         DumpString = '''// B1 18 头像框信息 //tagMCFacePicInfo:
                                 FacePicID:%d,
-                                LightTime:%d,
-                                ExpireTime:%d,
+                                State:%d,
+                                EndTime:%d,
                                 Star:%d
                                 '''\
                                 %(
                                 self.FacePicID,
-                                self.LightTime,
-                                self.ExpireTime,
+                                self.State,
+                                self.EndTime,
                                 self.Star
                                 )
         return DumpString
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Face.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Face.py
index 2df79e7..b8a554b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Face.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Face.py
@@ -54,10 +54,10 @@
                 faceID = ipyData.GetFaceID()
                 if ipyData.GetUnlockDefault():
                     continue
-                if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceLightTime % faceID):
+                if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID):
                     continue
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceLightTime % faceID, 0)
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceExpireTimes % faceID, 0)
+                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:
@@ -68,8 +68,8 @@
             if ipyData.GetUnlockDefault():
                 GameWorld.DebugAnswer(curPlayer, "该头像默认激活:%s" % faceID)
                 return
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceLightTime % faceID, 0)
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceExpireTimes % faceID, 0)
+            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)
@@ -79,8 +79,9 @@
         faceID = msgList[1] if len(msgList) > 1 else 0
         expireTimes = msgList[2] if len(msgList) > 2 else None
         if PlayerFace.AddFace(curPlayer, faceID, expireTimes):
-            endTimeStr = PlayerFace.GetEndTimeStr(PlayerFace.GetFaceEndTime(curPlayer, faceID))
-            GameWorld.DebugAnswer(curPlayer, "添加头像成功:%s,%s" % (faceID, endTimeStr))
+            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))
                     
@@ -105,10 +106,10 @@
                 facePicID = ipyData.GetFacePicID()
                 if ipyData.GetUnlockDefault():
                     continue
-                if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicLightTime % facePicID):
+                if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID):
                     continue
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicLightTime % facePicID, 0)
-                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicExpireTimes % facePicID, 0)
+                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:
@@ -119,8 +120,8 @@
             if ipyData.GetUnlockDefault():
                 GameWorld.DebugAnswer(curPlayer, "该头像框默认激活:%s" % facePicID)
                 return
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicLightTime % facePicID, 0)
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicExpireTimes % facePicID, 0)
+            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)
@@ -130,8 +131,9 @@
         facePicID = msgList[1] if len(msgList) > 1 else 0
         expireTimes = msgList[2] if len(msgList) > 2 else None
         if PlayerFace.AddFacePic(curPlayer, facePicID, expireTimes):
-            endTimeStr = PlayerFace.GetEndTimeStr(PlayerFace.GetFacePicEndTime(curPlayer, facePicID))
-            GameWorld.DebugAnswer(curPlayer, "添加头像框成功:%s,%s" % (facePicID, endTimeStr))
+            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))
                     
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 3ed5639..7814b4e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFace.py
@@ -44,13 +44,12 @@
         if ipyData.GetUnlockDefault():
             # 默认激活的不处理
             continue
-        lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceLightTime % faceID)
-        expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceExpireTimes % faceID) # 有效时长,秒
-        if not lightTime or not expireTimes:
-            # 未激活或永久的不处理
+        if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID):
+            # 未激活的不处理
             continue
-        endTime = lightTime + expireTimes
-        if endTime > curTime:
+        endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % faceID)
+        if not endTime or endTime > curTime:
+            # 永久或未过期
             continue
         if DelFace(curPlayer, faceID, False, "FaceTimeout"):
             delFaceList.append(faceID)
@@ -65,13 +64,12 @@
         if ipyData.GetUnlockDefault():
             # 默认激活的不处理
             continue
-        lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicLightTime % facePicID)
-        expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicExpireTimes % facePicID) # 有效时长,秒
-        if not lightTime or not expireTimes:
-            # 未激活或永久的不处理
+        if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID):
+            # 未激活的不处理
             continue
-        endTime = lightTime + expireTimes
-        if endTime > curTime:
+        endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % facePicID)
+        if not endTime or endTime > curTime:
+            # 永久或未过期
             continue
         if DelFacePic(curPlayer, facePicID, False, "FacePicTimeout"):
             delFacePicList.append(facePicID)
@@ -93,37 +91,33 @@
     ipyExpireSeconds = ipyData.GetExpireMinutes() * 60
     
     curTime = int(time.time())
-    lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceLightTime % faceID)
-    expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceExpireTimes % faceID) # 有效时长,秒
-    GameWorld.Log("添加头像: faceID=%s,setExpireTimes=%s,lightTime=%s,expireTimes=%s,ipyExpireSeconds=%s,curTime=%s" 
-                  % (faceID, setExpireTimes, lightTime, expireTimes, ipyExpireSeconds, curTime), playerID)
-    updLightTime = lightTime
-    updExpireTimes = expireTimes
+    state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID)
+    endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % faceID)
+    GameWorld.Log("添加头像: faceID=%s,setExpireTimes=%s,state=%s,endTime=%s,ipyExpireSeconds=%s,curTime=%s" 
+                  % (faceID, setExpireTimes, state, endTime, ipyExpireSeconds, curTime), playerID)
+    updEndTime = endTime
     
     # 指定时长的,如GM指定
-    if setExpireTimes >= 0:
-        updLightTime = curTime
-        updExpireTimes = setExpireTimes
-        GameWorld.Log("    指定头像时长: faceID=%s,updLightTime=%s,updExpireTimes=%s" % (faceID, updLightTime, updExpireTimes), playerID)
+    if setExpireTimes > 0:
+        updEndTime = curTime + setExpireTimes
+        GameWorld.Log("    指定头像时长: faceID=%s,updEndTime=%s" % (faceID, updEndTime), playerID)
         
     # 永久
-    elif ipyExpireSeconds == 0:
-        updLightTime = curTime
-        updExpireTimes = 0
-        GameWorld.Log("    添加永久头像: faceID=%s,updLightTime=%s,updExpireTimes=%s" % (faceID, updLightTime, updExpireTimes), playerID)
+    elif ipyExpireSeconds == 0 or setExpireTimes == 0:
+        updEndTime = 0
+        GameWorld.Log("    添加永久头像: faceID=%s,updEndTime=%s" % (faceID, updEndTime), playerID)
         
     else:
         # 未过期
-        if lightTime and expireTimes and (lightTime + expireTimes) > curTime:
-            updExpireTimes = expireTimes + ipyExpireSeconds
-            GameWorld.Log("    累加头像时长: faceID=%s,updLightTime=%s,updExpireTimes=%s" % (faceID, updLightTime, updExpireTimes), playerID)
+        if endTime > curTime:
+            updEndTime = endTime + ipyExpireSeconds
+            GameWorld.Log("    累加头像时长: faceID=%s,updEndTime=%s" % (faceID, updEndTime), playerID)
         else:
-            updLightTime = curTime
-            updExpireTimes = ipyExpireSeconds
-            GameWorld.Log("    重新激活头像: faceID=%s,updLightTime=%s,updExpireTimes=%s" % (faceID, updLightTime, updExpireTimes), playerID)
+            updEndTime = curTime + ipyExpireSeconds
+            GameWorld.Log("    重新激活头像: faceID=%s,updEndTime=%s" % (faceID, updEndTime), playerID)
             
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceLightTime % faceID, updLightTime)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceExpireTimes % faceID, updExpireTimes)
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID, 1)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceEndTime % faceID, updEndTime)
     RefreshFaceAttr(curPlayer)
     SyncFaceInfo(curPlayer, [faceID])
     return True
@@ -136,8 +130,8 @@
     if ipyData.GetUnlockDefault():
         return
     GameWorld.Log("删除头像: faceID=%s,notifyMail=%s" % (faceID, notifyMail), playerID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceLightTime % faceID, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceExpireTimes % faceID, 0)
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FaceEndTime % faceID, 0)
     # 星级不重置,重新激活后再次生效
     
     if curPlayer.GetFace() == faceID:
@@ -189,37 +183,33 @@
     ipyExpireSeconds = ipyData.GetExpireMinutes() * 60
     
     curTime = int(time.time())
-    lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicLightTime % facePicID)
-    expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicExpireTimes % facePicID) # 有效时长,秒
-    GameWorld.Log("添加头像框: facePicID=%s,setExpireTimes=%s,lightTime=%s,expireTimes=%s,ipyExpireSeconds=%s,curTime=%s" 
-                  % (facePicID, setExpireTimes, lightTime, expireTimes, ipyExpireSeconds, curTime), playerID)
-    updLightTime = lightTime
-    updExpireTimes = expireTimes
+    state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID)
+    endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % facePicID)
+    GameWorld.Log("添加头像框: facePicID=%s,setExpireTimes=%s,state=%s,endTime=%s,ipyExpireSeconds=%s,curTime=%s" 
+                  % (facePicID, setExpireTimes, state, endTime, ipyExpireSeconds, curTime), playerID)
+    updEndTime = endTime
     
     # 指定时长的,如GM指定
-    if setExpireTimes >= 0:
-        updLightTime = curTime
-        updExpireTimes = setExpireTimes
-        GameWorld.Log("    指定头像框时长: facePicID=%s,updLightTime=%s,updExpireTimes=%s" % (facePicID, updLightTime, updExpireTimes), playerID)
+    if setExpireTimes > 0:
+        updEndTime = curTime + setExpireTimes
+        GameWorld.Log("    指定头像框时长: facePicID=%s,updEndTime=%s" % (facePicID, updEndTime), playerID)
         
     # 永久
-    elif ipyExpireSeconds == 0:
-        updLightTime = curTime
-        updExpireTimes = 0
-        GameWorld.Log("    添加永久头像框: facePicID=%s,updLightTime=%s,updExpireTimes=%s" % (facePicID, updLightTime, updExpireTimes), playerID)
+    elif ipyExpireSeconds == 0 or setExpireTimes == 0:
+        updEndTime = 0
+        GameWorld.Log("    添加永久头像框: facePicID=%s,updEndTime=%s" % (facePicID, updEndTime), playerID)
         
     else:
         # 未过期
-        if lightTime and expireTimes and (lightTime + expireTimes) > curTime:
-            updExpireTimes = expireTimes + ipyExpireSeconds
-            GameWorld.Log("    累加头像框时长: facePicID=%s,updLightTime=%s,updExpireTimes=%s" % (facePicID, updLightTime, updExpireTimes), playerID)
+        if endTime > curTime:
+            updEndTime = endTime + ipyExpireSeconds
+            GameWorld.Log("    累加头像框时长: facePicID=%s,updEndTime=%s" % (facePicID, updEndTime), playerID)
         else:
-            updLightTime = curTime
-            updExpireTimes = ipyExpireSeconds
-            GameWorld.Log("    重新激活头像框: facePicID=%s,updLightTime=%s,updExpireTimes=%s" % (facePicID, updLightTime, updExpireTimes), playerID)
+            updEndTime = curTime + ipyExpireSeconds
+            GameWorld.Log("    重新激活头像框: facePicID=%s,updEndTime=%s" % (facePicID, updEndTime), playerID)
             
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicLightTime % facePicID, updLightTime)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicExpireTimes % facePicID, updExpireTimes)
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID, 1)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicEndTime % facePicID, updEndTime)
     RefreshFacePicAttr(curPlayer)
     SyncFacePicInfo(curPlayer, [facePicID])
     return True
@@ -232,8 +222,8 @@
     if ipyData.GetUnlockDefault():
         return
     GameWorld.Log("删除头像框: facePicID=%s,notifyMail=%s" % (facePicID, notifyMail), playerID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicLightTime % facePicID, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicExpireTimes % facePicID, 0)
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FacePicEndTime % facePicID, 0)
     # 星级不重置,重新激活后再次生效
     
     if curPlayer.GetFacePic() == facePicID:
@@ -249,55 +239,33 @@
         PlayerControl.SendMailByKey(notifyMail, [playerID], [], [facePicID])
     return True
 
-def GetFaceEndTime(curPlayer, faceID, ipyData=None):
-    ## 头像结束时间戳
-    # @return: -1-未激活;0-永久;>0-具体结束时间戳
-    lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceLightTime % faceID)
-    expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceExpireTimes % faceID)
-    if lightTime:
-        if expireTimes:
-            return lightTime + expireTimes
-        return 0
-    if not ipyData:
-        ipyData = IpyGameDataPY.GetIpyGameData("PlayerFace", faceID)
-    if ipyData and ipyData.GetUnlockDefault():
-        return 0
-    return -1
-
 def IsFaceCanUse(curPlayer, faceID, ipyData=None):
     ## 头像是否可用
-    # 这里不判断严谨的过期时间,即不对比当前时间,只要endTime>=0即可
-    # 过期逻辑由过期函数定时处理删除即可,可能有1分钟延迟
-    return GetFaceEndTime(curPlayer, faceID, ipyData) >= 0
-
-def GetFacePicEndTime(curPlayer, facePicID, ipyData=None):
-    ## 头像框结束时间戳
-    # @return: -1-未激活;0-永久;>0-具体结束时间戳
-    lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicLightTime % facePicID)
-    expireTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicExpireTimes % facePicID)
-    if lightTime:
-        if expireTimes:
-            return lightTime + expireTimes
-        return 0
+    state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID)
+    if state:
+        return True
+    
     if not ipyData:
-        ipyData = IpyGameDataPY.GetIpyGameData("PlayerFacePic", facePicID)
-    if ipyData and ipyData.GetUnlockDefault():
-        return 0
-    return -1
+        ipyData = IpyGameDataPY.GetIpyGameData("PlayerFace", faceID)
+    if ipyData:
+        if ipyData.GetUnlockDefault():
+            return True
+        
+    return False
 
 def IsFacePicCanUse(curPlayer, facePicID, ipyData=None):
     ## 头像框是否可用
-    # 这里不判断严谨的过期时间,即不对比当前时间,只要endTime>=0即可
-    # 过期逻辑由过期函数定时处理删除即可,可能有1分钟延迟
-    return GetFacePicEndTime(curPlayer, facePicID, ipyData) >= 0
-
-def GetEndTimeStr(endTime):
-    endTimeStr = "未激活"
-    if endTime == 0:
-        endTimeStr = "永久"
-    elif endTime > 0:
-        endTimeStr = GameWorld.ChangeTimeNumToStr(endTime)
-    return endTimeStr
+    state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID)
+    if state:
+        return True
+    
+    if not ipyData:
+        ipyData = IpyGameDataPY.GetIpyGameData("PlayerFacePic", facePicID)
+    if ipyData:
+        if ipyData.GetUnlockDefault():
+            return True
+        
+    return False
 
 def RefreshFaceAttr(curPlayer):
     CalcFaceAttr(curPlayer)
@@ -513,16 +481,16 @@
         
     faceList = []
     for faceID in syncIDList:
-        lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceLightTime % faceID)
-        if not lightTime and faceIDList == None:
+        state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, faceID)
+        if not state and faceIDList == None:
             continue
         face = ChPyNetSendPack.tagMCFace()
         face.FaceID = faceID
-        face.LightTime = lightTime
-        face.ExpireTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceExpireTimes % faceID)
+        face.State = state
+        face.EndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % faceID)
         face.Star = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceStar % faceID)
         faceList.append(face)
-    
+        
     if not faceList:
         return
     
@@ -544,13 +512,13 @@
         
     facePicList = []
     for facePicID in syncIDList:
-        lightTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicLightTime % facePicID)
-        if not lightTime and facePicIDList == None:
+        state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, facePicID)
+        if not state and facePicIDList == None:
             continue
         facePic = ChPyNetSendPack.tagMCFacePic()
         facePic.FacePicID = facePicID
-        facePic.LightTime = lightTime
-        facePic.ExpireTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicExpireTimes % facePicID)
+        facePic.State = state
+        facePic.EndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % facePicID)
         facePic.Star = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicStar % facePicID)
         facePicList.append(facePic)
         
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 e1f89df..607aeb8 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
@@ -19,6 +19,7 @@
 import DataRecordPack
 import PlayerFace
 import GMCommon
+import ChConfig
 
 #---------------------------------------------------------------------
 #全局变量
@@ -41,20 +42,22 @@
     Result = GMCommon.Def_Success
     orderId, isOnlineGMT, faceType, opID, expireTime, opType = packCMDList
     
-    endTime = -1
+    state, endTime = 0, 0
     isOK = False
     if faceType == "face":
         if opType == "add":
             isOK = PlayerFace.AddFace(curPlayer, opID, expireTime)
         elif opType == "del":
             isOK = PlayerFace.DelFace(curPlayer, opID)
-        endTime = PlayerFace.GetFaceEndTime(curPlayer, opID)
+        state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FaceState, opID)
+        endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FaceEndTime % opID)
     elif faceType == "facePic":
         if opType == "add":
             isOK = PlayerFace.AddFacePic(curPlayer, opID, expireTime)
         elif opType == "del":
             isOK = PlayerFace.DelFacePic(curPlayer, opID)
-        endTime = PlayerFace.GetFacePicEndTime(curPlayer, opID)
+        state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_FacePicState, opID)
+        endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FacePicEndTime % opID)
         
     if not isOK:
         errorMsg = "%s %s fail! Please check that the ID(%s) is correct." % (opType, faceType, opID)
@@ -63,9 +66,11 @@
         GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg))
         return
     
-    endTimeStr = PlayerFace.GetEndTimeStr(endTime)
+    endTimeStr = "未激活"
+    if state:
+        endTimeStr = "永久" if not endTime else GameWorld.ChangeTimeNumToStr(endTime)
     resultDict = {"opID":opID, "expireTime":expireTime, "isOnlineGMT":isOnlineGMT, "opType":opType, 
-                  "faceType":faceType, "endTime":endTime, "endTimeStr":endTimeStr}
+                  "faceType":faceType, "state":state, "endTimeStr":endTimeStr}
     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