|
|
- CSMainModel = CSMainModel or BaseClass(BaseVo, true)
- local CSMainModel = CSMainModel
-
- function CSMainModel:__init()
- CSMainModel.Instance = self
- self:Reset()
- end
-
- function CSMainModel:Reset()
- self.legion_kv_cfg = {}--��������
- self.task_cfg = {}--��������
- self.active_awards_cfg = {}--��Ծ��������
- self.max_active_cfg_num = 0
- self.exploit_rank_reward_cfg = {}--����������������
- self.military_ranks_cfg = {}--��������
-
- self.exploit_can_get_reward_rank = 0--����ȡ��������������
-
- self.director_role_data = {}--ָ����������������
-
- self.active_process = 0--��Ծ����
- self.active_dot = 0--��ǰ��ȡ����
- self.arms_num = 0--����ֵ
- self.military_ranks = 0--����
- self.exploit_rank_score = 0--�����
- self.active_dot_list = {}--�����Ļ�Ծ�����ڵ��б�
-
- self.my_country_exploit_rank_num = 0--�ҵĹ��Ҿ�����������
-
- self.last_guild_war_rank_data = {}--���ڿ�����ս���У���¼ֻ����һ�β����渴��
- self.last_military_score_rank_data = {}--���ھ�������
- self.appoint_data_0 = {}--��ʷ������¼ ǰ������
- self.appoint_data_1 = {}--��ʷ������¼ ָ�ӹ�Ա
-
- self.click_worship_role_list = {}--��Ĥ�������б�
- self.click_worship_role = 0--��Ĥ������
- self.my_exploit_last_rank = 0--ǰ������
- self.my_day_reward_state = 0--��ȡ״̬1����ȡ
-
- self.cs_main_task_data = {}--��������
-
- self.cs_main_red_info = {}--������Ϣ
-
- self.task_red_by_color = {}--����Ʒ�ʺ���
-
- self.advance_notice_reward_data = {}--Ԥ�潱������
-
- self.has_request_60314 = false
- self.has_request_60311 = false
-
- self:InitCSMainCfg()
- end
-
- --�رս�������Ҫ���õ�����
- function CSMainModel:ResetDataAfterCloseView( )
- self.director_role_data = {}
- end
-
- function CSMainModel:getInstance()
- if CSMainModel.Instance == nil then
- CSMainModel.Instance = CSMainModel.New()
- end
- return CSMainModel.Instance
- end
-
- function CSMainModel:InitCSMainCfg( )
- --��������
- self.legion_kv_cfg = Config.Legionkv
-
- --��������
- for k,v in pairs(Config.Legiontask) do
- self.task_cfg[v.color] = self.task_cfg[v.color] or {}
- table.insert(self.task_cfg[v.color],v)
- end
- for k,v in pairs(self.task_cfg) do
- local sort_func = function ( a, b )
- return a.sort < b.sort
- end
- table.sort(v, sort_func)
- end
-
- --��Ծ��������
- self.max_active_cfg_num = 0
- for k,v in pairs(Config.Legionactiveawards) do
- self.active_awards_cfg[v.round] = self.active_awards_cfg[v.round] or {}
- table.insert(self.active_awards_cfg[v.round],v)
- self.max_active_cfg_num = self.max_active_cfg_num + 1
- end
- for k,v in pairs(self.active_awards_cfg) do
- local sort_func = function ( a, b )
- return a.id < b.id
- end
- table.sort(v, sort_func)
- end
-
- --����������������
- local max_rank = 0
- for k,v in pairs(Config.Legionrankreward) do
- v.is_top = 0
- table.insert(self.exploit_rank_reward_cfg,v)
- if v.min_rank>max_rank then
- max_rank = v.min_rank
- end
- end
- self.exploit_can_get_reward_rank = max_rank
-
- --��������
- self.military_ranks_cfg = Config.Legionpost
-
-
- end
-
- --��ȡ��������������ʾ����
- function CSMainModel:GetCSMainHonorMaxRank( )
- return self.legion_kv_cfg["honor_max_rank"].value
- end
-
- --��ȡ����Ĥ�ݽ���
- function CSMainModel:GetCSMainWorshipReward( )
- return stringtotable(self.legion_kv_cfg["like_reward"].value)
- end
-
- --��ȡ��������������ʾ����
- function CSMainModel:GetCSMainMilitaryMaxRank( )
- -- return self.legion_kv_cfg["military_max_rank"].value
- return 0
- end
-
- function CSMainModel:GetCSMainChaimanMaxRank( )
- return self.legion_kv_cfg["chairman_max_rank"].value
- end
-
- function CSMainModel:GetCSMainCommanderMaxRank( )
- return self.legion_kv_cfg["commander_max_rank"].value
- end
-
- --d_type 1|ִ���� 2|ָ�ӹ�
- function CSMainModel:GetCSMainDsgtId(d_type)
- if d_type == 1 then
- return stringtotable(self.legion_kv_cfg["chairman_reward"].value)[1][2]
- elseif d_type == 2 then
- return stringtotable(self.legion_kv_cfg["commander_reward"].value)[1][2]
- end
- return 0
- end
-
- --��������id��ȡ��������
- --Ʒ�� cfg.color
- --���� Trim(cfg.desc)
- --��ת stringtotable(cfg.link)[1], stringtotable(cfg.link)[2]
- --���� stringtotable(cfg.content)[3]
- --���� stringtotable(cfg.awards)
- function CSMainModel:GetCSMainTaskCfgByTaskId(task_id)
- for k,v in pairs(self.task_cfg) do
- for m,n in pairs(v) do
- if n.id == task_id then
- return n
- end
- end
- end
- return nil
- end
-
- --����Ʒ�ʻ�ȡ���������б�
- function CSMainModel:GetCSMainTaskCfgByColor(color)
- return self.task_cfg[color] and self.task_cfg[color] or {}
- end
-
- --�����������������б�
- function CSMainModel:GetCSMainTaskCfgAfterSort(color)
- if not self.task_cfg[color] then return {} end
- local final_task = DeepCopy(self.task_cfg[color])
- for k,v in pairs(final_task) do
- local task_data = self:GetCSMainTaskDataById(v.id)
- if task_data then--0������1����ȡ2����ȡ
- if task_data.state == 0 then
- v.first_sort = 2
- elseif task_data.state == 1 then
- v.first_sort = 3
- elseif task_data.state == 2 then
- v.first_sort = 0
- else
- v.first_sort = 1
- end
- else
- v.first_sort = 1
- end
- end
- local arg = {"first_sort", "sort"}
- local condition = {Array.UPPER, Array.LOWER}
- SortTools.MoreKeysSorter(final_task, arg, condition)
- return final_task
- end
-
- --�����콱���Ȼ�ȡ���µ�һ��5����Ծ����
- function CSMainModel:GetCSMainActiveRewardsCfgByProgress(progress_id)
- if progress_id%5 == 0 and progress_id ~= 0 and progress_id ~= self.max_active_cfg_num then--Ҫ��һλ����һ������
- progress_id = progress_id + 1
- end
- local round = 1
- for k,v in pairs(self.active_awards_cfg) do
- for m,n in pairs(v) do
- if n.id == progress_id then
- round = n.round
- return self.active_awards_cfg[round]
- end
- end
- end
- return self.active_awards_cfg[round] and self.active_awards_cfg[round] or nil
- end
-
- --��ȡ��һҳ�Ļ�Ծ����
- function CSMainModel:GetCSMainLastPageActiveCfg(progress_id)
- -- if progress_id%5 == 0 and progress_id ~= 0 then--Ҫ��һλ����һ������
- -- progress_id = progress_id + 1
- -- end
- local round = 0
- for k,v in pairs(self.active_awards_cfg) do
- for m,n in pairs(v) do
- if n.id == progress_id then
- round = n.round
- return self.active_awards_cfg[round]
- end
- end
- end
- return self.active_awards_cfg[round] and self.active_awards_cfg[round] or nil
- end
-
- --���ݾ��εȼ���ȡ��������
- function CSMainModel:GetCSMainLegionMilitaryRanksCfg(military_ranks_lv)
- return self.military_ranks_cfg[military_ranks_lv] and self.military_ranks_cfg[military_ranks_lv] or nil
- end
-
-
- ------------------����----start
- function CSMainModel:IsNeedRedAll( )
- for k,v in pairs(CSMainConst.RedType) do
- self:IsNeedRed(v)
- end
- end
-
- function CSMainModel:IsNeedRed(tab_id)
- local bool = false
- if GetModuleIsOpen(603) and self:IsCSMainKfNumEnough() then
- if tab_id == CSMainConst.RedType.Task then--��������1
- bool = self:CheckTaskRed()
- elseif tab_id == CSMainConst.RedType.Active then--������Ծ����2
- bool = self:CheckActiveRed()
- elseif tab_id == CSMainConst.RedType.DailyReward then--ÿ�ս�������ȡ3
- bool = self:CheckDailyRewardRed()
- elseif tab_id == CSMainConst.RedType.MilitaryRanks then--���οɽ���4
- bool = self:CheckMilitaryRanksRed()
- elseif tab_id == CSMainConst.RedType.SandTable then--����ɳ���ܺ���5
- bool = self:CheckSandTableRed()
- elseif tab_id == CSMainConst.RedType.WorShip then--Ĥ�ݺ���
- bool = self:CheckWorShipRed()
- end
- else
- if tab_id == CSMainConst.RedType.NoticeReward then--Ԥ�潱������
- bool = self:CheckNoticeRewardRed()
- end
- end
- self.cs_main_red_info[tab_id] = bool
- self:Fire(CSMainConst.ANS_UPDATE_RED_DOT,tab_id)
- end
-
- function CSMainModel:GetMainRed( )
- local bool = false
- for i,v in pairs(self.cs_main_red_info) do
- if v then
- bool = true
- break
- end
- end
- return bool
- end
-
- --������������1
- function CSMainModel:GetTaskRed( )
- return self.cs_main_red_info[CSMainConst.RedType.Task]
- end
-
- --��ȡ��ӦƷ�ʵ��������ɺ���
- function CSMainModel:GetTaskRedByColor(color)
- return self.task_red_by_color[color] and self.task_red_by_color[color] or false
- end
-
- function CSMainModel:CheckTaskRed( )
- local bool = false
- for k,v in pairs(self.task_cfg) do
- self.task_red_by_color[k] = false
- for m,n in pairs(v) do
- local task_data = self:GetCSMainTaskDataById(n.id)
- if task_data and task_data.state == 1 then--����ȡ
- bool = true
- self.task_red_by_color[n.color] = true
- end
- end
- end
- return bool
- end
-
- --������Ծ��������2
- function CSMainModel:GetActiveRed( )
- return self.cs_main_red_info[CSMainConst.RedType.Active]
- end
-
- function CSMainModel:CheckActiveRed( )
- local bool = false
- for k,v in pairs(self.active_awards_cfg) do
- for m,n in pairs(v) do
- if self.active_process >= n.active then
- if not self:IsCSMainActiveDotRewardGet(n.id) then
- bool = true
- break
- end
- end
- end
- end
- return bool
- end
-
- --ÿ�ս�������ȡ����3
- function CSMainModel:GetDailyRewardRed( )
- return self.cs_main_red_info[CSMainConst.RedType.DailyReward]
- end
-
- function CSMainModel:CheckDailyRewardRed( )
- local bool = false
- --�ϰ������콱״̬Ϊ0 ���Ը�����
- if self.my_exploit_last_rank ~= 0 and self.my_day_reward_state == 0 then
- bool = true
- end
- return bool
- end
-
- --���οɽ�������4
- function CSMainModel:GetMilitaryRanksRed( )
- return self.cs_main_red_info[CSMainConst.RedType.MilitaryRanks]
- end
-
- function CSMainModel:CheckMilitaryRanksRed( )
- local bool = false
- local military_ranks = self:GetCSMainMilitaryRanks()
- local now_military_cfg = self:GetCSMainLegionMilitaryRanksCfg(military_ranks)
- local next_military_cfg = self:GetCSMainLegionMilitaryRanksCfg(military_ranks+1)
- local have_next = next_military_cfg and true or false
- if not have_next then return false end
-
- --ս������
- local enough_power = RoleManager.Instance.mainRoleInfo.fighting >= now_military_cfg.need
-
- --������
- local cost_goods_data = stringtotable(now_military_cfg.cost)
- if not cost_goods_data[1] or (cost_goods_data[1] and cost_goods_data[1][3] == 0)then
- cost_goods_data[1] = {0,100019,0}
- end
- local goods_type_id = cost_goods_data[1][2]
- local cost_need_num = cost_goods_data[1][3]
- local cost_have_num = GoodsModel:getInstance():GetTypeGoodsNum(goods_type_id)
- local enough_cost = cost_have_num >= cost_need_num
-
- bool = enough_cost and enough_power
- return bool
- end
-
- --����ɳ���ܺ���5
- function CSMainModel:GetSandTableRed( )
- return self.cs_main_red_info[CSMainConst.RedType.SandTable]
- end
-
- function CSMainModel:CheckSandTableRed( )
- local bool = false
- bool = SandTableModel:getInstance():GetRedDot(false)
- return bool
- end
-
- --Ĥ�ݺ���
- function CSMainModel:GetWorShipRed( )
- return self.cs_main_red_info[CSMainConst.RedType.WorShip]
- end
-
- function CSMainModel:CheckWorShipRed( )
- local bool = false
- --Ĥ���б��������������а����˿��Ը�����
- if self.my_country_exploit_rank_num > 5 then
- if #self.click_worship_role_list < 5 then
- bool = true
- end
- else
- if #self.click_worship_role_list < self.my_country_exploit_rank_num then
- bool = true
- end
- end
-
- return bool
- end
-
- --Ԥ�潱������
- function CSMainModel:GetNoticeRewardRed( )
- return self.cs_main_red_info[CSMainConst.RedType.NoticeReward]
- end
-
- function CSMainModel:CheckNoticeRewardRed( )
- local bool = false
- --����Ԥ�������н����������Ը�����
- local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
- local _,cfg = GetModuleIsOpen(603)
- local left_day = cfg.open_day-openDay
- local open_lv = GetModuleOpenLevel(603)
- local is_kf_num_enough, is_kf_state = CSMainModel:getInstance():IsCSMainKfNumEnough()
- if open_lv <= RoleManager.Instance.mainRoleInfo.level and left_day <= 0 and is_kf_state and is_kf_num_enough then
- bool = false
- else
- local now_day = openDay <= cfg.open_day-1 and openDay or cfg.open_day-1
- for i=1,now_day do
- local can_get_reward = self:CanDayGetCSMainAdvanceNoticeReward(i)
- if can_get_reward then
- bool = true
- break
- end
- end
- end
- return bool and RoleManager.Instance.mainRoleInfo.level >= 96
- end
-
- ------------------����----end
-
- --����ָ����������ˢ��
- function CSMainModel:UpdateCSMainMilitaryAdvanceCostNum( )
- self:Fire(CSMainConst.UPDATE_CS_MAIN_GOODS_NUM)
- end
-
-
- --60300 ָ��������figure��Ϣ
- function CSMainModel:SetCSMainDirectorData(vo)
- for i=1,7 do
- self.director_role_data[i] = {}
- self.director_role_data[i].pos = i
- self.director_role_data[i].rid = 0
- end
- for k,v in pairs(vo.director_role) do
- self.director_role_data[v.pos] = v
- end
- end
-
- --60306 ��������ˢ�µ�����figure��Ϣ
- function CSMainModel:UpdateCSMainDirectorData(vo)
- local change_pos = 0
- for k,v in pairs(self.director_role_data) do
- if v.rid == vo.role_id then
- change_pos = v.pos
- break
- end
- end
- if change_pos ~= 0 then
- self.director_role_data[change_pos] = vo
- self.director_role_data[change_pos].pos = change_pos
- self.director_role_data[change_pos].rid = vo.role_id
- end
- end
-
- --����λ�û�ȡ����figure��Ϣ
- function CSMainModel:GetCSMainDirectorDataByPos(pos)
- return self.director_role_data[pos]
- end
-
- --60301 ����������
- function CSMainModel:SetCSMainTaskData(vo)
- self.active_process = vo.process--��Ծ����
- self.arms_num = vo.arms--����ֵ
- self.active_dot_list = vo.dot_list
- local sort_func = function ( a, b )
- return a.hot < b.hot
- end
- table.sort(self.active_dot_list, sort_func)
-
- self.active_dot = self:SetCSMainActiveDot(self.active_dot_list)--��ǰ��ȡ����
-
- self.military_ranks = vo.post--����
- self.exploit_rank_score = vo.rank_score--�����
-
- self:ChangeVar("active_process", self.active_process, false, true)
- self:ChangeVar("active_dot", self.active_dot, false, true)
- self:ChangeVar("arms_num", self.arms_num, false, true)
- self:ChangeVar("exploit_rank_score", self.exploit_rank_score, false, true)
-
- for k,v in pairs(vo.missions) do
- self.cs_main_task_data[v.id] = v
- end
- end
-
- function CSMainModel:TestActiveDotList( )
- self.active_dot_list = {
- {hot = 1},
- {hot = 2},
- {hot = 3},
- {hot = 4},
- {hot = 5},
- {hot = 6},
- -- {hot = 8},
- -- {hot = 10},
- }
- self.active_dot = self:SetCSMainActiveDot(self.active_dot_list)--��ǰ��ȡ����
- Message.show(self.active_dot)
- self:ChangeVar("active_dot", self.active_dot, false, true)
- end
-
- --������Ծ������ȡ���ȣ������ж�����һҳ��Ծ��
- function CSMainModel:SetCSMainActiveDot(vo)
- local last_dot = 0
-
- for i,v in ipairs(vo) do
- if last_dot == v.hot - 1 then
- last_dot = v.hot
- else
- return last_dot
- end
- end
-
- return last_dot
- end
-
- --60304 ��ȡ������������Ծ������ˢ������
- function CSMainModel:SetCSMainGetRewardData(vo)
- if vo.opty == 0 then--��Ծ
- local have_same = false
- for k,v in pairs(self.active_dot_list) do
- if v.hot == vo.args then
- have_same = true
- end
- end
- if not have_same then
- local temp = {hot = vo.args}
- table.insert(self.active_dot_list,temp)
- end
- local sort_func = function ( a, b )
- return a.hot < b.hot
- end
- table.sort(self.active_dot_list, sort_func)
- self.active_dot = self:SetCSMainActiveDot(self.active_dot_list)--��ǰ��ȡ����
- self:ChangeVar("active_dot", self.active_dot, false, true)
-
- elseif vo.opty == 1 then--����
-
- end
- end
-
- --�жϸû�Ծ�ڵ㽱���Ƿ��Ѿ���ȡ��
- function CSMainModel:IsCSMainActiveDotRewardGet(dot)
- local bool = false
- for k,v in pairs(self.active_dot_list) do
- if dot == v.hot then
- bool = true
- end
- end
- return bool
- end
-
- --60302 ��������
- function CSMainModel:UpdateCSMainTaskData(vo)
- self.cs_main_task_data[vo.id] = self.cs_main_task_data[vo.id] or {}
- self.cs_main_task_data[vo.id].id = vo.id
- self.cs_main_task_data[vo.id].bar = vo.bar
- self.cs_main_task_data[vo.id].state = vo.state
- end
-
- function CSMainModel:Test60303( )
- local vo = {
- updatas = {
- [1] = {kdata=1,vdata=550},
- }
- }
- self:UpdateCSMainKeyValue(vo)
- end
-
- --60303 ָ��ֵ����
- function CSMainModel:UpdateCSMainKeyValue(vo)
- for k,v in pairs(vo.updatas) do
- if v.kdata == 1 then--process��Ծ����
- self.active_process = v.vdata
- self:ChangeVar("active_process", self.active_process, false, true)
- -- elseif v.kdata == 2 then--dot��ǰ��ȡ����
- -- self.active_dot = v.vdata
- -- self:ChangeVar("active_dot", self.active_dot, false, true)
- elseif v.kdata == 3 then--arms����ֵ
- self.arms_num = v.vdata
- self:ChangeVar("arms_num", self.arms_num, false, true)
- -- elseif v.kdata == 4 then--score����(û��������)
- -- self.exploit_score = v.vdata
- -- self:ChangeVar("exploit_score", self.exploit_score, false, true)
- elseif v.kdata == 5 then--score�����
- self.exploit_rank_score = v.vdata
- self:ChangeVar("exploit_rank_score", self.exploit_rank_score, false, true)
- end
- end
- end
-
- --��ȡ��ǰ��Ծ����
- function CSMainModel:GetCSMainActiveProcess( )
- return self.active_process
- end
-
- --��ȡ��ǰ��Ծ��ȡ����
- function CSMainModel:GetCSMainActiveDot( )
- return self.active_dot
- end
-
- --��ȡ��ǰ����ֵ
- function CSMainModel:GetCSMainArmsNum( )
- return self.arms_num
- end
-
- --��ȡ��ǰ����
- function CSMainModel:GetCSMainMilitaryRanks( )
- return self.military_ranks
- end
-
- --���ݾ����жϴ����εȼ������ڻ�ȡ������ͼ��
- function CSMainModel:GetCSMainHighMilitaryRanks(ranks)
- if ranks == 0 then return 1 end
- return math.floor((ranks-1)/5)+1
- end
-
- --��ȡ��ǰ���о���
- function CSMainModel:GetCSMainExploitRankScore( )
- return self.exploit_rank_score
- end
-
- --��ȡָ��id������
- function CSMainModel:GetCSMainTaskDataById(task_id)
- return self.cs_main_task_data[task_id] and self.cs_main_task_data[task_id] or nil
- end
-
- --60305 �����������
- function CSMainModel:UpdateCSMainMilitaryRanksData(vo)
- self.military_ranks = vo.post
- end
-
- --60308 �����������ݸ��� Ĥ�����ҡ�ǰ��������ÿ�ս�����ȡ״̬��
- function CSMainModel:UpdateCSMainExploitData(vo)
- -- self.click_worship_role = vo.click_role--��Ĥ������
-
- self.click_worship_role_list = vo.click_list--��Ĥ�������б�
- -- self.click_worship_role_list = {}
-
- self.my_exploit_last_rank = vo.last_rank--ǰ������
- self.my_day_reward_state = vo.day_award--��ȡ״̬1����ȡ
-
- for i,v in ipairs(self.exploit_rank_reward_cfg) do
- v.is_top = 0
- if v.min_rank <= self.my_exploit_last_rank and v.max_rank >= self.my_exploit_last_rank then
- if self.my_day_reward_state == 0 then
- v.is_top = 1
- end
- end
- end
- end
-
- --60310 ˢ�½�����ȡ״̬Ϊ��ȡ��
- function CSMainModel:UpdateRankRewardState( )
- for i,v in ipairs(self.exploit_rank_reward_cfg) do
- v.is_top = 0
- end
- self.my_day_reward_state = 1
- end
-
- --��ȡ���������н�������
- function CSMainModel:GetCSMainSortExploitRankRewardCfg( )
- local arg = {"is_top","id"}
- local condition = {Array.UPPER,Array.LOWER}
- SortTools.MoreKeysSorter(self.exploit_rank_reward_cfg, arg, condition)
- return self.exploit_rank_reward_cfg
- end
-
- --��ȡ����ǰ��Ĥ�ݵ�����id
- function CSMainModel:GetCSMainClickWorshipRole( )
- return self.click_worship_role
- end
-
- --�жϵ�ǰ�����Ƿ�����Ĥ��
- function CSMainModel:CanPlayerWorship(role_id)
- local can_worship = true
- local max_worship_num = 5
- if self.my_country_exploit_rank_num < 5 then
- max_worship_num = self.my_country_exploit_rank_num
- end
- if #self.click_worship_role_list >= max_worship_num then
- return false
- end
- for k,v in pairs(self.click_worship_role_list) do
- if v.click_role == role_id then
- can_worship = false
- end
- end
- return can_worship
- end
-
- --��ȡ�Լ�ǰ�յľ�������
- function CSMainModel:GetCSMainMyExploitLastRank( )
- return self.my_exploit_last_rank
- end
-
- --ǰ�վ������������Ƿ�����ȡ
- function CSMainModel:CanGetCSMainExploitDailyReward( )
- return self.my_day_reward_state == 1
- end
-
- --60309 Ĥ�ݺ�ˢ��
- function CSMainModel:UpdateCSMainClickWorshipRole(vo)
- local can_join = true
- for k,v in pairs(self.click_worship_role_list) do
- if v.click_role == vo.aim then
- can_join = false
- end
- end
- if can_join then
- local temp = {click_role = vo.aim}
- table.insert(self.click_worship_role_list,temp)
- end
- end
-
- --60314 �������ڿ�����ս�ɼ�����
- function CSMainModel:SetLastGuildWarScoreRankData(vo)
- self.last_guild_war_rank_data = vo.ranks
- local max_rank_num = self:GetCSMainChaimanMaxRank()
- --��������50����������
- for i=#self.last_guild_war_rank_data+1, max_rank_num do
- local temp = {rank = i, empty_data = true}
- table.insert(self.last_guild_war_rank_data,temp)
- end
- local sort_func = function ( a, b )
- return a.rank < b.rank
- end
- table.sort(self.last_guild_war_rank_data, sort_func)
- self.has_request_60314 = true
- end
-
- --��ȡ���ڿ�����ս�ɼ�����
- function CSMainModel:GetLastGuildWarScoreRankData( )
- return self.last_guild_war_rank_data
- end
-
- --60311 �������ھ����ɼ�����
- function CSMainModel:SetLastMilitaryScoreRankData(vo)
- self.last_military_score_rank_data = vo.ranks
- local max_rank_num = self:GetCSMainCommanderMaxRank()
- --��������50����������
- for i=#self.last_military_score_rank_data+1, max_rank_num do
- local temp = {rank = i, empty_data = true}
- table.insert(self.last_military_score_rank_data,temp)
- end
- local sort_func = function ( a, b )
- return a.rank < b.rank
- end
- table.sort(self.last_military_score_rank_data, sort_func)
- self.has_request_60311 = true
- end
-
- --��ȡ���ڿ�����ս�ɼ�����
- function CSMainModel:GetLastMilitaryScoreRankData( )
- return self.last_military_score_rank_data
- end
-
- --60312 ��ʷ��������
- function CSMainModel:SetAppointData(vo)
- local final_time_logs = {}
- for k,v in pairs(vo.time_logs) do
- local can_join = true
- for m,n in pairs(v.servers) do
- if #n.directors == 0 then
- can_join = false
- end
- end
- if can_join then
- table.insert(final_time_logs,v)
- end
- end
- self["appoint_data_"..vo.opty] = final_time_logs
-
- local sort_func = function ( a, b )
- return a.issue > b.issue
- end
- table.sort(self["appoint_data_"..vo.opty], sort_func)
- end
-
- --��ȡ��������
- function CSMainModel:GetAppointData(appoint_type)
- return self["appoint_data_"..appoint_type] and self["appoint_data_"..appoint_type] or {}
- end
-
- --60307 ��¼�ҵĹ��Ҿ�����������
- function CSMainModel:SetMyCountryExploitRankNum(vo)
- local my_contray_id = KfWorldModel:GetInstance():GetMyCountryId()
- if my_contray_id and my_contray_id == vo.fact then
- if vo and vo.ranks then
- self.my_country_exploit_rank_num = #vo.ranks
- end
- end
- end
-
- --�Ƿ��ﵽ�����ȼ�
- function CSMainModel:IsCSMainKfNumEnough( )
- -- local world_lv = RoleManager.Instance.mainRoleInfo.worldLv
- -- local need_world_lv = 999
- -- return world_lv >= need_world_lv
-
- local tip_info = KfWorldModel:GetInstance():GetKfWorldTipInfo()
- if not tip_info or TableSize(tip_info) < 1 then return false end
- local kf_num = math.pow(2, tip_info.next_stage-1)
-
- local enough_kf_num = kf_num >= 4
-
- local is_kf_state = true
- local info = KfWorldModel:GetInstance():GetKfWorldInfo()
- if IsTableEmpty(info) then
- is_kf_state = false
- end
- if info.stage and info.stage == 0 then
- is_kf_state = false
- end
-
- return enough_kf_num, is_kf_state
- end
-
- --60315 Ԥ�潱����ȡ����
- function CSMainModel:SetCSMainAdvanceNoticeRewardData(vo)
- self.advance_notice_reward_data = vo.lists
- end
-
- --60316 ����Ԥ�潱����ȡ����
- function CSMainModel:UpdateCSMainAdvanceNoticeRewardData(vo)
- local has_same_day = false
- for k,v in pairs(self.advance_notice_reward_data) do
- if v.day == vo.day then
- has_same_day = true
- break
- end
- end
- if not has_same_day then
- local temp = {day = vo.day}
- table.insert(self.advance_notice_reward_data,temp)
- end
- end
-
- --��ȡԤ�潱������
- function CSMainModel:GetCSMainAdvanceNoticeRewardData( )
- return self.advance_notice_reward_data
- end
-
- --�ж�ij���Ľ����Ƿ�������ȡ
- function CSMainModel:CanDayGetCSMainAdvanceNoticeReward(day)
- if day <= 0 then return false end
- local _,cfg = GetModuleIsOpen(603)
- if cfg.open_day == day then return false end
- local can_get_reward = true
- for k,v in pairs(self.advance_notice_reward_data) do
- if v.day == day then
- can_get_reward = false
- break
- end
- end
- local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
- local enough_day = day <= openDay
- return can_get_reward and enough_day
- end
-
- --�ж�ij��֮ǰ��֮���Ƿ��н���������ȡ day_type 1|֮ǰ 2|֮��
- function CSMainModel:CanDayGetCSMainAdvanceNoticeRewardBeforeOrAfter(day,day_type)
- local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
- local _,cfg = GetModuleIsOpen(603)
- local max_show_day = openDay <= cfg.open_day-1 and openDay or cfg.open_day-1
- local bool = false
- if day_type == 1 then
- for i=1,day-1 do
- if self:CanDayGetCSMainAdvanceNoticeReward(i) then
- bool = true
- break
- end
- end
- elseif day_type == 2 then
- for i=day+1,max_show_day do
- if self:CanDayGetCSMainAdvanceNoticeReward(i) then
- bool = true
- break
- end
- end
- end
- return bool
- end
|