From b9bef849ab19b8a3d6e889e82c687eec736cbd2a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 10 十月 2025 20:42:29 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(徽章旗帜、旗号;捐献;公会加经验、加贡献度;搜索支持公会编号;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBFamily.py |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBFamily.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBFamily.py
index c8bf380..ee25408 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBFamily.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/StructData/DBFamily.py
@@ -20,6 +20,8 @@
 import GameWorld
 import ShareDefine
 import PlayerControl
+import PlayerViewCache
+import PyMongoMain
 import DBDataMgr
 import ChConfig
 import DBComm
@@ -81,12 +83,15 @@
         self.__actionDataList.append(actionData)
         return actionData
     
-    def AddAction(self, fullClear=True):
+    def AddAction(self, maxCount=None):
         ## 添加仙盟Action数据
-        # @param fullClear: 数据条数超过最大数时是否清除最早一条,并创建一条新记录
+        # @param maxCount: 可传入由配置决定的最大条数,如果为None则进一步取程序默认设定的最大条数,都没配置的话默认不限条数
         
+        fullClear = True
+        if maxCount == None:
+            maxCount = ShareDefine.ActionTypeSaveCnt.get(self.actionType, 0)
         actionData = None
-        if self.Count() >= ChConfig.ActionTypeSaveCnt.get(self.actionType, 0):
+        if maxCount and self.Count() >= maxCount:
             if not fullClear:
                 #超过记录记录不了了
                 return actionData
@@ -198,15 +203,19 @@
     def SetFmLV(self, fmLV): self.__dbData.FmLV = fmLV
     def GetContribTotal(self): return self.__dbData.ContribTotal
     def SetContribTotal(self, contribTotal): self.__dbData.ContribTotal = contribTotal
-    def GetContribWeek(self): return self.__dbData.ContribWeek
-    def SetContribWeek(self, contribWeek): self.__dbData.ContribWeek = contribWeek
+    def GetContribDay(self): return self.__dbData.ContribDay
+    def SetContribDay(self, contribDay): self.__dbData.ContribDay = contribDay
+    def GetDonateCntTotal(self): return self.__dbData.DonateCntTotal
+    def SetDonateCntTotal(self, donateCntTotal): self.__dbData.DonateCntTotal = donateCntTotal
+    def GetDonateCntDay(self): return self.__dbData.DonateCntDay
+    def SetDonateCntDay(self, donateCntDay): self.__dbData.DonateCntDay = donateCntDay
     def GetBuffer(self): return self.__dbData.getBuffer()
     
     def RefreshMemberByID(self, playerID):
         ## 根据玩家ID更新成员数据,一般用于离线功能,如添加离线成员,直接使用查看缓存更新
         if playerID != self.GetPlayerID():
             return
-        viewCache = DBDataMgr.GetPlayerViewCacheMgr().FindViewCache(playerID)
+        viewCache = PlayerViewCache.FindViewCache(playerID)
         if not viewCache:
             return
         self.SetPlayerName(viewCache.GetPlayerName())
@@ -281,6 +290,8 @@
         return
     def GetEmblemID(self): return self.__dbData.EmblemID
     def SetEmblemID(self, emblemID): self.__dbData.EmblemID = emblemID
+    def GetEmblemWord(self): return self.__dbData.EmblemWord
+    def SetEmblemWord(self, emblemWord): self.__dbData.EmblemWord = emblemWord
     def GetBuffer(self): return self.__dbData.getBuffer()
         
     ## ------------------------------------------------
@@ -296,6 +307,8 @@
         self.__memberDict[playerID] = member
         self.__memberList.append(member)
         return member
+    
+    def GetMemberIDList(self): return self.__memberDict.keys()
     
     def AddMember(self, playerID):
         member = None
@@ -361,7 +374,7 @@
                 continue
             familyFightPowerTotal += member.GetFightPowerTotal()
         self.SetFightPowerTotal(familyFightPowerTotal)
-        GameWorld.DebugLog("刷新仙盟总战力! familyID=%s" % self.GetID())
+        #GameWorld.DebugLog("刷新仙盟总战力! familyID=%s" % self.GetID())
         self.__memFightPowerChange = False
         return familyFightPowerTotal
     
@@ -430,9 +443,14 @@
         self.__familyList.sort(key=lambda f: (f.GetFightPowerTotal(), f.GetLV()), reverse=True)
         return
     
-    def AddFamily(self, familyID, familyName, serverID):
+    def AddFamily(self, familyName, serverID, familyID=None):
         ## 创建新仙盟
         newFamily = None
+        if familyID == None:
+            familyID = PyMongoMain.GetUserCtrlDB().GetNewFamilyID()
+            if familyID <= 0:
+                GameWorld.ErrLog("创建仙盟时生成新ID异常!")
+                return newFamily
         if familyID in self.__familyIDDict:
             GameWorld.ErrLog("创建仙盟时ID已存在! familyID=%s" % familyID)
             return newFamily
@@ -478,6 +496,8 @@
                 self.__familyList.remove(family)
             family.OnDelete()
         self.__familyIDDict.pop(familyID, None)
+        if familyID >= ShareDefine.RealFamilyIDStart:
+            PyMongoMain.GetUserCtrlDB().FreeFamilyID(familyID) # 归还仙盟ID,重复使用
         return family
     
     def DelAllFamily(self):
@@ -628,6 +648,7 @@
             action = self.__actionMgr.GetFamilyAction(familyID, actionType)
             action.InitActionInstance(dbData)
             
+        PyMongoMain.GetUserCtrlDB().OnFamilyIDInit(self.__familyIDDict.keys())
         return pos
     
 def OnMinute():

--
Gitblit v1.8.0