| | |
| | | import GameWorld
|
| | | import ShareDefine
|
| | | import PlayerControl
|
| | | import PyMongoMain
|
| | | import DBDataMgr
|
| | | import ChConfig
|
| | | import DBComm
|
| | |
| | | def RefrshFightPowerTotal(self, checkChange=False):
|
| | | ## 刷新总战力
|
| | | if checkChange and self.__memFightPowerChange == False: # 默认None,首次必刷新
|
| | | GameWorld.DebugLog("没有成员战力变化可不刷新仙盟总战力! familyID=%s" % self.GetID())
|
| | | #GameWorld.DebugLog("没有成员战力变化可不刷新仙盟总战力! familyID=%s" % self.GetID())
|
| | | return
|
| | | familyFightPowerTotal = 0
|
| | | for index in range(self.GetCount()):
|
| | |
| | | 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
|
| | |
| | | self.__familyList.remove(family)
|
| | | family.OnDelete()
|
| | | self.__familyIDDict.pop(familyID, None)
|
| | | if familyID > ShareDefine.FackFamilyIDMax:
|
| | | PyMongoMain.GetUserCtrlDB().FreeFamilyID(familyID) # 归还仙盟ID,重复使用
|
| | | return family
|
| | | |
| | | def DelAllFamily(self):
|
| | | for index in range(self.GetCount())[::-1]:
|
| | | family = self.GetAt(index)
|
| | | familyID = family.GetID()
|
| | | self.DelFamily(familyID)
|
| | | return
|
| | |
|
| | | def GetCount(self): return len(self.__familyList)
|
| | | def GetAt(self, index):
|
| | |
| | | family = self.FindFamily(familyID)
|
| | | if not family:
|
| | | continue
|
| | | member = family.InitMemberInstance(dbData)
|
| | | GameWorld.Log(" member:%s,familyID=%s" % (member.GetPlayerID(), familyID))
|
| | | family.InitMemberInstance(dbData)
|
| | |
|
| | | # 行为
|
| | | cnt, pos = CommFunc.ReadDWORD(datas, pos)
|
| | |
| | | action = self.__actionMgr.GetFamilyAction(familyID, actionType)
|
| | | action.InitActionInstance(dbData)
|
| | |
|
| | | PyMongoMain.GetUserCtrlDB().OnFamilyIDInit(self.__familyIDDict.keys())
|
| | | return pos
|
| | |
|
| | | def OnMinute(curMinute):
|
| | | def OnMinute():
|
| | |
|
| | | familyMgr = DBDataMgr.GetFamilyMgr()
|
| | | # 每分钟刷新下仙盟战力排序
|