| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926 |
- local GuildData = class('GuildData')
- function TableRemove(ls, value)
- for i = #ls, 1, -1 do
- if ls[i] == value then
- table.remove(ls, i)
- end
- end
- end
- local MemberSort = function(a, b)
- if a.brief.post == b.brief.post then
- if a.brief.offlineTime == b.brief.offlineTime then
- return a.brief.uid < b.brief.uid
- else
- if a.brief.offlineTime == 0 then
- return true
- elseif b.brief.offlineTime == 0 then
- return false
- else
- return a.brief.offlineTime > b.brief.offlineTime
- end
- end
- else
- return a.brief.post > b.brief.post
- end
- end
- local AuditApplySort = function(a, b)
- if a.playerBrief.onlineState == b.playerBrief.onlineState then
- if a.playerBrief.onlineTime == b.playerBrief.onlineTime then
- if a.playerBrief.fightPower == b.playerBrief.fightPower then
- return a.playerBrief.uid < b.playerBrief.uid
- else
- return a.playerBrief.fightPower > b.playerBrief.fightPower
- end
- else
- return a.playerBrief.onlineTime > b.playerBrief.onlineTime
- end
- else
- return a.playerBrief.onlineState
- end
- end
- local LogSort = function(a, b)
- return b.time < a.time
- end
- function GuildData:ctor()
- end
- function GuildData:Dispose()
- self:ClearGuildData()
- self.isSubmitApply = nil -- 是否申请过加入该公会
- self.nextCDTime = nil -- 下一次可加入公会的时间戳
- end
- function GuildData:SetBriefData(msg)
- if not msg then return end
- local brief = self.brief
- if not brief then
- brief = {}
- self.brief = brief
- end
- brief.id = msg.guild_id
- brief.name = msg.guild_name
- brief.badge = msg.guild_badge
- brief.level = msg.guild_level
- brief.active = msg.guild_active
- if brief.badge then
- local badgeCfgData = ManagerContainer.CfgMgr:GetGuildBadgeCfgById(brief.badge)
- if badgeCfgData then
- brief.badgeResPath = badgeCfgData.Pic
- end
- end
- if brief.level then
- local lvCfgData = ManagerContainer.CfgMgr:GetGuildLvCfgById(brief.level)
- if lvCfgData then
- self.memberLimit = lvCfgData.PeopleLimit
- brief.activeLimit = lvCfgData.ActiveLimit
- end
- end
- end
- function GuildData:SetMemberNum(msg)
- self.memberNum = msg
- end
- function GuildData:SetSubmitApply(msg)
- self.isSubmitApply = msg
- end
- function GuildData:SetHasApply(msg)
- self.isHasApply = msg
- end
- function GuildData:SetNextCDTime(msg)
- self.nextCDTime = msg
- end
- function GuildData:SetNotifyData(msg)
- if not msg then return end
- self:SetBriefData(msg.brief)
- self:SetMemberNum(msg.mem_count)
- self:SetSubmitApply(msg.is_apply)
- end
- function GuildData:SetBaseData(msg)
- if not msg then return end
- self:SetBriefData(msg.guild_brief)
- local base = self.base
- if not base then
- base = {}
- self.base = base
- end
- base.exp = msg.guild_exp or 0
- base.activeDay = msg.day_active or 0
- base.notice = msg.notice
- base.activeTime = msg.active_time
- base.recuritType = msg.recruit_type
- base.recuritLevel = msg.recruit_level
- base.recruitNotice = msg.recruit_notice
- if self.brief.level then
- local lvCfgData = ManagerContainer.CfgMgr:GetGuildLvCfgById(self.brief.level)
- if lvCfgData then
- base.expLimit = lvCfgData.ExpRequire
- end
- end
- if not base.expLimit then
- base.expLimit = 0
- end
- end
- function GuildData:SetMemberBriefDatas(msg)
- if not msg then return end
- self.members = {}
- self.memberMap = {}
- for _, value in pairs(msg) do
- local memberBrief = {
- uid = value.uid,
- offlineTime = value.offline_time,
- post = value.title,
- }
- if self.memberMap[memberBrief.uid] then
- self.memberMap[memberBrief.uid].brief = memberBrief
- else
- local member = {}
- member.brief = memberBrief
- self.members[#self.members + 1] = member
- self.memberMap[memberBrief.uid] = member
- end
- end
- self.memberNum = #self.members
- table.sort(self.members, MemberSort)
- end
- function GuildData:SetMemberInfoDatas(msg)
- if not msg then return end
- if not self.members or not self.memberMap then return end
- for _, value in pairs(msg) do
- local brief = value.brief
- if brief then
- local uid = brief.uid
- local member = self.memberMap[uid]
- if member then
- member.playerBrief = ProtocalDataNormal.ParsePlayerBriefInfo(brief)
- member.active = value.total_active
- end
- end
- end
- end
- function GuildData:SetRoleGuildData(msg, active)
- if not msg then return end
- local id = msg.guild_id
- if id ~= self.brief.id then
- return
- end
- self.nextCDTime = msg.next_join
- local role = self.role
- if not role then
- role = {}
- self.role = role
- end
- local activeInfo = msg.guild_active
- if activeInfo then
- role.activeTotal = activeInfo.active_value
- role.activeDay = activeInfo.day_active_value
- role.activeUpdateTime = activeInfo.active_time
- else
- role.activeTotal = 0
- role.activeDay = 0
- role.activeUpdateTime = 0
- end
- role.active = active
- role.quitNum = msg.quit_num
- end
- function GuildData:SetGuildQuitData(quitNum, nextCDTime)
- local changed = false
- if self.nextCDTime ~= nextCDTime then
- self.nextCDTime = nextCDTime
- changed = true
- end
- if self.role then
- if self.role.quitNum ~= quitNum then
- self.role.quitNum = quitNum
- changed = true
- end
- end
- return changed
- end
- function GuildData:ChangeMemberPost(uid, post)
- if not self.members or not self.memberMap then return false end
- local member = self.memberMap[uid]
- if not member then return false end
- local brief = member.brief
- if not brief then return false end
- if brief.post == post then return false end
- brief.post = post
- table.sort(self.members, MemberSort)
- return true
- end
- function GuildData:KickMember(uid)
- if not self.members or not self.memberMap then return false end
- local member = self.memberMap[uid]
- if not member then return false end
- for i = #self.members, 1, -1 do
- if self.members[i] == member then
- table.remove(self.members, i)
- break
- end
- end
- self.memberNum = #self.members
- self.memberMap[uid] = nil
- return true
- end
- function GuildData:SetGuildName(newName)
- if not self.brief then return false end
- if self.brief.name == newName then return false end
- self.brief.name = newName
- return true
- end
- function GuildData:SetGuildNotice(newNotice)
- if not self.base then return false end
- if self.base.notice == newNotice then return false end
- self.base.notice = newNotice
- return true
- end
- function GuildData:SetGuildBadge(newBadge)
- if not self.brief then return false end
- if self.brief.badge == newBadge then return false end
- self.brief.badge = newBadge
- local badgeCfgData = ManagerContainer.CfgMgr:GetGuildBadgeCfgById(newBadge)
- if badgeCfgData then
- self.brief.badgeResPath = badgeCfgData.Pic
- end
- return true
- end
- function GuildData:SetGuildRecuitInfo(recuritType, recuritLevel, recruitNotice)
- if not self.base then return false end
- if self.base.recuritType == recuritType
- and self.base.recuritLevel == recuritLevel
- and self.base.recruitNotice == recruitNotice then
- return false
- end
- self.base.recuritType = recuritType
- self.base.recuritLevel = recuritLevel
- self.base.recruitNotice = recruitNotice
- return true
- end
- function GuildData:SetAuditApplyData(uidList)
- if not uidList then
- self.isHasApply = false
- return
- end
- local dataMap = {}
- local datas = {}
- if uidList then
- for i = 1, #uidList do
- local uid = uidList[i]
- local data = {}
- data.uid = uid
- dataMap[uid] = data
- datas[#datas + 1] = data
- end
- end
- self.auditApplys = datas
- self.auditApplyMap = dataMap
- self.isHasApply = (#self.auditApplys > 0)
- end
- function GuildData:SetAuditApplyPlayBrief(playerBriefs)
- if not playerBriefs then return end
- if not self.auditApplys or not self.auditApplyMap then return nil end
- for i = 1, #playerBriefs do
- local playerBrief = playerBriefs[i]
- local uid = playerBrief.uid
- local auditApply = self.auditApplyMap[uid]
- if auditApply then
- auditApply.playerBrief = ProtocalDataNormal.ParsePlayerBriefInfo(playerBrief)
- end
- end
- if self.auditLoadings then
- for i = #self.auditLoadings, 1, -1 do
- local loadUid = self.auditLoadings[i]
- local auditApply = self.auditApplyMap[loadUid]
- if auditApply and not auditApply.playerBrief then
- self.auditApplyMap[loadUid] = nil
- TableRemove(self.auditApplys, auditApply)
- end
- end
- end
- self.isHasApply = (#self.auditApplys > 0)
- self.auditLoadings = {}
- end
- ---@return integer 0:无变化;1:删除了申请;2:公会成员有变化;3:无变化
- function GuildData:SetAuditApplyHandle(handleType, uidList)
- if not self.auditApplys or not self.auditApplyMap then return 0 end
- local errorCode = nil
- if handleType == Enum.GuildAduitApplyHandleType.AllRefuse then
- self.auditApplys = nil
- self.auditApplyMap = nil
- self.isHasApply = false
- return 1, errorCode
- else
- local auditApplyChanged = false
- local memberChanged = false
- if uidList then
- for _, value in pairs(uidList) do
- local uid = value.key
- local applyType = value.value
- errorCode = value.value2
- local auditApply = self.auditApplyMap[uid]
- if auditApply and applyType ~= Enum.GuildAduitApplyType.Untreated then
- self.auditApplyMap[uid] = nil
- TableRemove(self.auditApplys, auditApply)
- auditApplyChanged = true
- end
- if applyType == Enum.GuildAduitApplyType.Allow then
- if self.members and self.memberMap then
- if not self.memberMap[uid] then
- local memberBrief = {
- uid = uid,
- post = Enum.GuildPostType.None,
- }
- if auditApply then
- if auditApply.playerBrief then
- if auditApply.playerBrief.onlineState then
- memberBrief.offlineTime = 0
- else
- memberBrief.offlineTime = auditApply.playerBrief.onlineTime
- end
- else
- memberBrief.offlineTime = 0
- end
- else
- memberBrief.offlineTime = 0
- end
- local member = {}
- member.brief = memberBrief
- self.members[#self.members + 1] = member
- self.memberMap[uid] = member
- memberChanged = true
- end
- end
- end
- end
- end
- self.isHasApply = (#self.auditApplys > 0)
- if memberChanged then
- if self.members and self.memberMap then
- self.memberNum = #self.members
- table.sort(self.members, MemberSort)
- end
- return 2, (handleType == Enum.GuildAduitApplyHandleType.One and errorCode or nil)
- else
- return auditApplyChanged and 1 or 3, (handleType == Enum.GuildAduitApplyHandleType.One and errorCode or nil)
- end
- end
- end
- ---@return boolean,boolean|nil,boolean|nil
- function GuildData:SetLogs(logs, isEnd)
- local addStart = false
- local add = false
- local addEnd = false
- if isEnd then
- if self.logWhole ~= isEnd then
- self.logWhole = isEnd
- addEnd = true
- end
- end
- if not logs then return add, addStart, addEnd end
- local len = #logs
- if len <= 0 then return add, addStart, addEnd end
- if not self.logs then
- self.logs = {}
- end
- local exitLen = #self.logs
- local startTime = nil
- local endTime = nil
- if self.logs[1] then
- startTime = self.logs[1].time
- end
- if self.logs[exitLen] then
- endTime = self.logs[exitLen].time
- end
- for i = 1, len do
- local log = logs[i]
- local needAdd = true
- if startTime and int64.__lt(startTime, log.event_time) then
- addStart = true
- elseif endTime and int64.__lt(log.event_time, endTime) then
- addEnd = true
- else
- -- 这时候就需要查看是否列表中已存在
- for j = 1, exitLen do
- if int64.equals(self.logs[j].time, log.event_time) then
- needAdd = false
- break
- end
- end
- end
- if needAdd then
- add = true
- self.logs[#self.logs + 1] = {
- opPost = log.op_title,
- opName = CommonUtil.GetVaildNickName(log.op_name),
- beOpPost = log.be_op_title,
- beOpName = CommonUtil.GetVaildNickName(log.be_op_name),
- type = log.event_type,
- time = log.event_time,
- }
- end
- end
- if add then
- table.sort(self.logs, LogSort)
- end
- return add, addStart, addEnd
- end
- function GuildData:SetHuntBossList(huntBossMsgs, huntBossExts, huntBossCd)
- self.huntBossCd = huntBossCd
- if not huntBossMsgs then return end
- local huntBossMap = self.huntBossMap
- if not huntBossMap then
- huntBossMap = {}
- self.huntBossMap = huntBossMap
- end
- for i = 1, #huntBossMsgs do
- local huntBossMsg = huntBossMsgs[i]
- if huntBossMsg then
- local huntBoss = {
- id = huntBossMsg.boss_id,
- fightTime = huntBossMsg.fight_time,
- fightCdTime = huntBossMsg.fight_cd_time
- }
- if huntBossMap[huntBoss.id] then
- LogWarning('[Wboy] Exist Some Boss lastBoss : ' .. Inspect(huntBossMap[huntBoss.id]) .. '\ncurBoss : ' .. Inspect(huntBoss))
- end
- huntBossMap[huntBoss.id] = huntBoss
- end
- end
- for i = 1, #huntBossExts do
- local huntBossExt = huntBossExts[i]
- if huntBossExt then
- if huntBossMap[huntBossExt.key] then
- huntBossMap[huntBossExt.key].remainNum = huntBossExt.value
- end
- end
- end
- end
- function GuildData:SetHuntBossInfo(bossId, guildActive, fightTime, remainNum)
- if self.brief then
- self.brief.active = guildActive
- end
- if not self.huntBossMap then return end
- local huntBoss = self.huntBossMap[bossId]
- if not huntBoss then
- huntBoss = {}
- huntBoss.id = bossId
- self.huntBossMap[bossId] = huntBoss
- end
- huntBoss.fightTime = fightTime
- huntBoss.fightCdTime = 0
- if remainNum then
- huntBoss.remainNum = remainNum
- end
- end
- ---@return boolean,boolean|nil,boolean|nil
- function GuildData:SetHuntBossLogs(bossId, huntBossLogMsgs, isEnd)
- local addStart = false
- local add = false
- local addEnd = false
- if not self.huntBossMap then return add, addStart, addEnd end
- local huntBoss = self.huntBossMap[bossId]
- if not huntBoss then return add, addStart, addEnd end
- local logInfo = huntBoss.logInfo
- if not logInfo then
- logInfo = {}
- huntBoss.logInfo = logInfo
- end
- if isEnd then
- if logInfo.logWhole ~= isEnd then
- logInfo.logWhole = isEnd
- end
- end
- if not huntBossLogMsgs then return add, addStart, addEnd end
- local len = #huntBossLogMsgs
- if len <= 0 then return add, addStart, addEnd end
- local logs = logInfo.logs
- if not logs then
- logs = {}
- logInfo.logs = logs
- end
- local exitLen = #logs
- local startTime = nil
- local endTime = nil
- if logs[1] then
- startTime = logs[1].time
- end
- if logs[exitLen] then
- endTime = logs[exitLen].time
- end
- for i = 1, len do
- local huntBossLogMsg = huntBossLogMsgs[i]
- local fightLog = huntBossLogMsg.fight_log
- if fightLog then
- local needAdd = true
- if startTime and int64.__lt(startTime, fightLog.fight_time) then
- addStart = true
- elseif endTime and int64.__lt(fightLog.fight_time, endTime) then
- addEnd = true
- else
- -- 这时候就需要查看是否列表中已存在
- for j = 1, exitLen do
- if int64.equals(logs[j].time, fightLog.fight_time) then
- needAdd = false
- break
- end
- end
- end
- if needAdd then
- add = true
- local log = {}
- log.playerBrief = ProtocalDataNormal.ParsePlayerBriefInfo(huntBossLogMsg.info)
- log.uid = fightLog.uid
- log.time = fightLog.fight_time
- log.damage = fightLog.damage
- logs[#logs + 1] = log
- end
- end
- end
- if add then
- table.sort(logs, LogSort)
- end
- return add, addStart, addEnd
- end
- function GuildData:SetHuntBossMasterReward(bossId, brief, damage)
- if not self.huntBossMap then return end
- local huntBoss = self.huntBossMap[bossId]
- if not huntBoss then return end
- local masterReward = huntBoss.masterReward
- if not masterReward then
- masterReward = {}
- huntBoss.masterReward = masterReward
- end
- masterReward.playerBrief = ProtocalDataNormal.ParsePlayerBriefInfo(brief)
- masterReward.damage = damage
- end
- function GuildData:SetGuildWarInfo(curState, nextStateTime, cp, rank)
- local guildWarInfo = self.guildWarInfo
- if guildWarInfo and guildWarInfo.curState == curState
- and guildWarInfo.nextStateTime == nextStateTime
- and guildWarInfo.cp == cp
- and guildWarInfo.rank == rank then
- return false
- end
- if not guildWarInfo then
- guildWarInfo = {}
- self.guildWarInfo = guildWarInfo
- end
- guildWarInfo.curState = curState
- guildWarInfo.nextStateTime = nextStateTime
- guildWarInfo.cp = cp
- guildWarInfo.rank = rank
- return true
- end
- function GuildData:GetValidMemberNum()
- local num = 0
- for i = 1, #self.members do
- local member = self.members[i]
- if member.playerBrief then
- num = num + 1
- end
- end
- return num
- end
- function GuildData:GetNextLoadMemberUid(loadNum)
- if not self.members or not self.memberMap then return nil end
- local ls = {}
- for i = 1, #self.members do
- local member = self.members[i]
- if not member.playerBrief then
- ls[#ls + 1] = member.brief.uid
- if #ls >= loadNum then
- break
- end
- end
- end
- return ls
- end
- function GuildData:GetNeedLoadMemberMoreInfo(startIdx, endIdx)
- if not self.members or not self.memberMap then return nil end
- local uids = {}
- for i = startIdx, endIdx do
- local member = self.members[i]
- if member and not member.playerBrief then
- uids[#uids + 1] = member.brief.uid
- end
- end
- return uids
- end
- function GuildData:GetMemberMoreInfoByidx(idx)
- if not self.members or not self.memberMap then return nil end
- return self.members[idx]
- end
- function GuildData:GetMemberMoreInfoByUid(uid)
- if not self.members or not self.memberMap then return nil end
- return self.memberMap[uid]
- end
- function GuildData:GetId()
- return self.brief and self.brief.id or 0
- end
- function GuildData:GetName()
- return self.brief and self.brief.name or nil
- end
- function GuildData:IsSameGuild(id)
- if not id then return false end
- if self.brief then
- if self.brief.id then
- return self.brief.id == id
- end
- end
- return false
- end
- function GuildData:GetBriefData()
- return self.brief
- end
- function GuildData:GetBaseData()
- return self.base
- end
- function GuildData:GetRoleData()
- return self.role
- end
- function GuildData:GetGuildMemberNum()
- return self.memberNum or 0
- end
- function GuildData:GetGuildMemberLimit()
- return self.memberLimit or 0
- end
- function GuildData:GetGuildMemberPost(uid)
- if not self.members or not self.memberMap then return Enum.GuildPostType.None end
- local member = self.memberMap[uid]
- if not member then return Enum.GuildPostType.None end
- local brief = member.brief
- if not brief then return Enum.GuildPostType.None end
- return brief.post or Enum.GuildPostType.None
- end
- function GuildData:ClearGuildData()
- self.brief = nil
- self.base = nil
- self.members = nil
- self.memberMap = nil
- self.memberNum = nil
- self.memberLimit = nil
- self.role = nil
- self.isHasApply = nil
- self:ClearAuditApplyData()
- self:ClearLogs()
- self:ClearHuntBoss()
- self:ClearGuildWarInfo()
- end
- function GuildData:GetIsSubmitApply()
- return self.isSubmitApply
- end
- function GuildData:GetIsHasApply()
- return self.isHasApply
- end
- function GuildData:GetNextCDTime()
- return self.nextCDTime
- end
- function GuildData:GetNextLoadAuditApplyUids(loadNum)
- if self.auditLoadings and #self.auditLoadings > 0 then return nil end
- if not self.auditApplys or not self.auditApplyMap then return nil end
- if not self.auditLoadings then self.auditLoadings = {} end
- for i = 1, #self.auditApplys do
- local auditApply = self.auditApplys[i]
- if not auditApply.playerBrief then
- self.auditLoadings[#self.auditLoadings + 1] = auditApply.uid
- if #self.auditLoadings >= loadNum then
- break
- end
- end
- end
- if not self.auditLoadings or #self.auditLoadings <= 0 then
- table.sort(self.auditApplys, AuditApplySort)
- end
- return self.auditLoadings
- end
- function GuildData:GetNextAuditApplyById(idx)
- if not self.auditApplys or not self.auditApplyMap then return nil end
- return self.auditApplys[idx]
- end
- function GuildData:GetAuditApplys()
- return self.auditApplys
- end
- function GuildData:GetAuditApplyUids()
- if not self.auditApplys or not self.auditApplyMap then return nil end
- local uids = {}
- for uid, _ in pairs(self.auditApplyMap) do
- uids[#uids + 1] = uid
- end
- return uids
- end
- function GuildData:GetAuditApplyNum()
- if not self.auditApplys or not self.auditApplyMap then return 0 end
- return #self.auditApplys
- end
- function GuildData:ClearAuditApplyData()
- self.auditLoadings = nil
- self.auditApplys = nil
- self.auditApplyMap = nil
- end
- function GuildData:GetReloadLogStartTime()
- return 0
- end
- function GuildData:GetNextLoadLogStartTime()
- if self.logWhole then return nil end
- if self.logs then
- local log = self.logs[#self.logs]
- if log and log.time then
- return log.time
- end
- end
- return self:GetReloadLogStartTime()
- end
- function GuildData:GetLogById(idx)
- if not self.logs then return nil end
- return self.logs[idx]
- end
- function GuildData:GetLogs()
- return self.logs
- end
- function GuildData:GetLogNum()
- if not self.logs then return 0 end
- return #self.logs
- end
- function GuildData:GetLogWhole()
- return self.logWhole
- end
- function GuildData:ClearLogs()
- self.logs = nil
- self.logWhole = nil
- end
- function GuildData:GetHuntBossInfoById(id)
- if not self.huntBossMap then return end
- return self.huntBossMap[id]
- end
- function GuildData:GetHuntBossCd()
- return self.huntBossCd
- end
- function GuildData:ClearHuntBoss()
- if self.huntBossMap then
- for key, _ in pairs(self.huntBossMap) do
- self:ClearHuntBossLogs(key)
- self:ClearHuntBossMasterReward(key)
- end
- end
- self.huntBossMap = nil
- self.huntBossCd = nil
- end
- function GuildData:GetReloadHuntBossLogStartTime(id)
- if not self:GetHuntBossInfoById(id) then return nil end
- return 0
- end
- function GuildData:GetNextLoadHuntBossLogStartTime(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return nil end
- local logInfo = huntBoss.logInfo
- if not logInfo then return nil end
- if logInfo.logWhole then return nil end
- if logInfo.logs then
- local log = logInfo.logs[#logInfo.logs]
- if log and log.time then
- return log.time
- end
- end
- return self:GetReloadHuntBossLogStartTime(id)
- end
- function GuildData:GetHuntBossLogById(id, idx)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return nil end
- local logInfo = huntBoss.logInfo
- if not logInfo then return nil end
- if not logInfo.logs then return nil end
- return logInfo.logs[idx]
- end
- function GuildData:GetHuntBossLogs(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return nil end
- local logInfo = huntBoss.logInfo
- if not logInfo then return nil end
- return logInfo.logs
- end
- function GuildData:GetHuntBossLogNum(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return nil end
- local logInfo = huntBoss.logInfo
- if not logInfo then return nil end
- return logInfo.logs and #logInfo.logs or 0
- end
- function GuildData:GetHuntBossLogWhole(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return false end
- local logInfo = huntBoss.logInfo
- if not logInfo then return false end
- return logInfo.logWhole and true or false
- end
- function GuildData:ClearHuntBossLogs(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return end
- huntBoss.logInfo = nil
- end
- function GuildData:GetHuntBossMasterReward(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return end
- return huntBoss.masterReward
- end
- function GuildData:ClearHuntBossMasterReward(id)
- local huntBoss = self:GetHuntBossInfoById(id)
- if not huntBoss then return end
- huntBoss.masterReward = nil
- end
- function GuildData:GetGuildWarInfo()
- return self.guildWarInfo
- end
- function GuildData:ClearGuildWarInfo()
- self.guildWarInfo = nil
- end
- return GuildData
|