| | |
| | | @param dbData: 实例对应绑定的dbData
|
| | | @return: 成功返回实例对象,失败返回None
|
| | | '''
|
| | | dataToJson = False
|
| | | # 如果需要 dataToJson,可根据ActionType在这里处理
|
| | | dataToJson = True
|
| | | # 默认使用 dataToJson,如果不需要的可根据 ActionType 在这里处理
|
| | | if dbData.ActionType in []:
|
| | | dataToJson = True
|
| | | dataToJson = False
|
| | | actionData = FamilyActionData(dbData, dataToJson)
|
| | | self.__actionDataList.append(actionData)
|
| | | return actionData
|
| | |
| | | elif False:
|
| | | aData = FamilyActionData()
|
| | | return aData
|
| | | |
| | | |
| | | def GetActionDataByValue1(self, value1, isAdd=False):
|
| | | ## 获取Action根据Value1
|
| | | # @return: None or findActionData
|
| | | findActionData = None
|
| | | for actionData in self.__actionDataList:
|
| | | if actionData.GetValue1() == value1:
|
| | | findActionData = actionData
|
| | | break
|
| | | if not findActionData and isAdd:
|
| | | findActionData = self.AddAction()
|
| | | findActionData.SetValue1(value1)
|
| | | return findActionData
|
| | | |
| | | def DelActionDataByValue1(self, value1):
|
| | | ## 删除Action根据Value1
|
| | | for actionData in self.__actionDataList[::-1]:
|
| | | if actionData.GetValue1() == value1:
|
| | | self.__actionDataList.remove(actionData)
|
| | | break
|
| | | return
|
| | | |
| | | class FamilyActionMgr():
|
| | |
|
| | | def __init__(self):
|
| | |
| | | return
|
| | |
|
| | | def GetFamilyAction(self, familyID, actionType):
|
| | | if not familyID:
|
| | | return FamilyAction()
|
| | | if familyID not in self.__familyActionDict:
|
| | | self.__familyActionDict[familyID] = {}
|
| | | actionDict = self.__familyActionDict[familyID]
|
| | |
| | | self.__dbData = DBStruct.tagDBFamilyMem() if not dbData else dbData
|
| | | return
|
| | |
|
| | | def GetFamily(self): return DBDataMgr.GetFamilyMgr().FindFamily(self.__dbData.FamilyID)
|
| | | def GetPlayerID(self): return self.__dbData.PlayerID
|
| | | def GetFamilyID(self): return self.__dbData.FamilyID
|
| | | def GetJoinTime(self): return self.__dbData.JoinTime
|
| | |
| | | def SetFace(self, face): self.__dbData.Face = face
|
| | | def GetFacePic(self): return self.__dbData.FacePic
|
| | | def SetFacePic(self, facePic): self.__dbData.FacePic = facePic
|
| | | def GetTitleID(self): return self.__dbData.TitleID
|
| | | def SetTitleID(self, titleID): self.__dbData.TitleID = titleID
|
| | | def GetFightPower(self): return self.__dbData.FightPower
|
| | | def GetFightPowerEx(self): return self.__dbData.FightPowerEx
|
| | | def GetFightPowerTotal(self): return self.__dbData.FightPowerEx * ChConfig.Def_PerPointValue + self.__dbData.FightPower
|
| | |
| | | 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):
|
| | |
| | | self.SetRealmLV(viewCache.GetRealmLV())
|
| | | self.SetFace(viewCache.GetFace())
|
| | | self.SetFacePic(viewCache.GetFacePic())
|
| | | self.SetTitleID(viewCache.GetTitleID())
|
| | | self.SetServerID(viewCache.GetServerID())
|
| | | fpChange = False
|
| | | fightPowerTotal = viewCache.GetFightPowerTotal()
|
| | | if self.GetFightPowerTotal() < fightPowerTotal:
|
| | | self.SetFightPowerTotal(fightPowerTotal)
|
| | | fpChange = True
|
| | | family = self.GetFamily()
|
| | | if family:
|
| | | family.SetMemFightPowerChange()
|
| | | return fpChange
|
| | |
|
| | | def RefreshMember(self, curPlayer):
|
| | |
| | | self.SetRealmLV(curPlayer.GetOfficialRank())
|
| | | self.SetFace(curPlayer.GetFace())
|
| | | self.SetFacePic(curPlayer.GetFacePic())
|
| | | self.SetTitleID(PlayerControl.GetTitleID(curPlayer))
|
| | | self.SetServerID(GameWorld.GetPlayerServerID(curPlayer))
|
| | | fightPowerTotal = PlayerControl.GetFightPower(curPlayer)
|
| | | fpChange = self.GetFightPowerTotal() != fightPowerTotal
|
| | | self.SetFightPowerTotal(fightPowerTotal)
|
| | | if fpChange:
|
| | | family = self.GetFamily()
|
| | | if family:
|
| | | family.SetMemFightPowerChange()
|
| | | return fpChange
|
| | |
|
| | | class Family():
|
| | |
| | | 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()
|
| | |
|
| | | ## ------------------------------------------------
|
| | |
| | | mem = FamilyMem()
|
| | | return mem
|
| | |
|
| | | def RefreshFamilyMember(self, curPlayer):
|
| | | ## 刷新在线成员信息
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if self.GetID() != familyID:
|
| | | return
|
| | | member = self.FindMember(playerID)
|
| | | if not member:
|
| | | return
|
| | | if member.RefreshMember(curPlayer):
|
| | | self.__memFightPowerChange = True
|
| | | return
|
| | | |
| | | def SetMemFightPowerChange(self): self.__memFightPowerChange = True
|
| | | def RefrshFightPowerTotal(self, checkChange=False):
|
| | | ## 刷新总战力
|
| | | if checkChange and self.__memFightPowerChange == False: # 默认None,首次必刷新
|
| | |
| | |
|
| | | def FindFamily(self, familyID):
|
| | | family = None
|
| | | if familyID in self.__familyIDDict:
|
| | | if familyID and familyID in self.__familyIDDict:
|
| | | family = self.__familyIDDict[familyID]
|
| | | elif False:
|
| | | family = Family()
|