源战役客户端
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

4579 rindas
172 KiB

pirms 1 mēnesi
  1. KfActivityModel = KfActivityModel or BaseClass(BaseVo, true)
  2. local KfActivityModel = KfActivityModel
  3. KfActivityModel.REQUEST_INFO = "KfActivityModel.REQUEST_INFO"
  4. KfActivityModel.OPEN_ACTIVITY_BASE_VIEW = "KfActivityModel.OPEN_ACTIVITY_BASE_VIEW"--打开主界面
  5. KfActivityModel.UPDATE_ACTIVITY_BASE_VIEW = "KfActivityModel.UPDATE_ACTIVITY_BASE_VIEW"--更新主界面
  6. KfActivityModel.OPEN_RANK_SHOW_VIEW = "KfActivityModel.OPEN_RANK_SHOW_VIEW"--打开往期排行
  7. KfActivityModel.OPEN_RANK_RE_CB_VIEW = "KfActivityModel.OPEN_RANK_RE_CB_VIEW"--冲榜升级变强途径
  8. KfActivityModel.REQUEST_INFO = "KfActivityModel.REQUEST_INFO"--请求协议
  9. KfActivityModel.ANS_UPDATE_VIEW = "KfActivityModel.ANS_UPDATE_VIEW"--更新界面
  10. KfActivityModel.UPDATE_ZERO_GIFT_VIEW = "KfActivityModel.UPDATE_ZERO_GIFT_VIEW"--更新0元礼包界面
  11. KfActivityModel.UPDATE_GROUP_BUYING_VIEW = "KfActivityModel.UPDATE_GROUP_BUYING_VIEW"--更新开服团购界面
  12. KfActivityModel.OPEN_GROUP_BUYING_SHARE_VIEW = "KfActivityModel.OPEN_GROUP_BUYING_SHARE_VIEW"--打开团购分享界面
  13. KfActivityModel.MONOPOLY_DICE_ACTION_START = "KfActivityModel.MONOPOLY_DICE_ACTION_START"--开始大富翁骰子动画
  14. KfActivityModel.MONOPOLY_DICE_ACTION_STOP = "KfActivityModel.MONOPOLY_DICE_ACTION_STOP"--停止大富翁骰子动画
  15. KfActivityModel.UPDATE_LIMIT_SECKILL_INFO ="KfActivityModel.UPDATE_LIMIT_SECKILL_INFO" -- 更新秒杀数据
  16. KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO ="KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO" -- 更新秒杀场次数据
  17. KfActivityModel.OPEN_LIMIT_SECKILL_BUY_VIEW ="KfActivityModel.OPEN_LIMIT_SECKILL_BUY_VIEW" -- 打开限时秒杀购买界面
  18. KfActivityModel.LIMIT_SECKILL_BUY_SUCCESS ="KfActivityModel.LIMIT_SECKILL_BUY_SUCCESS" -- 抢购成功
  19. KfActivityModel.OPEN_SCRAOING_CARD_TIPS_VIEW_VIEW ="KfActivityModel.OPEN_SCRAOING_CARD_TIPS_VIEW_VIEW" -- 打开刮刮卡刮奖
  20. KfActivityModel.UPDATE_HAPPY_RED_BAG_INFO ="KfActivityModel.UPDATE_HAPPY_RED_BAG_INFO" -- 更新惊喜红包数据
  21. KfActivityModel.ANS_DRAW_HAPPY_RED_BAG ="KfActivityModel.ANS_DRAW_HAPPY_RED_BAG" -- 抽取惊喜红包
  22. KfActivityModel.UPDATE_HAPPY_RED_BAG_HISTORY ="KfActivityModel.UPDATE_HAPPY_RED_BAG_HISTORY" -- 惊喜红包全服记录
  23. KfActivityModel.ANS_DISCOUNT_FULL_CUT_INFO = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_INFO" -- 折扣满减数据
  24. KfActivityModel.ANS_DISCOUNT_FULL_CUT_HISTORY = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_HISTORY" -- 折扣满减历史记录
  25. KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY" -- 折扣满减历史记录
  26. KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY_TIP = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY_TIP" -- 折扣满减历史记录
  27. KfActivityModel.ANS_DISCOUNT_FULL_CUT_BUY = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_BUY" -- 折扣满减购买
  28. KfActivityModel.SELECT_DISCOUNT_FULL_CUT_GOODS = "KfActivityModel.SELECT_DISCOUNT_FULL_CUT_GOODS" -- 折扣满减购买
  29. KfActivityModel.CHANGE_DISCOUNT_FULL_CUT_TICKET = "KfActivityModel.CHANGE_DISCOUNT_FULL_CUT_TICKET" -- 折扣满减选择券
  30. KfActivityModel.OPEN_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_LUCKY_VIEW" -- 打开折扣转盘界面
  31. KfActivityModel.UPDATE_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.UPDATE_DISCOUNT_FULL_CUT_LUCKY_VIEW"-- 更新折扣转盘界面
  32. KfActivityModel.LUCKY_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.LUCKY_DISCOUNT_FULL_CUT_LUCKY_VIEW"-- 折扣转盘界面抽奖
  33. KfActivityModel.OPEN_MONEY_COPY_VIEW = "KfActivityModel.OPEN_MONEY_COPY_VIEW" -- 打开彩钻复制机
  34. KfActivityModel.UPDATE_MONEY_COPY_VIEW = "KfActivityModel.UPDATE_MONEY_COPY_VIEW" --更新彩钻复制机
  35. KfActivityModel.ANS_PASS_ACT_BASIC = "KfActivityModel.ANS_PASS_ACT_BASIC" -- 活跃/登陆 通行证信息
  36. KfActivityModel.ANS_PASS_ACT_REWARD_LIST = "KfActivityModel.ANS_PASS_ACT_REWARD_LIST" --活跃/登陆 通行证奖励信息
  37. KfActivityModel.OPEN_PASS_ACT_BUY_TIP = "KfActivityModel.OPEN_PASS_ACT_BUY_TIP" --活跃/登陆 通行证购买界面
  38. KfActivityModel.OPEN_ZERO_GIFT_SHOW_VIEW = "KfActivityModel.OPEN_ZERO_GIFT_SHOW_VIEW"--打开0元礼包展示界面
  39. KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW = "KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW"--打开活动引导基础展示界面
  40. local table_insert = table.insert
  41. KfActivityModel.TabID = {
  42. RushRank = 1,--开服冲榜
  43. OpenRecharge = 2,--开服累充
  44. FosterStage = 3,--开服进阶
  45. LimitGift = 4,--限购礼包
  46. LimitShop = 5,--抢购商城
  47. ContinueRecharge = 6,--连充豪礼
  48. ZeroGift = 7,--0元礼包
  49. GroupBuying = 8,--开服团购
  50. SingleRecharge = 9,--单笔充值
  51. Monopoly = 10,--大富翁
  52. Competing = 11,--竞榜
  53. AccConsume = 15,--累计消费
  54. RewardShow = 16, --活动宣传
  55. InvestAct = 19, --投资活动
  56. LimitSeckill = 20, --限时秒杀
  57. DiscountFullCut = 26,--折扣满减
  58. HappyRedBag = 27,--惊喜红包
  59. ComRank = 28,--通用排行
  60. MoneyCopy = 29,--源晶复制机
  61. LoginPass = 39,--登陆通行证
  62. LivelyPass = 40,--活跃通行证
  63. MainlandJourney = 41,--大陆征途
  64. HighExchange = 42,--嗨点兑换
  65. SakuraGift = 47,--源樱之礼
  66. --(主题活动配置方法、资源文件、代码文件)都写到OperateActivity 但是各类更新全部用KfActivityModel的
  67. SingleDayRecharge = 12,--单日充值
  68. BossDrop = 13,--BOSS掉落
  69. DunMul = 14,--副本多倍
  70. BossTreasure = 17,--幻魔宝典
  71. HighPoint = 18, --嗨点玩法
  72. EDayLogin = 21, --每日登录
  73. LuckyTurntable = 22, --幸运轮盘
  74. ScrapingCard = 23, --刮刮卡
  75. GetLuckyBag = 24, --抢福袋
  76. GetRedBag = 25, --抢福袋
  77. Tarot = 29, --塔罗牌
  78. CollectZi = 30, --集字兑换
  79. StageExchange = 31, --阶段兑换
  80. Adventure = 32, --冒险征途
  81. Jigsaw = 33, --活跃拼图
  82. Reversi = 34,--黑白棋抽奖
  83. FestivalBoss = 35,--节日幻魔
  84. AmasingJigsawPuzzle = 36,--眼疾手快趣味拼图
  85. ThreeFight = 37,--三日作战
  86. PrayTree = 38,--人参果树
  87. ComposeRobot = 43,--合成机
  88. SuperAward = 44,--超能大奖
  89. MaterialSubmit = 45,--材料提交
  90. JumpOne = 46,--跳一跳
  91. SelectEgg = 48,--自选扭蛋
  92. }
  93. --is_most代表是否是多条开放性页签(开服活动\精彩活动\主题活动)(sort_id以后让运营单独调一次即可 我们自增)
  94. KfActivityModel.TabData = {
  95. {id = KfActivityModel.TabID.RewardShow, name = "珍宝展示", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.REWARD_SHOW, is_most = true, sort_id = 1},
  96. {id = KfActivityModel.TabID.RushRank, name = "开服冲榜", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.RUSH_RANK, is_most = true, sort_id = 2},
  97. {id = KfActivityModel.TabID.FosterStage, name = "开服进阶", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.FOSTER_STAGE, is_most = true, sort_id = 3},
  98. {id = KfActivityModel.TabID.OpenRecharge, name = "开服累充", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_RECHARGE, is_most = true, sort_id = 4},
  99. {id = KfActivityModel.TabID.AccConsume, name = "累计消费", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ACC_CONSUME, is_most = true, sort_id = 5},
  100. {id = KfActivityModel.TabID.LimitShop, name = "抢购商城", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP, is_most = true, sort_id = 44},
  101. {id = KfActivityModel.TabID.SingleRecharge, name = "单笔充值", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE, is_most = true, sort_id = 7},
  102. {id = KfActivityModel.TabID.ZeroGift, name = "0元礼包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT, is_most = true, sort_id = 2},
  103. {id = KfActivityModel.TabID.ContinueRecharge, name = "连充豪礼", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE, is_most = true, sort_id = 9},
  104. {id = KfActivityModel.TabID.LimitGift, name = "限购礼包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT, is_most = true, sort_id = 10},
  105. {id = KfActivityModel.TabID.Monopoly, name = "大富翁", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MONOPOLY, is_most = true, sort_id = 11},
  106. {id = KfActivityModel.TabID.GroupBuying, name = "开服团购", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING, is_most = true, sort_id = 12},
  107. {id = KfActivityModel.TabID.Competing, name = "限时冲榜", module_id = 333, base_type = CustomActivityModel.CustomActBaseType.COPETING, is_most = true, sort_id = 13},
  108. {id = KfActivityModel.TabID.SingleDayRecharge, name = "单日充值", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SINGLE_DAY_RECHARGE, is_most = true, sort_id = 14},
  109. {id = KfActivityModel.TabID.BossDrop, name = "幻魔掉落", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.BOSS_DROP, is_most = true, sort_id = 15},
  110. {id = KfActivityModel.TabID.DunMul, name = "副本多倍", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.DUN_MUL_DROP, is_most = true, sort_id = 16},
  111. {id = KfActivityModel.TabID.BossTreasure, name = "幻魔宝典", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.BOSS_TREASURE, is_most = true, sort_id = 17},
  112. {id = KfActivityModel.TabID.HighPoint, name = "嗨点玩法", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HIGH_POINT, is_most = true, sort_id = 18},
  113. {id = KfActivityModel.TabID.InvestAct, name = "投资活动", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.INVEST_ACT, is_most = true, sort_id = 8},
  114. {id = KfActivityModel.TabID.LimitSeckill, name = "限时秒杀", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIMIT_SECKILL, is_most = true, sort_id = 20},
  115. {id = KfActivityModel.TabID.EDayLogin, name = "每日登录", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.E_DAY_LOGIN, is_most = true, sort_id = 21},
  116. {id = KfActivityModel.TabID.LuckyTurntable, name = "幸运轮盘", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE, is_most = true, sort_id = 22},
  117. {id = KfActivityModel.TabID.ScrapingCard, name = "刮刮卡", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SCRAPING_CRAD, is_most = true, sort_id = 23},
  118. {id = KfActivityModel.TabID.GetLuckyBag, name = "抢福袋", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG, is_most = true, sort_id = 24},
  119. {id = KfActivityModel.TabID.GetRedBag, name = "抢红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.GET_RED_BAG, is_most = true, sort_id = 25},
  120. {id = KfActivityModel.TabID.DiscountFullCut, name = "折扣满减", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT, is_most = true, sort_id = 26},
  121. {id = KfActivityModel.TabID.HappyRedBag, name = "惊喜红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, is_most = true, sort_id = 27},
  122. {id = KfActivityModel.TabID.ComRank, name = "通用排行", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COM_RANK, is_most = true, sort_id = 29},
  123. {id = KfActivityModel.TabID.Tarot, name = "塔罗牌", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.TAROT, is_most = true, sort_id = 29},
  124. {id = KfActivityModel.TabID.CollectZi, name = "集字兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COLLECT_ZI, is_most = true, sort_id = 30},
  125. {id = KfActivityModel.TabID.HappyRedBag, name = "惊喜红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, is_most = true, sort_id = 31},
  126. {id = KfActivityModel.TabID.StageExchange, name = "阶段兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE, is_most = true, sort_id = 32},
  127. {id = KfActivityModel.TabID.Adventure, name = "冒险征途", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ADVENTURE, is_most = true, sort_id = 33},
  128. {id = KfActivityModel.TabID.Reversi, name = "黑白棋抽奖", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.REVERSI, is_most = true, sort_id = 34},
  129. {id = KfActivityModel.TabID.Jigsaw, name = "活跃拼图", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.JIGSAW, is_most = true, sort_id = 35},
  130. {id = KfActivityModel.TabID.FestivalBoss, name = "节日幻魔", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS, is_most = true, sort_id = 36},
  131. {id = KfActivityModel.TabID.AmasingJigsawPuzzle, name = "趣味拼图", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.AMUSING_JIGSAW_PUZZLE, is_most = true, sort_id = 37},
  132. {id = KfActivityModel.TabID.ThreeFight, name = "三日作战", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.THREE_FIGHT, is_most = true, sort_id = 37},
  133. {id = KfActivityModel.TabID.PrayTree, name = "人参果树", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.PRAY_TREE, is_most = true, sort_id = 38},
  134. {id = KfActivityModel.TabID.LoginPass, name = "登陆通行证", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LOGIN_PASS, is_most = true, sort_id = 39},
  135. {id = KfActivityModel.TabID.LivelyPass, name = "活跃通行证", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIVELY_PASS, is_most = true, sort_id = 40},
  136. {id = KfActivityModel.TabID.MainlandJourney, name = "大陆征途", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MAINLAND_JOURNEY, is_most = true, sort_id = 41},
  137. {id = KfActivityModel.TabID.HighExchange, name = "嗨点兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE, is_most = true, sort_id = 42},
  138. {id = KfActivityModel.TabID.ComposeRobot, name = "合成机", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT, is_most = true, sort_id = 2},
  139. {id = KfActivityModel.TabID.SuperAward, name = "超能大奖", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SUPER_AWARD, is_most = true, sort_id = 6},
  140. {id = KfActivityModel.TabID.MaterialSubmit, name = "材料提交", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, is_most = true, sort_id = 45},
  141. {id = KfActivityModel.TabID.JumpOne, name = "跳一跳", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.JUMP_ONE, is_most = true, sort_id = 46},
  142. {id = KfActivityModel.TabID.SelectEgg, name = "自选扭蛋", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SELECT_EGG, is_most = true, sort_id = 3},
  143. }
  144. KfActivityModel.MaxRankDay = 9--开服天数限制
  145. KfActivityModel.MaxRankType = 9--榜单类型限制
  146. KfActivityModel.SpecialRankType = 9--榜单特殊类型
  147. KfActivityModel.MonopolyCircleTypeFive = 1--1-5圈
  148. KfActivityModel.MonopolyCircleTypeTen = 2--2-10圈
  149. KfActivityModel.MonopolyMaxCircle = 10--最大10圈
  150. KfActivityModel.MonopolyMaxLattice = 26--最大26格有效格子数(起点终点不算)
  151. KfActivityModel.ComRankStr = {
  152. ["recharge"] = {desc = "充值彩钻",btn_desc = "前往充值"},
  153. ["consume"] = {desc = "消费彩钻",btn_desc = "前往消费"},
  154. ["item"] = {desc = "道具数量",btn_desc = "获取道具"},
  155. }
  156. KfActivityModel.KfDFullCutLuckyGoodsId = 105200--折扣转盘抽奖id
  157. KfActivityModel.AdventureOneCost = 10--冒险征途单次抽取的消耗数
  158. KfActivityModel.AdventureTenCost = 100--冒险征途单次抽取的消耗数
  159. KfActivityModel.ContinueSignRechargePrice = 300--补签需要充值的金额
  160. function KfActivityModel:__init()
  161. KfActivityModel.Instance = self
  162. self.login_red = nil--登陆红点
  163. self:Reset()
  164. end
  165. function KfActivityModel:Reset()
  166. self.view_info = {}--界面信息
  167. self.act_red_dot_info = {}
  168. self.red_dot_info = {}
  169. self.rush_rank_info = {}--冲榜信息
  170. -- self.limit_shop_red_first_open_list = {}--限购商城红点每日登陆列表
  171. self.limit_shop_toggle = {}--限购商城购买确认信息
  172. self.limit_gift_toggle = {}--限购礼包购买确认信息
  173. self.zero_gift_toggle = {}--0元礼包购买确认信息
  174. self.kf_group_buying_toggle = {}--限购礼包购买确认信息
  175. self.high_info = {}--嗨点活动信息
  176. self.high_point_toggle = {}--嗨点复选提示框信息
  177. self.is_close_main_icon = false
  178. self.zero_gift_view_info = {}--0元礼包信息33185、33186
  179. if self.zero_gift_time_id_list then
  180. for k,v in pairs(self.zero_gift_time_id_list) do
  181. GlobalTimerQuest:CancelQuest(v)
  182. v = nil
  183. end
  184. end
  185. self.zero_gift_time_id_list = {}
  186. self.zero_gift_first_open_red_list = {} --首次0元礼包活动的红点
  187. self.zero_gift_first_open_red_flag = {} --首次0元礼包活动的红点是否干掉
  188. --团购活动
  189. self.group_buying_view_info = {}--团购信息
  190. self.group_buying_time_list = {}--团购倒计时时间列表
  191. if self.groupBuying_time_id_list then--团购倒计时列表
  192. for k,v in pairs(self.groupBuying_time_id_list) do
  193. GlobalTimerQuest:CancelQuest(v)
  194. v = nil
  195. end
  196. end
  197. self.groupBuying_time_id_list = {}--计时器ID列表
  198. --大富翁
  199. self.monopoly_info = {}--大富翁信息
  200. self.monopoly_first_open_red_flag = {}--大富翁红点信息
  201. -- 投资活动
  202. self.invest_event_data = {}
  203. self.invest_grade_red_cache = {} -- 投资活动档位红点缓存s
  204. self:InitCfg()
  205. self:InitMonopolyCfg()--初始化大富翁配置
  206. self:InitActViewClassTable()
  207. self:InitRewardShowCfg() -- 初始化珍宝展示配置
  208. --限时秒杀
  209. self.limit_seckill_base_info = {}--基础信息
  210. self.limit_seckill_round_info = {}--场次信息
  211. self.limit_seckill_record_info = {}--购买记录
  212. self.limit_seckill_buy_info = {}--抢购界面信息
  213. self.is_open_limit_seckill_view = false
  214. self.sec_kill_buy_sure = {} -- 消耗彩钻无须确认
  215. self.sec_kill_remind_cache = {} -- 开抢前两分钟提醒
  216. --刮刮卡
  217. self.is_red_scraping_card_list = {}
  218. --塔罗牌
  219. self.is_red_tarot_list = {}
  220. --惊喜红包
  221. self.happy_red_bag_base_info = {}--基础信息
  222. self.happy_red_bag_history_info = {}--抽取全服记录
  223. --折扣满减
  224. self.discount_full_cut_info = {}--基础信息
  225. self.discount_full_cut_history = {}--购买记录
  226. self.discount_full_cut_lucky_list = {}--设置折扣满减奖池数据
  227. self.discount_full_cut_mask_first_open_red = {}--首次开界面红点
  228. self.discount_full_cut_new_red = {}--折扣满减活动新开红点
  229. self.discount_full_cut_draw_goods_red = {}--折扣满减活动物品红点
  230. self.discount_full_cut_draw_goods_num = 0--保存当前折扣满减活动物品数量
  231. self.discount_full_cut_draw_free_red = {}--折扣满减活动免费抽奖次数红点
  232. self.discount_full_cut_draw_free_status = {}--保存当前折扣满减活动免费抽奖次数
  233. --人参果树
  234. self.is_red_praytreelist = {}
  235. --通用排行
  236. self.com_rank_info = {}--封榜活动信息
  237. self.money_copy_data = {}--彩钻复制机
  238. self.pass_act_info = {}--通行证
  239. self.pass_act_reward_info = {}
  240. --小额连充信息
  241. self.kf_continue_info = {}
  242. --开服进阶红点信息
  243. self.forsert_stage_red_info = {}
  244. --开服团购红点信息
  245. self.group_red_list = {}
  246. --嗨点兑换登陆一次红点信息
  247. self.high_login_red_list = {}
  248. self.act_guide_cache = false -- 活动指引记录缓存
  249. self:ResetFosterActGuideBtnCache()
  250. end
  251. function KfActivityModel:getInstance()
  252. if KfActivityModel.Instance == nil then
  253. KfActivityModel.Instance = KfActivityModel.New()
  254. end
  255. return KfActivityModel.Instance
  256. end
  257. --初始化活动界面类
  258. function KfActivityModel:InitActViewClassTable( )
  259. self.act_view_class = {--所有活动界面类
  260. [KfActivityModel.TabID.RushRank] = KfActivityRushRankView,--开服冲榜
  261. [KfActivityModel.TabID.OpenRecharge] = KfActivityOpenRechargeView,--开服累充
  262. [KfActivityModel.TabID.FosterStage] = KfActivityForsterStageView,--开服进阶
  263. [KfActivityModel.TabID.LimitGift] = KfActivityLimitGiftSubView,--限购礼包
  264. [KfActivityModel.TabID.LimitShop] = KfActivityLimitShopView,--抢购商城
  265. [KfActivityModel.TabID.ContinueRecharge] = KfActivityContinueRechargeViewNew,--连充豪礼
  266. [KfActivityModel.TabID.ZeroGift] = KfActivityZeroGiftSubView,--0元礼包
  267. [KfActivityModel.TabID.GroupBuying] = KfGroupBuyingView,--开服团购
  268. [KfActivityModel.TabID.SingleRecharge] = KfActivitySingleRechargeView,--单笔充值
  269. [KfActivityModel.TabID.Monopoly] = KfMonopolyMainView,--大富翁
  270. [KfActivityModel.TabID.Competing] = KfCompetingListMainView,--竞榜
  271. [KfActivityModel.TabID.SingleDayRecharge] = OpSingleRechargeSubView,--单日充值
  272. [KfActivityModel.TabID.BossDrop] = OpBossActDropSubView,--BOSS掉落
  273. [KfActivityModel.TabID.DunMul] = OpDunMultipleDropView,--副本多倍
  274. [KfActivityModel.TabID.AccConsume] = KfActivityAccConsumeView,--累计消费
  275. [KfActivityModel.TabID.RewardShow] = ActivityRewardShowView,--奖励展示
  276. [KfActivityModel.TabID.BossTreasure] = KfBossTreasureView,--幻魔宝典
  277. [KfActivityModel.TabID.HighPoint] = KfActHighPointView,--嗨点玩法
  278. [KfActivityModel.TabID.EDayLogin] = KfActivityEDayLoginView,--每日登录
  279. [KfActivityModel.TabID.ScrapingCard] = KfActivityScrapingCardView,--刮刮卡
  280. [KfActivityModel.TabID.InvestAct] = KfActivityInvestmentView,--投资活动
  281. [KfActivityModel.TabID.LimitSeckill] = LimitSecKillView,--限时秒杀
  282. [KfActivityModel.TabID.LuckyTurntable] = LuckyTurnTableView,--幸运轮盘
  283. [KfActivityModel.TabID.GetLuckyBag] = GetLuckyBagView,--抢福袋
  284. [KfActivityModel.TabID.GetRedBag] = GetLuckyBagView,--抢红包
  285. [KfActivityModel.TabID.DiscountFullCut] = KfDiscountFullCutView,--折扣满减
  286. [KfActivityModel.TabID.HappyRedBag] = KfHappyRedBagView,--惊喜红包
  287. [KfActivityModel.TabID.ComRank] = KfActivityComRankView,--通用排行
  288. [KfActivityModel.TabID.Tarot] = KfActivityTarotView,--塔罗牌
  289. [KfActivityModel.TabID.CollectZi] = OpCollectZiView,--集字兑换
  290. [KfActivityModel.TabID.StageExchange] = OpStageExchangeView,--阶段兑换
  291. [KfActivityModel.TabID.Adventure] = OpAdventureView,--冒险征途
  292. [KfActivityModel.TabID.Jigsaw] = OpJigsawView,--活跃拼图
  293. [KfActivityModel.TabID.Reversi] = OpReversiView,--黑白棋抽奖
  294. [KfActivityModel.TabID.FestivalBoss] = OpFestivalBossView,--节日幻魔
  295. [KfActivityModel.TabID.AmasingJigsawPuzzle] = OpAmasingJigsawView,--节日拼图
  296. [KfActivityModel.TabID.ThreeFight] = OpThreeFightView,--三日作战
  297. [KfActivityModel.TabID.LoginPass] = KfActivityLoginPassView,--登陆通行证
  298. [KfActivityModel.TabID.LivelyPass] = KfActivityLivelyPassView,--活跃通行证
  299. [KfActivityModel.TabID.PrayTree] = OpActivityPrayTreeView,--人参果树
  300. [KfActivityModel.TabID.ComposeRobot] = OpComposeRobotView,--合成机
  301. [KfActivityModel.TabID.HighExchange] = KfActHighExchangeView,--嗨点兑换
  302. [KfActivityModel.TabID.SuperAward] = OpSuperAwardView,--超能大奖
  303. --以下需要开发的新活动
  304. -- [KfActivityModel.TabID.MainlandJourney] = OpActivityPrayTreeView,--大陆征途
  305. -- [KfActivityModel.TabID.ComposeRobot] = OpActivityPrayTreeView,--合成机
  306. [KfActivityModel.TabID.MaterialSubmit] = OpMaterialSubmitView,--材料提交
  307. [KfActivityModel.TabID.JumpOne] = JumpOneMainView,--跳一跳
  308. [KfActivityModel.TabID.SelectEgg] = OpSelectEggView,--自选扭蛋
  309. }
  310. end
  311. --初始化配置
  312. function KfActivityModel:InitCfg( )
  313. self.rush_rank_cfg = {}--冲榜基本配置
  314. local rush_rank_cfg = DeepCopy(Config.Rushrank)
  315. for k,v in pairs(rush_rank_cfg) do
  316. local data = v
  317. data.limit = stringtotable(v.limit)--目标条件
  318. data.figure_id = stringtotable(v.figure_id)--展示模型
  319. data.nominate = stringtotable(v.nominate)--跳转数据
  320. data.name = Trim(v.name)--名字
  321. data.tips = Trim(v.tips)--大奖名字
  322. self.rush_rank_cfg[v.id] = data
  323. if v.start_day > KfActivityModel.MaxRankDay then
  324. KfActivityModel.MaxRankDay = v.start_day
  325. KfActivityModel.MaxRankType = v.id
  326. end
  327. end
  328. self.rush_rank_award_cfg = {}--冲榜排行奖励配置
  329. local rush_rank_award_cfg = DeepCopy(Config.Rushrankreward)
  330. for k,v in pairs(rush_rank_award_cfg) do
  331. local data = v
  332. data.rank_limit = stringtotable(v.rank_limit)--目标条件
  333. data.reward = stringtotable(v.reward)--奖励
  334. data.about = Trim(v.about)--说明
  335. if not self.rush_rank_award_cfg[v.id] then
  336. self.rush_rank_award_cfg[v.id] = {}
  337. end
  338. self.rush_rank_award_cfg[v.id][#self.rush_rank_award_cfg[v.id] + 1] = data
  339. end
  340. local sortFunc = function (a,b)
  341. return a.reward_id < b.reward_id
  342. end
  343. for i,v in ipairs(self.rush_rank_award_cfg) do
  344. table.sort(v, sortFunc)
  345. end
  346. self.rush_rank_goal_cfg = {}--冲榜targer奖励配置
  347. local rush_rank_goal_cfg = DeepCopy(Config.Rushgoalreward)
  348. for k,v in pairs(rush_rank_goal_cfg) do
  349. local data = v
  350. data.goal_value = stringtotable(v.goal_value)--目标条件
  351. data.reward = stringtotable(v.reward)--奖励配置
  352. data.about = Trim(v.about)--说明
  353. if not self.rush_rank_goal_cfg[v.id] then
  354. self.rush_rank_goal_cfg[v.id] = {}
  355. end
  356. self.rush_rank_goal_cfg[v.id][#self.rush_rank_goal_cfg[v.id] + 1] = data
  357. end
  358. for i,v in ipairs(self.rush_rank_goal_cfg) do
  359. table.sort(v, sortFunc)
  360. end
  361. self.com_rank_score_cfg = {}
  362. local com_rank_score_cfg = DeepCopy(Config.Vierankreq)
  363. for k,v in pairs(com_rank_score_cfg) do
  364. local data = v
  365. data.type_value = Trim(v.type_value)--说明
  366. if not self.com_rank_score_cfg[v.type_key] then
  367. self.com_rank_score_cfg[v.type_key] = {}
  368. end
  369. self.com_rank_score_cfg[v.type_key][v.rank] = data
  370. end
  371. end
  372. --初始化大富翁配置
  373. function KfActivityModel:InitMonopolyCfg( )
  374. self.mono_kv_cfg = {}--大富翁常量配置
  375. local mono_kv_cfg = DeepCopy(Config.Monokv)
  376. for k,v in pairs(mono_kv_cfg) do
  377. if k == "gold_dice_count" then
  378. self.mono_kv_cfg.gold_dice_count = v.val--每日最大获得金骰子数量
  379. elseif k == "gold_dice_level" then
  380. self.mono_kv_cfg.gold_dice_level = stringtotable(v.val)--充值赠送金骰子档位
  381. elseif k == "luckycard_count" then
  382. self.mono_kv_cfg.luckycard_count = v.val --幸运卡池数量
  383. elseif k == "mono_total_round" then
  384. self.mono_kv_cfg.mono_total_round = v.val --活动总圈数
  385. elseif k == "normal_dice_count" then
  386. self.mono_kv_cfg.normal_dice_count = v.val --每日最大获得普通骰子数量
  387. elseif k == "normal_dice_level" then
  388. self.mono_kv_cfg.normal_dice_level = stringtotable(v.val) --充值赠送普通骰子档位
  389. end
  390. end
  391. self.mono_lattice_cfg = {}--大富翁圈数格子配置
  392. local mono_lattice_cfg = DeepCopy(Config.Monolattice)
  393. for k,v in pairs(mono_lattice_cfg) do
  394. if not self.mono_lattice_cfg[v.round] then
  395. self.mono_lattice_cfg[v.round] = {}
  396. end
  397. self.mono_lattice_cfg[v.round][v.lattice_index] = v
  398. end
  399. self.mono_smallbox_award_cfg = {}--大富翁小宝箱配置
  400. local mono_smallbox_award_cfg = DeepCopy(Config.Monosmallbox)
  401. for k,v in pairs(mono_smallbox_award_cfg) do
  402. local data = v
  403. data.rewards = stringtotable(data.rewards)[1]
  404. self.mono_smallbox_award_cfg[v.index] = data
  405. end
  406. self.mono_lucky_award_cfg = {}--大富翁幸运卡奖励
  407. local mono_lucky_award_cfg = DeepCopy(Config.Monoluckycard)
  408. for k,v in pairs(mono_lucky_award_cfg) do
  409. local data = v
  410. data.rewards = stringtotable(data.rewards)[1]
  411. self.mono_lucky_award_cfg[v.index] = data
  412. end
  413. self.mono_round_award_cfg = {}--大富翁圈数奖励
  414. local mono_round_award_cfg = DeepCopy(Config.Monoroundrewards)
  415. for k,v in pairs(mono_round_award_cfg) do
  416. local data = v
  417. data.rewards = stringtotable(data.rewards)[1]
  418. data.show = stringtotable(data.show)
  419. if not self.mono_round_award_cfg[v.sub_type] then
  420. self.mono_round_award_cfg[v.sub_type] = {}
  421. end
  422. self.mono_round_award_cfg[v.sub_type][v.round] = data
  423. end
  424. end
  425. -- 初始化珍宝展示的配置
  426. function KfActivityModel:InitRewardShowCfg( )
  427. self.show_res_cfg = {}
  428. for k,v in pairs(Config.Showresource) do
  429. if not self.show_res_cfg[v.item_id] then
  430. self.show_res_cfg[v.item_id] = {}
  431. end
  432. self.show_res_cfg[v.item_id][v.model_id] = self.show_res_cfg[v.item_id][v.model_id] or {}
  433. self.show_res_cfg[v.item_id][v.model_id][v.model_type] = v
  434. end
  435. end
  436. -- 获取珍宝展示配置
  437. function KfActivityModel:GetRewardShowCfg( item_id )
  438. local item_id = tonumber(item_id)
  439. if item_id and self.show_res_cfg[item_id] then
  440. return self.show_res_cfg[item_id]
  441. else
  442. -- logWarn('=======Msh:KfActivityModel.lua[278]=参数有误======', item_id)
  443. end
  444. end
  445. --更新主界面活动图标红点(开服、主题、精彩)CustomActivityModel.CustomIconActType
  446. function KfActivityModel:CheckMainIconRedDot( act_type )
  447. if not act_type then
  448. return
  449. end
  450. local bool = false
  451. local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
  452. local sub_type = nil
  453. local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
  454. for k,v in pairs(sub_type_list) do
  455. if v.act_type == act_type then
  456. sub_type = v.sub_type
  457. break
  458. end
  459. end
  460. if not sub_type then return end
  461. local icon_sub_type = base_type*1000 + sub_type
  462. if sub_type >= 10001 then
  463. icon_sub_type = base_type*100000 + sub_type
  464. end
  465. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  466. if not act_list then
  467. return
  468. else
  469. if self.red_dot_info[act_type] then
  470. for k,v in pairs(self.red_dot_info[act_type]) do
  471. local module_sub_id = self:ByTabIdGetActType(k)
  472. if GetModuleIsOpen(331,module_sub_id)
  473. or (k == KfActivityModel.TabID.Competing and GetModuleIsOpen(333,nil))--竞榜是333模块的
  474. then
  475. if module_sub_id == CustomActivityModel.CustomActBaseType.SUPER_AWARD then--超能大奖比较特殊
  476. for kk,vv in pairs(v) do
  477. if vv == true and self:CheckSuperAwardTabIsOpen(module_sub_id,kk) then
  478. bool = vv
  479. break
  480. end
  481. end
  482. elseif module_sub_id == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换比较特殊
  483. for sub_type,vv in pairs(v) do
  484. if not self.high_login_red_list[sub_type] then
  485. bool = true
  486. break
  487. end
  488. end
  489. else
  490. for kk,vv in pairs(v) do
  491. if vv == true then
  492. bool = vv
  493. break
  494. end
  495. end
  496. end
  497. end
  498. end
  499. end
  500. -- print("huangcong:KfActivityModel [start:445] :", icon_sub_type,act_type)
  501. -- PrintTable(self.red_dot_info[act_type])
  502. -- print("huangcong:KfActivityModel [end]")
  503. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, icon_sub_type, bool)
  504. end
  505. end
  506. --通过页签ID获得定制活动类型
  507. function KfActivityModel:ByTabIdGetActType( tabId )
  508. for i,v in ipairs(KfActivityModel.TabData) do
  509. if v.id == tabId then
  510. return v.base_type
  511. end
  512. end
  513. end
  514. --通过定制活动类型获得页签ID
  515. function KfActivityModel:ByActTypeGetTabId( act_type )
  516. for i,v in ipairs(KfActivityModel.TabData) do
  517. if v.base_type == act_type then
  518. return v.id
  519. end
  520. end
  521. end
  522. --这样写红点 每次调全局的只要调两次
  523. function KfActivityModel:IsNeedRedAll( )--暂时去掉
  524. end
  525. function KfActivityModel:IsNeedRed( id,is_all,sub_type )
  526. local bool = false
  527. local act_type = CustomActivityModel.CustomIconActType.KfAct--默认是开服活动
  528. if id == KfActivityModel.TabID.RushRank then--开服冲榜
  529. sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.RUSH_RANK)
  530. bool,act_type = self:CheckRushRankRedDot(sub_type)
  531. elseif id == KfActivityModel.TabID.OpenRecharge then--开服累充
  532. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.KFACTIVITY_RECHARGE,sub_type)
  533. elseif id == KfActivityModel.TabID.FosterStage then--开服进阶
  534. bool,act_type = self:CheckFosterStageRedDot(CustomActivityModel.CustomActBaseType.FOSTER_STAGE,sub_type)
  535. elseif id == KfActivityModel.TabID.LimitGift then--限购礼包
  536. bool,act_type = self:CheckLimitGiftRedDot(sub_type)
  537. elseif id == KfActivityModel.TabID.LimitShop then--限购商城
  538. bool,act_type = self:CheckLimitShopRedDot(sub_type)
  539. elseif id == KfActivityModel.TabID.ContinueRecharge then--连充豪礼
  540. bool,act_type = self:CheckContinueRechargeRedDot(CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE,sub_type)
  541. elseif id == KfActivityModel.TabID.ZeroGift and GetModuleIsOpen(331,36) then--0元礼包
  542. bool,act_type = self:CheckZeroGiftRedDot(sub_type)
  543. elseif id == KfActivityModel.TabID.GroupBuying and GetModuleIsOpen(331,70) then--开服团购
  544. bool,act_type = self:CheckKfGroupBuyingRedDot(sub_type)
  545. elseif id == KfActivityModel.TabID.SingleDayRecharge then
  546. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SINGLE_DAY_RECHARGE,sub_type)
  547. elseif id == KfActivityModel.TabID.SingleRecharge then--单笔充值
  548. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE,sub_type)
  549. if not bool then
  550. local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE,sub_type)
  551. if com_act_red_info then
  552. bool = com_act_red_info.status == 1
  553. end
  554. end
  555. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE][sub_type] = bool
  556. elseif id == KfActivityModel.TabID.Monopoly then--大富翁
  557. bool,act_type = self:CheckMonopolyRedDot(sub_type)
  558. elseif id == KfActivityModel.TabID.Competing then--竞榜--这里先默认放到开服活动类型中
  559. bool,act_type = self:CheckCompetingRedDot(sub_type)
  560. elseif id == KfActivityModel.TabID.BossDrop then--boss掉落
  561. bool,act_type = self:CheckBossDropRedDot(sub_type)
  562. elseif id == KfActivityModel.TabID.DunMul then--副本多倍
  563. bool,act_type = self:CheckDunMulRedDot(sub_type)
  564. elseif id == KfActivityModel.TabID.AccConsume then--开服累充
  565. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.ACC_CONSUME,sub_type)
  566. elseif id == KfActivityModel.TabID.BossTreasure then--幻魔宝典
  567. bool,act_type = self:CheckActBossTreasureRedDot(sub_type)
  568. elseif id == KfActivityModel.TabID.HighPoint then--嗨点玩法
  569. bool,act_type = self:CheckHighPointRedDot(CustomActivityModel.CustomActBaseType.HIGH_POINT,sub_type)
  570. elseif id == KfActivityModel.TabID.InvestAct then--投资活动
  571. bool,act_type = self:CheckActInvestRedDot(sub_type)
  572. elseif id == KfActivityModel.TabID.LimitSeckill then--限时秒杀
  573. bool,act_type = self:CheckSecKillRedDot(sub_type)
  574. elseif id == KfActivityModel.TabID.EDayLogin then--每日登录
  575. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.E_DAY_LOGIN,sub_type)
  576. elseif id == KfActivityModel.TabID.LuckyTurntable then--幸运轮盘
  577. bool,act_type = self:CheckLuckyTurnTableRedDot(sub_type)
  578. elseif id == KfActivityModel.TabID.ScrapingCard then--刮刮卡
  579. bool,act_type = self:CheckScrapingCardRedDot(CustomActivityModel.CustomActBaseType.SCRAPING_CRAD,sub_type)
  580. elseif id == KfActivityModel.TabID.DiscountFullCut then--折扣满减
  581. bool,act_type = self:CheckKfDiscountFullCutRedDot(sub_type)
  582. elseif id == KfActivityModel.TabID.ComRank then--通用排行
  583. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.COM_RANK,sub_type)
  584. elseif id == KfActivityModel.TabID.Tarot then--塔罗牌
  585. bool,act_type = self:CheckActTarotRedDot(CustomActivityModel.CustomActBaseType.TAROT,sub_type)
  586. elseif id == KfActivityModel.TabID.CollectZi then--集字兑换
  587. bool,act_type = self:CheckCollectActRedDot(CustomActivityModel.CustomActBaseType.COLLECT_ZI,sub_type)
  588. elseif id == KfActivityModel.TabID.HappyRedBag then--惊喜红包
  589. bool,act_type = self:CheckActHappyRedBagRedDot(sub_type)
  590. elseif id == KfActivityModel.TabID.StageExchange then--阶段兑换
  591. bool,act_type = self:CheckStageExchangeRedDot(CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE,sub_type)
  592. elseif id == KfActivityModel.TabID.Adventure then--冒险征途
  593. bool,act_type = self:CheckAdventureRedDot(CustomActivityModel.CustomActBaseType.ADVENTURE,sub_type)
  594. elseif id == KfActivityModel.TabID.Reversi then--黑白棋抽奖
  595. bool,act_type = self:CheckReversiRedDot(CustomActivityModel.CustomActBaseType.REVERSI,sub_type)
  596. elseif id == KfActivityModel.TabID.FestivalBoss then--节日幻魔
  597. bool,act_type = self:CheckFestivalBossRedDot(CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS,sub_type)
  598. elseif id == KfActivityModel.TabID.Jigsaw then--活跃拼图
  599. bool, act_type = self:CheckJigsawRedDot(CustomActivityModel.CustomActBaseType.JIGSAW, sub_type)
  600. elseif id == KfActivityModel.TabID.AmasingJigsawPuzzle then--眼疾手快趣味拼图
  601. -- bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.AMUSING_JIGSAW_PUZZLE,sub_type)
  602. elseif id == KfActivityModel.TabID.ThreeFight then--三日作战
  603. bool, act_type = OperateActivityModel:getInstance():CheckThreeFightRedDot(sub_type)
  604. if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT] then
  605. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT] = {}
  606. end
  607. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT][sub_type] = bool
  608. elseif id == KfActivityModel.TabID.LoginPass then--登陆通行证
  609. bool,act_type = self:CheckComPassRedDot(CustomActivityModel.CustomActBaseType.LOGIN_PASS,sub_type)
  610. elseif id == KfActivityModel.TabID.LivelyPass then--活跃通行证
  611. bool,act_type = self:CheckComPassRedDot(CustomActivityModel.CustomActBaseType.LIVELY_PASS,sub_type)
  612. elseif id == KfActivityModel.TabID.PrayTree then--人参果树(祈福活动)
  613. bool,act_type = self:CheckPrayTreeRedDot(CustomActivityModel.CustomActBaseType.PRAY_TREE,sub_type)
  614. elseif id == KfActivityModel.TabID.MainlandJourney then--大陆征途
  615. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.MAINLAND_JOURNEY,sub_type)
  616. elseif id == KfActivityModel.TabID.HighExchange then--嗨点兑换
  617. bool,act_type = self:CheckHighPointRedDot(CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE,sub_type)
  618. elseif id == KfActivityModel.TabID.ComposeRobot then--合成机
  619. bool,act_type = self:CheckActComposeRobotRedDot(CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT,sub_type)
  620. elseif id == KfActivityModel.TabID.SuperAward then--超能大奖
  621. bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SUPER_AWARD,sub_type)
  622. elseif id == KfActivityModel.TabID.MaterialSubmit then--材料提交
  623. bool,act_type = self:CheckActMaterialSubmitRedDot(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT,sub_type)
  624. elseif id == KfActivityModel.TabID.SelectEgg then--自选扭蛋
  625. bool,act_type = self:CheckActSelectEggRedDot(CustomActivityModel.CustomActBaseType.SELECT_EGG,sub_type)
  626. end
  627. act_type = act_type or CustomActivityModel.CustomIconActType.KfAct
  628. if not self.red_dot_info[act_type] then--红点信息要和活动类型对应
  629. self.red_dot_info[act_type] = {}
  630. end
  631. if not self.red_dot_info[act_type][id] then--红点信息要和活动类型对应
  632. self.red_dot_info[act_type][id] = {}
  633. end
  634. if sub_type then
  635. self.red_dot_info[act_type][id][sub_type] = bool
  636. end
  637. self:Fire(KfActivityModel.ANS_UPDATE_VIEW,id,bool,sub_type)
  638. if not is_all then
  639. self:CheckMainIconRedDot(act_type)
  640. end
  641. -- print("huangcong:KfActivityModel [222]: ",bool,id)
  642. -- PrintTable(self.red_dot_info)
  643. end
  644. --清除活动刷新红点信息
  645. function KfActivityModel:ClearActRedDotInfo( base_type,sub_type )
  646. local id = nil
  647. for i,v in ipairs(KfActivityModel.TabData) do
  648. if base_type == v.base_type then
  649. id = v.id
  650. break
  651. end
  652. end
  653. if id then
  654. for act_type,v in pairs(self.red_dot_info) do
  655. for v_id,vv in pairs(v) do
  656. if v_id == id then
  657. for v_sub_type,vvv in pairs(vv) do
  658. if v_sub_type == sub_type then
  659. self.red_dot_info[act_type][v_id][sub_type] = false
  660. self:CheckMainIconRedDot(act_type)
  661. return
  662. end
  663. end
  664. end
  665. end
  666. end
  667. end
  668. end
  669. --设置0元礼包首次打开cookie
  670. function KfActivityModel:SetZeroGiftFirstOpenCookie( bool )
  671. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.ZERO_GIFT_VIEW_FIRST_OPEN,bool)
  672. CookieWrapper.Instance:WriteAll()
  673. end
  674. --获得0元礼包首次打开cookie
  675. function KfActivityModel:GetZeroGiftFirstOpenCookie( )
  676. local bool = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.ZERO_GIFT_VIEW_FIRST_OPEN) or false
  677. return bool
  678. end
  679. --获得0元礼包是否首次打开过
  680. function KfActivityModel:GetZeroGiftFirstOpenRed(sub_type)
  681. if self.zero_gift_first_open_red_list then
  682. return self.zero_gift_first_open_red_list[sub_type] or false
  683. end
  684. return false
  685. end
  686. --0元礼包首次打开红点
  687. function KfActivityModel:SetZeroGiftFirstOpenRed(sub_type)
  688. if self.zero_gift_first_open_red_list[sub_type] then
  689. self.zero_gift_first_open_red_list[sub_type] = false
  690. self.zero_gift_first_open_red_flag[sub_type] = true
  691. self:IsNeedRed(KfActivityModel.TabID.ZeroGift,nil,sub_type)
  692. end
  693. end
  694. --判断等级是否达到0元礼包可购买等级
  695. function KfActivityModel:IsLvCanBuyZeroGift(level)
  696. local bool = false
  697. local base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT
  698. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
  699. if not all_list then return false end
  700. local sub_type = CustomActivityModel:getInstance():getActMinSubType(base_type)
  701. for k,v in pairs(all_list) do
  702. local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
  703. if award_data then
  704. for kk,vv in ipairs(award_data.reward_list) do
  705. local cost_num = 99999
  706. local buy_level = 99999
  707. for m,n in ipairs(vv.condition_list) do
  708. if n[1] == "cost" then
  709. cost_num = tonumber(n[2][1][3])
  710. elseif n[1] == "buy_lv" then
  711. buy_level = tonumber(n[2]) or 1
  712. end
  713. if cost_num == 0 and buy_level == level then
  714. bool = true
  715. sub_type = v.sub_type
  716. break
  717. end
  718. end
  719. end
  720. end
  721. end
  722. return bool,sub_type
  723. end
  724. --检查0元礼包红点
  725. function KfActivityModel:CheckZeroGiftRedDot( sub_type )
  726. local show = false
  727. local base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT
  728. local server_time = TimeUtil:getServerTime()
  729. local my_level = RoleManager.Instance.mainRoleInfo.level
  730. local act_type = CustomActivityModel.CustomIconActType.KfAct
  731. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  732. if not act_list then return show end
  733. act_type = act_list.act_type
  734. act_list = DeepCopy(act_list)
  735. if not self.act_red_dot_info[base_type] then
  736. self.act_red_dot_info[base_type] = {}--红点信息
  737. end
  738. local sub_type_red = false
  739. self.zero_gift_first_open_red_list[act_list.sub_type] = false
  740. if act_list.is_first_open == 1 and not self.zero_gift_first_open_red_flag[act_list.sub_type] then
  741. self.zero_gift_first_open_red_list[act_list.sub_type] = true
  742. sub_type_red = true
  743. show = true
  744. end
  745. local zero_data = self:GetZeroGiftInfo(act_list.sub_type)
  746. local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
  747. if zero_data and award_data then
  748. for kk,vv in ipairs(zero_data.reward_list) do
  749. if vv.status == 4 then--可领取
  750. sub_type_red = true
  751. show = true
  752. break
  753. end
  754. if vv.status == 0 then--可以免费领
  755. local cost_num = nil
  756. local buy_level = 1
  757. local conditon = {}
  758. for award_k,award_v in pairs(award_data.reward_list) do
  759. if award_v.grade == vv.grade then
  760. conditon = award_v.condition_list
  761. end
  762. end
  763. for m,n in ipairs(conditon) do
  764. if n[1] == "cost" then
  765. cost_num = tonumber(n[2][1][3])
  766. elseif n[1] == "buy_lv" then
  767. buy_level = tonumber(n[2]) or 1
  768. end
  769. end
  770. if cost_num and cost_num == 0 and my_level>=buy_level then
  771. sub_type_red = true
  772. show = true
  773. break
  774. end
  775. end
  776. end
  777. end
  778. self.act_red_dot_info[base_type][act_list.sub_type] = sub_type_red
  779. return show,act_type
  780. end
  781. function KfActivityModel:CheckZeroGiftTabIsOpen(sub_type)
  782. local bool = false
  783. local zero_data = self:GetZeroGiftInfo(sub_type)
  784. if zero_data then
  785. for i,v in ipairs(zero_data.reward_list) do
  786. if v.status == 0 or v.status == 1 or v.status == 4 then
  787. bool = true
  788. end
  789. end
  790. end
  791. return bool
  792. end
  793. --检查boss掉落红点
  794. function KfActivityModel:CheckBossDropRedDot( sub_type )
  795. local base_type = CustomActivityModel.CustomActBaseType.BOSS_DROP
  796. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  797. local show = false
  798. local act_type = CustomActivityModel.CustomIconActType.KfAct
  799. if act_list then
  800. act_type = act_list.act_type
  801. end
  802. return show,act_type
  803. end
  804. --检查副本多倍掉落红点
  805. function KfActivityModel:CheckDunMulRedDot( sub_type )
  806. local base_type = CustomActivityModel.CustomActBaseType.DUN_MUL_DROP
  807. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  808. local show = false
  809. local act_type = CustomActivityModel.CustomIconActType.KfAct
  810. if act_list then
  811. act_type = act_list.act_type
  812. end
  813. return show,act_type
  814. end
  815. --幻魔宝典红点
  816. function KfActivityModel:CheckActBossTreasureRedDot( sub_type )
  817. local base_type = CustomActivityModel.CustomActBaseType.BOSS_TREASURE
  818. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  819. local act_type = CustomActivityModel.CustomIconActType.KfAct
  820. local bool = false
  821. if not self.act_red_dot_info[base_type] then
  822. self.act_red_dot_info[base_type] = {}
  823. end
  824. self.act_red_dot_info[base_type][sub_type] = false
  825. if act_list then
  826. act_type = act_list.act_type
  827. bool = KfBossTreasureModel:getInstance():GetAllRedBySubType( false,sub_type )
  828. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  829. end
  830. return bool,act_type
  831. end
  832. --惊喜红包红点
  833. function KfActivityModel:CheckActHappyRedBagRedDot( sub_type )
  834. local base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG
  835. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  836. local act_type = CustomActivityModel.CustomIconActType.KfAct
  837. local bool = false
  838. if not self.act_red_dot_info[base_type] then
  839. self.act_red_dot_info[base_type] = {}
  840. end
  841. self.act_red_dot_info[base_type][sub_type] = false
  842. if act_list then
  843. act_type = act_list.act_type
  844. end
  845. if act_list then
  846. act_type = act_list.act_type
  847. local server_time = TimeUtil:getServerTime( )
  848. if server_time > act_list.stime and act_list.etime > server_time then
  849. local red_data = self:GetHappyRedBagRedDotBySubType(sub_type)
  850. bool = red_data.box or red_data.red_bag
  851. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  852. end
  853. end
  854. return bool,act_type
  855. end
  856. --塔罗牌红点
  857. function KfActivityModel:CheckActTarotRedDot( base_type, sub_type )
  858. if not sub_type then return false end
  859. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  860. local show = false
  861. local act_type = CustomActivityModel.CustomIconActType.KfAct
  862. if not self.act_red_dot_info[base_type] then
  863. self.act_red_dot_info[base_type] = {}
  864. end
  865. self.act_red_dot_info[base_type][sub_type] = false
  866. if act_list then
  867. act_type = act_list.act_type
  868. local server_time = TimeUtil:getServerTime( )
  869. if server_time > act_list.stime and act_list.etime > server_time then
  870. local b = OperateActivityModel:getInstance():TarotGetRedDot(sub_type)
  871. if b then
  872. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  873. show = true
  874. end
  875. if not self.is_red_tarot_list[sub_type] then
  876. self.is_red_tarot_list[sub_type] = true
  877. OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33255, sub_type)
  878. end
  879. end
  880. end
  881. return show,act_type
  882. end
  883. --检查竞榜红点
  884. function KfActivityModel:CheckCompetingRedDot( base_type )
  885. local red_bool = false
  886. local red_list = CompetingListModel:getInstance():GetComtingRedList()
  887. if red_list and TableSize(red_list) > 0 then
  888. red_bool = red_list[base_type] or false
  889. end
  890. local act_type = CustomActivityModel.CustomIconActType.KfAct--默认放在开服活动图标里面
  891. local competing_cfg = CompetingListModel:getInstance():GetCompetingCfg(base_type)
  892. if competing_cfg then
  893. for k,v in pairs(competing_cfg.condition) do
  894. if v[1] == "icon" then
  895. act_type = tonumber(v[2])
  896. break
  897. end
  898. end
  899. end
  900. return red_bool,act_type
  901. end
  902. --检查大富翁红点
  903. function KfActivityModel:CheckMonopolyRedDot( sub_type )
  904. local base_type = CustomActivityModel.CustomActBaseType.MONOPOLY
  905. local show = false
  906. local server_time = TimeUtil:getServerTime()
  907. local my_level = RoleManager.Instance.mainRoleInfo.level
  908. local act_type = CustomActivityModel.CustomIconActType.KfAct
  909. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  910. if not act_list then return show,act_type end
  911. act_list = DeepCopy(act_list)
  912. act_type = act_list.act_type
  913. if not self.act_red_dot_info[base_type] then
  914. self.act_red_dot_info[base_type] = {}--红点信息
  915. end
  916. local open_level = Config.Modulesub["331@72"].open_lv or 1
  917. for l,w in pairs(act_list.condition_list) do
  918. if type(w) == "table" and w[1] == "role_lv" then
  919. open_level = tonumber(w[2])
  920. end
  921. end
  922. if server_time > act_list.stime and act_list.etime > server_time then
  923. if my_level >= open_level then
  924. self.act_red_dot_info[base_type][act_list.sub_type] = false or not self.monopoly_first_open_red_flag[act_list.sub_type]
  925. if not self.act_red_dot_info[base_type][act_list.sub_type] then
  926. local server_info = self:GetMonopolyInfo(act_list.sub_type)
  927. if server_info and server_info.normal_count then
  928. local is_over = (server_info.cur_index == 26 and server_info.round == KfActivityModel.MonopolyMaxCircle)
  929. --红点
  930. show = (server_info.normal_count + server_info.gold_count > 0) and not is_over
  931. if not show then
  932. for k,v in pairs(server_info.circle_rewards) do
  933. if act_list.circle <= 5 and act_list.status == 1 then
  934. show = true
  935. elseif act_list.circle > 5 and act_list.status == 1 then
  936. show = true
  937. end
  938. end
  939. end
  940. end
  941. self.act_red_dot_info[base_type][act_list.sub_type] = show
  942. end
  943. end
  944. end
  945. return show,act_type
  946. end
  947. --检查开服团购红点
  948. function KfActivityModel:CheckKfGroupBuyingRedDot( sub_type )
  949. local show = false
  950. local base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING
  951. local act_info_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
  952. local act_type = CustomActivityModel.CustomIconActType.KfAct
  953. if act_info_list and sub_type then--传进来只需要刷一次
  954. for i,v in pairs(act_info_list) do
  955. if v.sub_type == sub_type then
  956. act_type = v.act_type
  957. self:CheckKfGroupBuyingSubTypeRedDot(v.sub_type)
  958. local is_mobilization_act = false
  959. for ii,vv in ipairs(v.condition_list) do
  960. if vv[1] == "custom_act" and tonumber(vv[2]) == 71 then
  961. is_mobilization_act = true
  962. MobilizationModel:getInstance():CheckGroupBuyingRed(tonumber(vv[3]))--这边要计算全民动员那边团购的红点
  963. break
  964. end
  965. end
  966. end
  967. end
  968. end
  969. if self.act_red_dot_info[base_type] and TableSize(self.act_red_dot_info[base_type]) > 0 then
  970. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  971. if act_list then
  972. local is_mobilization_act = false
  973. for ii,vv in ipairs(act_list.condition_list) do
  974. if vv[1] == "custom_act" and tonumber(vv[2]) == 71 then
  975. is_mobilization_act = true
  976. end
  977. end
  978. if not is_mobilization_act then
  979. if self.act_red_dot_info[base_type][sub_type] then
  980. show = v
  981. end
  982. end
  983. end
  984. end
  985. return show,act_type
  986. end
  987. --检查限购礼包红点
  988. function KfActivityModel:CheckLimitGiftRedDot( sub_type )
  989. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
  990. local show = false
  991. local base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT
  992. local server_time = TimeUtil:getServerTime()
  993. local my_level = RoleManager.Instance.mainRoleInfo.level
  994. local act_type = CustomActivityModel.CustomIconActType.KfAct
  995. all_list = DeepCopy(all_list)
  996. if not all_list then return show,act_type end
  997. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  998. act_list = DeepCopy(act_list)
  999. if not act_list then return show,act_type end
  1000. act_type = act_list.act_type
  1001. if not self.act_red_dot_info[base_type] then
  1002. self.act_red_dot_info[base_type] = {}
  1003. end
  1004. local open_level = Config.Modulesub["331@3"].open_lv or 1
  1005. for l,w in pairs(act_list.condition_list) do
  1006. if type(w) == "table" and w[1] == "role_lv" then
  1007. open_level = tonumber(w[2])
  1008. end
  1009. end
  1010. -- self.act_red_dot_info[base_type][act_list.sub_type] = false
  1011. if server_time > act_list.stime and act_list.etime > server_time then
  1012. if my_level >= open_level and GetModuleIsOpen(331,CustomActivityModel.CustomActBaseType.LIMIT_GIFT) then
  1013. self.act_red_dot_info[base_type][act_list.sub_type] = act_list.is_first_open == 1 or LimitGiftModel:getInstance().login_red[act_list.sub_type]
  1014. if not self.act_red_dot_info[base_type][act_list.sub_type] then
  1015. local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
  1016. if award_data then
  1017. local is_buy_over = true
  1018. for n,l in pairs(award_data.reward_list) do
  1019. if l.status ~= 2 then
  1020. is_buy_over = false
  1021. break
  1022. end
  1023. end
  1024. if is_buy_over then--买完了就不要作妖了
  1025. self.act_red_dot_info[base_type][act_list.sub_type] = false
  1026. return false
  1027. end
  1028. for ii,vv in pairs(award_data.reward_list) do
  1029. local conditon = vv.condition_list
  1030. if conditon and not self.act_red_dot_info[base_type][act_list.sub_type] then
  1031. local cur_price = nil
  1032. local recharge_gold = nil
  1033. for iii,vvv in ipairs(conditon) do
  1034. if vvv[1] == "limit_cost" then
  1035. cur_price = tonumber(vvv[2])
  1036. elseif vvv[1] == "recharge_gold" then
  1037. recharge_gold = tonumber(vvv[2])
  1038. end
  1039. end
  1040. self.act_red_dot_info[base_type][act_list.sub_type] = vv.status == 1 and (cur_price == 0 or recharge_gold ~= nil)
  1041. end
  1042. end
  1043. end
  1044. end
  1045. end
  1046. end
  1047. if LimitGiftModel:getInstance().login_red[act_list.sub_type] == nil then
  1048. for k,v in pairs(all_list) do
  1049. local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
  1050. if award_data and award_data.reward_list then
  1051. for ii,vv in pairs(award_data.reward_list) do
  1052. if LimitGiftModel:getInstance().login_red[act_list.sub_type] == nil then
  1053. LimitGiftModel:getInstance().login_red[act_list.sub_type] = vv.status ~= 2
  1054. show = vv.status ~= 2
  1055. if show then
  1056. self.act_red_dot_info[base_type][act_list.sub_type] = true
  1057. end
  1058. elseif LimitGiftModel:getInstance().login_red[act_list.sub_type] then
  1059. break
  1060. end
  1061. end
  1062. end
  1063. end
  1064. end
  1065. show = show or LimitGiftModel:getInstance().login_red[act_list.sub_type] or self.act_red_dot_info[base_type] and self.act_red_dot_info[base_type][sub_type] or false
  1066. return show,act_type
  1067. end
  1068. --检查限购礼包是否卖完
  1069. function KfActivityModel:CheckLimitGiftCanBuy( sub_type )
  1070. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
  1071. local show = false
  1072. local base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT
  1073. local server_time = TimeUtil:getServerTime()
  1074. local my_level = RoleManager.Instance.mainRoleInfo.level
  1075. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1076. all_list = DeepCopy(all_list)
  1077. if not all_list then return show,act_type end
  1078. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1079. act_list = DeepCopy(act_list)
  1080. if not act_list then return show,act_type end
  1081. act_type = act_list.act_type
  1082. local open_level = Config.Modulesub["331@3"].open_lv or 1
  1083. for l,w in pairs(act_list.condition_list) do
  1084. if type(w) == "table" and w[1] == "role_lv" then
  1085. open_level = tonumber(w[2])
  1086. end
  1087. end
  1088. if server_time > act_list.stime and act_list.etime > server_time then
  1089. if my_level >= open_level and GetModuleIsOpen(331,CustomActivityModel.CustomActBaseType.LIMIT_GIFT) then
  1090. local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
  1091. if award_data then
  1092. local is_buy_over = true
  1093. local cur_vip = RoleManager.Instance.mainRoleInfo.vip_flag
  1094. for n,l in pairs(award_data.reward_list) do
  1095. local can_buy = true
  1096. for i,v in pairs(l.condition_list) do
  1097. if type(v) == "table" and v[1] == "vip" and tonumber(v[2]) > cur_vip then
  1098. can_buy = false
  1099. break
  1100. end
  1101. end
  1102. if l.status ~= 2 and can_buy then
  1103. is_buy_over = false
  1104. break
  1105. end
  1106. end
  1107. if not is_buy_over then -- 没卖完
  1108. return true
  1109. end
  1110. end
  1111. end
  1112. end
  1113. return false
  1114. end
  1115. --检查限购礼包所有红点
  1116. function KfActivityModel:CheckLimitGiftAllRedDot( )
  1117. local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
  1118. for i,v in pairs(all_act_list) do
  1119. self:IsNeedRed(KfActivityModel.TabID.LimitGift,nil,v.sub_type)
  1120. end
  1121. end
  1122. --检查冲榜红点
  1123. function KfActivityModel:CheckRushRankRedDot( sub_type )
  1124. -- if not GetModuleIsOpen(331,10) then return false end
  1125. local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
  1126. local base_type = CustomActivityModel.CustomActBaseType.RUSH_RANK
  1127. local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  1128. local server_time = TimeUtil:getServerTime( )
  1129. local show = false
  1130. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1131. if not self.act_red_dot_info[base_type] then
  1132. self.act_red_dot_info[base_type] = {}
  1133. end
  1134. self.act_red_dot_info[base_type][sub_type] = false
  1135. local all_act = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.RUSH_RANK,sub_type)
  1136. if all_act then
  1137. act_type = all_act.act_type
  1138. if server_time > all_act.stime and all_act.etime >= server_time then
  1139. local rank_type_list = self:GetTodayRankType()
  1140. for k,rank_type in pairs(rank_type_list) do
  1141. local target_reward_list = self:GetTargetRewardList(rank_type)
  1142. if target_reward_list then
  1143. for k,v in pairs(target_reward_list) do
  1144. if v.state == 1 then
  1145. show = true
  1146. break
  1147. end
  1148. end
  1149. end
  1150. if show then
  1151. break
  1152. end
  1153. end
  1154. self.act_red_dot_info[base_type][sub_type] = show
  1155. end
  1156. end
  1157. if self.act_red_dot_info[base_type] then
  1158. for i,v in ipairs(self.act_red_dot_info[base_type]) do
  1159. if v then
  1160. return v,act_type
  1161. end
  1162. end
  1163. end
  1164. return false,act_type
  1165. end
  1166. --活动通用奖励红点33105
  1167. function KfActivityModel:CheckContinueRechargeRedDot(base_type,sub_type)
  1168. if not sub_type then return false end
  1169. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1170. local show = false
  1171. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1172. if not self.act_red_dot_info[base_type] then
  1173. self.act_red_dot_info[base_type] = {}
  1174. end
  1175. self.act_red_dot_info[base_type][sub_type] = false
  1176. if act_list then
  1177. act_type = act_list.act_type
  1178. local server_time = TimeUtil:getServerTime( )
  1179. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1180. if server_time > act_list.stime and act_list.etime > server_time then
  1181. if info and info.reward_list then
  1182. for k,n in pairs(info.reward_list) do
  1183. if n.status == 1 then
  1184. show = true
  1185. end
  1186. end
  1187. end
  1188. end
  1189. if not show then
  1190. local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(act_list.base_type,act_list.sub_type)
  1191. if com_act_red_info then
  1192. show = com_act_red_info.status == 1
  1193. end
  1194. end
  1195. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = show
  1196. end
  1197. return show,act_type
  1198. end
  1199. --活动通用奖励红点33105
  1200. function KfActivityModel:CheckActCommonRedDot(base_type,sub_type)
  1201. -- if not GetModuleIsOpen(331,base_type) or not sub_type then return false end
  1202. if not sub_type then return false end
  1203. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1204. local show = false
  1205. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1206. if not self.act_red_dot_info[base_type] then
  1207. self.act_red_dot_info[base_type] = {}
  1208. end
  1209. self.act_red_dot_info[base_type][sub_type] = false
  1210. if act_list then
  1211. act_type = act_list.act_type
  1212. local server_time = TimeUtil:getServerTime( )
  1213. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1214. if server_time > act_list.stime and act_list.etime > server_time then
  1215. if info and info.reward_list then
  1216. for k,n in pairs(info.reward_list) do
  1217. if n.status == 1 then
  1218. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1219. show = true
  1220. end
  1221. end
  1222. end
  1223. end
  1224. -- if not show and base_type == CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE then--连充有额外处理
  1225. -- local resign_info = self:GetKfContinueInfo(act_list.sub_type)
  1226. -- if resign_info then
  1227. -- local award_day = math.ceil((act_list.etime - act_list.stime)/60/60/24)--当前活动剩余多少天
  1228. -- local real_day = math.ceil((TimeUtil:getServerTime( ) - act_list.stime)/60/60/24)--当前第几天
  1229. -- local day_award_list = {}
  1230. -- for k,v in pairs(info.reward_list) do
  1231. -- for ii,vv in ipairs(v.condition_list) do
  1232. -- if vv[1] == "recharge_gold" and award_day >= v.grade then--天数奖励展示
  1233. -- local data = v
  1234. -- data.day = v.grade
  1235. -- day_award_list[#day_award_list + 1] = data
  1236. -- end
  1237. -- end
  1238. -- end
  1239. -- local sort_func = function ( a, b )
  1240. -- return a.day < b.day
  1241. -- end
  1242. -- if #day_award_list > 1 then
  1243. -- table.sort(day_award_list, sort_func)
  1244. -- end
  1245. -- for i,v in ipairs(day_award_list) do
  1246. -- if real_day > i and resign_info.can_resign_time > 0 and v.status == 0 then
  1247. -- show = true
  1248. -- self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1249. -- break
  1250. -- end
  1251. -- end
  1252. -- end
  1253. -- end
  1254. end
  1255. return show,act_type
  1256. end
  1257. function KfActivityModel:CheckFosterStageRedDot( base_type,sub_type )
  1258. if not sub_type then return false end
  1259. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1260. local show = false
  1261. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1262. if not self.act_red_dot_info[base_type] then
  1263. self.act_red_dot_info[base_type] = {}
  1264. end
  1265. self.act_red_dot_info[base_type][sub_type] = false
  1266. if act_list then
  1267. act_type = act_list.act_type
  1268. local server_time = TimeUtil:getServerTime( )
  1269. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1270. if server_time > act_list.stime and act_list.etime > server_time then
  1271. local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
  1272. local first_red_list = self:GetFosterStageCookie() or {}
  1273. -- if openDay <= 8 and not self.forsert_stage_red_info[act_list.sub_type] then--前八天每次登陆红点
  1274. -- show = true
  1275. -- elseif openDay > 8 and
  1276. if not first_red_list[act_list.sub_type] then
  1277. show = true
  1278. else
  1279. if info and info.reward_list then
  1280. for k,n in pairs(info.reward_list) do
  1281. if n.status == 1 then
  1282. show = true
  1283. end
  1284. end
  1285. end
  1286. end
  1287. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = show
  1288. end
  1289. end
  1290. return show,act_type
  1291. end
  1292. --设置开服进阶红点cookie
  1293. function KfActivityModel:SetFosterStageCookie( sub_type )
  1294. local list = self:GetFosterStageCookie() or {}
  1295. list[sub_type] = true
  1296. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_DAY2,CookieKey.KF_FORSTER_STAGE_ACT_RED,list)
  1297. CookieWrapper.Instance:WriteAll()
  1298. end
  1299. --获得开服进阶红点cookie
  1300. function KfActivityModel:GetFosterStageCookie( )
  1301. local bool = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.KF_FORSTER_STAGE_ACT_RED) or {}
  1302. return bool
  1303. end
  1304. --检查限购商城的红点
  1305. function KfActivityModel:CheckLimitShopRedDot( sub_type )
  1306. local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
  1307. local show = false
  1308. local level = RoleManager.Instance.mainRoleInfo.level
  1309. local server_time = TimeUtil:getServerTime( )
  1310. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1311. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1312. if act_list then
  1313. act_list = DeepCopy(act_list)
  1314. act_type = act_list.act_type
  1315. local info = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type, act_list.sub_type)
  1316. if not self.act_red_dot_info[act_list.base_type] then
  1317. self.act_red_dot_info[act_list.base_type] = {}
  1318. end
  1319. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = false
  1320. if server_time > act_list.stime and act_list.etime > server_time then
  1321. if info and info.reward_list then
  1322. for k,n in pairs(info.reward_list) do
  1323. local gold_type = 0
  1324. local limit_cost = 0
  1325. local show_level_range = {0,999999}
  1326. local limit_times = 0
  1327. local limit_vip = 0
  1328. for i,v in ipairs(n.condition_list) do
  1329. if v[1] == "gold_type" then
  1330. gold_type = tonumber(v[2])
  1331. elseif v[1] == "limit_cost" then
  1332. limit_cost = tonumber(v[2])
  1333. elseif v[1] == "limit_times" then
  1334. limit_times = tonumber(v[2])
  1335. elseif v[1] == "show_level_range" then
  1336. show_level_range = {tonumber(v[2]),tonumber(v[3])}
  1337. elseif v[1] == "limit_vip" then
  1338. limit_vip = tonumber(v[2])
  1339. end
  1340. end
  1341. --先满足等级和次数
  1342. if info.status ~= 2 and level >= tonumber(show_level_range[1]) and level <= tonumber(show_level_range[2]) and limit_times - n.progress > 0 and (RoleManager.Instance.mainRoleInfo.vip_flag >= limit_vip and not VipModel:getInstance():IsVipExperience()) then
  1343. if gold_type == 2 and limit_cost <= RoleManager.Instance.mainRoleInfo.jinLock then--红钻数量满足
  1344. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1345. show = true
  1346. elseif gold_type == 1 and limit_cost == 0 then--免费
  1347. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1348. show = true
  1349. elseif gold_type == 2 and limit_cost == 0 then--免费
  1350. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1351. show = true
  1352. end
  1353. end
  1354. end
  1355. end
  1356. end
  1357. end
  1358. return show,act_type
  1359. end
  1360. --检查限购商城是否卖完
  1361. function KfActivityModel:CheckLimitShopCanBuy( sub_type )
  1362. local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
  1363. local show = false
  1364. local level = RoleManager.Instance.mainRoleInfo.level
  1365. local server_time = TimeUtil:getServerTime( )
  1366. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1367. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1368. if act_list then
  1369. act_list = DeepCopy(act_list)
  1370. act_type = act_list.act_type
  1371. local info = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type, act_list.sub_type)
  1372. if server_time > act_list.stime and act_list.etime > server_time then
  1373. if info and info.reward_list then
  1374. for k,n in pairs(info.reward_list) do
  1375. local gold_type = 0
  1376. local limit_cost = 0
  1377. local show_level_range = {0,999999}
  1378. local limit_times = 0
  1379. for i,v in ipairs(n.condition_list) do
  1380. if v[1] == "gold_type" then
  1381. gold_type = tonumber(v[2])
  1382. elseif v[1] == "limit_cost" then
  1383. limit_cost = tonumber(v[2])
  1384. elseif v[1] == "limit_times" then
  1385. limit_times = tonumber(v[2])
  1386. elseif v[1] == "show_level_range" then
  1387. show_level_range = {tonumber(v[2]),tonumber(v[3])}
  1388. end
  1389. end
  1390. --先满足等级和次数
  1391. if info.status ~= 2 and level >= tonumber(show_level_range[1]) and level <= tonumber(show_level_range[2]) and limit_times - n.progress > 0 then
  1392. return true -- 有满足条件可以买的
  1393. end
  1394. end
  1395. end
  1396. end
  1397. end
  1398. return show,act_type
  1399. end
  1400. --检查刮刮卡城的红点
  1401. function KfActivityModel:CheckScrapingCardRedDot(base_type, sub_type )
  1402. if not sub_type then return false end
  1403. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1404. local show = false
  1405. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1406. if not self.act_red_dot_info[base_type] then
  1407. self.act_red_dot_info[base_type] = {}
  1408. end
  1409. self.act_red_dot_info[base_type][sub_type] = false
  1410. if act_list then
  1411. act_type = act_list.act_type
  1412. local server_time = TimeUtil:getServerTime( )
  1413. if server_time > act_list.stime and act_list.etime > server_time then
  1414. local b = OperateActivityModel:getInstance():ScrapingCradGetRedDot(sub_type)
  1415. if b then
  1416. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1417. show = true
  1418. end
  1419. if not self.is_red_scraping_card_list[sub_type] then
  1420. self.is_red_scraping_card_list[sub_type] = true
  1421. OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33244, sub_type)
  1422. OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33246, sub_type)
  1423. end
  1424. end
  1425. end
  1426. return show,act_type
  1427. end
  1428. --检查人参果树的红点
  1429. function KfActivityModel:CheckPrayTreeRedDot(base_type, sub_type )
  1430. if not sub_type then return false end
  1431. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1432. local show = false
  1433. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1434. if not self.act_red_dot_info[base_type] then
  1435. self.act_red_dot_info[base_type] = {}
  1436. end
  1437. self.act_red_dot_info[base_type][sub_type] = false
  1438. if act_list then
  1439. act_type = act_list.act_type
  1440. local server_time = TimeUtil:getServerTime( )
  1441. if server_time > act_list.stime and act_list.etime > server_time then
  1442. local b = OperateActivityModel:getInstance():PrayTreeGetRedDot()
  1443. if b then
  1444. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1445. show = true
  1446. end
  1447. if not self.is_red_praytreelist[sub_type] then
  1448. self.is_red_praytreelist[sub_type] = true
  1449. OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33280, sub_type)
  1450. end
  1451. end
  1452. end
  1453. return show,act_type
  1454. end
  1455. --检查集字红点
  1456. function KfActivityModel:CheckCollectActRedDot( base_type,sub_type )
  1457. if not sub_type then return false end
  1458. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1459. local show = false
  1460. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1461. if not self.act_red_dot_info[base_type] then
  1462. self.act_red_dot_info[base_type] = {}
  1463. end
  1464. self.act_red_dot_info[base_type][sub_type] = false
  1465. local cookies_list = OperateActivityModel:getInstance():GetJiZiRedDotTipCookie()
  1466. local sub_cookies_list = cookies_list[sub_type]
  1467. if act_list then
  1468. act_type = act_list.act_type
  1469. local server_time = TimeUtil:getServerTime( )
  1470. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1471. if server_time > act_list.stime and act_list.etime > server_time then
  1472. if info and info.reward_list then
  1473. for k,n in pairs(info.reward_list) do
  1474. local exchange_limit = 0
  1475. local goods_exchange_list = {}
  1476. for kk,vv in pairs(n.condition_list) do
  1477. if vv[1] == "exchange_limit" then--兑换限制
  1478. exchange_limit = tonumber(vv[2])
  1479. elseif vv[1] == "goods_exchange" then--兑换列表
  1480. goods_exchange_list = vv[2]
  1481. end
  1482. end
  1483. local red_bool = GoodsModel:getInstance():GetEnough(goods_exchange_list)
  1484. red_bool = red_bool and n.receive_times < exchange_limit
  1485. if red_bool and not (sub_cookies_list and sub_cookies_list[n.grade]) then
  1486. show = true
  1487. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1488. break
  1489. end
  1490. end
  1491. end
  1492. end
  1493. end
  1494. return show,act_type
  1495. end
  1496. --阶段兑换红点
  1497. function KfActivityModel:CheckStageExchangeRedDot( base_type,sub_type )
  1498. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1499. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1500. local bool = false
  1501. if not self.act_red_dot_info[base_type] then
  1502. self.act_red_dot_info[base_type] = {}
  1503. end
  1504. self.act_red_dot_info[base_type][sub_type] = false
  1505. local server_time = TimeUtil:getServerTime( )
  1506. if act_list and server_time > act_list.stime and act_list.etime > server_time then
  1507. act_type = act_list.act_type
  1508. bool = self:GetStageExchangeRedDotBySubType(sub_type)
  1509. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  1510. end
  1511. return bool,act_type
  1512. end
  1513. --冒险征途红点
  1514. function KfActivityModel:CheckAdventureRedDot(base_type,sub_type)
  1515. if not sub_type then return false end
  1516. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1517. local show = false
  1518. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1519. if not self.act_red_dot_info[base_type] then
  1520. self.act_red_dot_info[base_type] = {}
  1521. end
  1522. self.act_red_dot_info[base_type][sub_type] = false
  1523. if act_list then
  1524. act_type = act_list.act_type
  1525. local server_time = TimeUtil:getServerTime( )
  1526. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1527. if server_time > act_list.stime and act_list.etime > server_time then
  1528. -------------------------
  1529. --可以抽奖励
  1530. local adventure_data = OperateActivityModel:getInstance():GetAdventureNumInfo(sub_type)
  1531. if adventure_data then
  1532. if adventure_data.score >= KfActivityModel.AdventureOneCost then
  1533. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1534. show = true
  1535. end
  1536. end
  1537. -------------------------
  1538. --有奖励可领取
  1539. if (not show) and info and info.reward_list then
  1540. for k,n in pairs(info.reward_list) do
  1541. if n.status == 1 then
  1542. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  1543. show = true
  1544. end
  1545. end
  1546. end
  1547. end
  1548. end
  1549. return show,act_type
  1550. end
  1551. --黑白棋红点
  1552. function KfActivityModel:CheckReversiRedDot( base_type,sub_type )
  1553. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1554. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1555. if not act_list then return false,act_type end
  1556. local bool = false
  1557. if not self.act_red_dot_info[base_type] then
  1558. self.act_red_dot_info[base_type] = {}
  1559. end
  1560. self.act_red_dot_info[base_type][sub_type] = false
  1561. -------------------------
  1562. local open_level = Config.Modulesub["331@115"] and Config.Modulesub["331@115"].open_lv or 1
  1563. for l,w in pairs(act_list.condition_list) do
  1564. if type(w) == "table" and w[1] == "role_lv" then
  1565. open_level = tonumber(w[2])
  1566. end
  1567. end
  1568. if RoleManager.Instance.mainRoleInfo.level >= open_level then
  1569. local server_time = TimeUtil:getServerTime( )
  1570. if act_list and server_time > act_list.stime and act_list.etime > server_time then
  1571. act_type = act_list.act_type
  1572. bool = self:GetReversiRedDotBySubType(sub_type)
  1573. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  1574. end
  1575. else
  1576. self.check_lv_act_open = self.check_lv_act_open or {}
  1577. self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
  1578. self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
  1579. self.check_lv_act_open[open_level][base_type][sub_type] = true
  1580. end
  1581. return bool,act_type
  1582. end
  1583. --节日幻魔红点
  1584. function KfActivityModel:CheckFestivalBossRedDot( base_type,sub_type )
  1585. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1586. local act_type = CustomActivityModel.CustomIconActType.KfAct
  1587. if not act_list then return false,act_type end
  1588. local bool = false
  1589. if not self.act_red_dot_info[base_type] then
  1590. self.act_red_dot_info[base_type] = {}
  1591. end
  1592. self.act_red_dot_info[base_type][sub_type] = false
  1593. -------------------------
  1594. local open_level = Config.Modulesub["331@117"] and Config.Modulesub["331@117"].open_lv or 1
  1595. for l,w in pairs(act_list.condition_list) do
  1596. if type(w) == "table" and w[1] == "role_lv" then
  1597. open_level = tonumber(w[2])
  1598. end
  1599. end
  1600. if RoleManager.Instance.mainRoleInfo.level >= open_level then
  1601. local server_time = TimeUtil:getServerTime( )
  1602. if act_list and server_time > act_list.stime and act_list.etime > server_time then
  1603. act_type = act_list.act_type
  1604. bool = self:GetFestivalBossRedDotBySubType(sub_type)
  1605. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  1606. end
  1607. else
  1608. self.check_lv_act_open = self.check_lv_act_open or {}
  1609. self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
  1610. self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
  1611. self.check_lv_act_open[open_level][base_type][sub_type] = true
  1612. end
  1613. return bool,act_type
  1614. end
  1615. -- 检查活跃拼图红点
  1616. function KfActivityModel:CheckJigsawRedDot(base_type, sub_type)
  1617. if not sub_type then return false end
  1618. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1619. local reward_cfg = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  1620. local bool = false
  1621. local act_type = CustomActivityModel.CustomIconActType.OpAct
  1622. if not self.act_red_dot_info[base_type] then
  1623. self.act_red_dot_info[base_type] = {}
  1624. end
  1625. self.act_red_dot_info[base_type][sub_type] = false
  1626. if act_list and reward_cfg then
  1627. act_type = act_list.act_type
  1628. local server_time = TimeUtil:getServerTime( )
  1629. if server_time > act_list.stime and act_list.etime > server_time then
  1630. bool = OperateActivityModel:getInstance():GetJigsawRed(sub_type, reward_cfg)
  1631. self.act_red_dot_info[base_type][sub_type] = bool
  1632. end
  1633. end
  1634. return bool, act_type
  1635. end
  1636. -- 检查合成机红点
  1637. function KfActivityModel:CheckActComposeRobotRedDot(base_type,sub_type)
  1638. if not sub_type then return false end
  1639. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1640. local act_type = act_list and act_list.act_type and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
  1641. local bool = false
  1642. if not self.act_red_dot_info[base_type] then
  1643. self.act_red_dot_info[base_type] = {}
  1644. end
  1645. self.act_red_dot_info[base_type][sub_type] = false
  1646. bool = OperateActivityModel:getInstance():GetComposeRobotMainRed(sub_type)
  1647. self.act_red_dot_info[base_type][sub_type] = bool
  1648. return bool, act_type
  1649. end
  1650. --检查自选扭蛋红点
  1651. function KfActivityModel:CheckActSelectEggRedDot(base_type,sub_type)
  1652. if not sub_type then return false end
  1653. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1654. local act_type = act_list and act_list.act_type and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
  1655. local bool = false
  1656. if not self.act_red_dot_info[base_type] then
  1657. self.act_red_dot_info[base_type] = {}
  1658. end
  1659. self.act_red_dot_info[base_type][sub_type] = false
  1660. bool = OperateActivityModel:getInstance():GetSelectEggMainRed(sub_type)
  1661. self.act_red_dot_info[base_type][sub_type] = bool
  1662. return bool, act_type
  1663. end
  1664. --检查材料上交红点
  1665. function KfActivityModel:CheckActMaterialSubmitRedDot( base_type,sub_type )
  1666. if not sub_type then return false end
  1667. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1668. local act_type = act_list and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
  1669. local bool = false
  1670. if not self.act_red_dot_info[base_type] then
  1671. self.act_red_dot_info[base_type] = {}
  1672. end
  1673. self.act_red_dot_info[base_type][sub_type] = false
  1674. bool = OperateActivityModel:getInstance():CheckMaterialSubmitRedDot(base_type,sub_type)
  1675. self.act_red_dot_info[base_type][sub_type] = bool
  1676. return bool, act_type
  1677. end
  1678. --获得活动信息页签列表
  1679. function KfActivityModel:UpdateTab( act_type )
  1680. local menu_name_list = {}
  1681. local is_chace = {}
  1682. local my_level = RoleManager.Instance.mainRoleInfo.level
  1683. local open_level = 0
  1684. local server_time = TimeUtil:getServerTime( )
  1685. for k, v in ipairs(KfActivityModel.TabData) do
  1686. open_level = 0
  1687. if GetModuleIsOpen(v.module_id,v.base_type)
  1688. and v.base_type ~= CustomActivityModel.CustomActBaseType.COPETING --竞榜不在这个判断里面
  1689. then
  1690. if v.is_most then--是后台定制的活动就要进行数据选取
  1691. local sub_type_list = DeepCopy(CustomActivityModel:getInstance():getAllActListByBaseType(v.base_type))
  1692. for i,vv in pairs(sub_type_list) do
  1693. if act_type == vv.act_type and v.base_type == CustomActivityModel.CustomActBaseType.DUN_MUL_DROP then--副本多倍只有一个页签
  1694. vv.id = v.id
  1695. vv.sort_id = v.sort_id
  1696. table_insert(menu_name_list, vv)
  1697. break
  1698. else
  1699. if act_type == vv.act_type--活动类型首先要相等
  1700. and (server_time > vv.stime and vv.etime > server_time --满足活动开放时间
  1701. or v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT -- (0元礼包如果有未领的返还也要显示页签不能消失)
  1702. or v.base_type == CustomActivityModel.CustomActBaseType.INVEST_ACT -- (投资活动如果有未领的天数奖励,页签不能消失)
  1703. or v.base_type == CustomActivityModel.CustomActBaseType.COM_RANK--通用排行
  1704. )then
  1705. for l,w in pairs(vv.condition_list) do
  1706. if type(w) == "table" and w[1] == "role_lv" then
  1707. open_level = tonumber(w[2])
  1708. break
  1709. end
  1710. end
  1711. if not is_chace[v.base_type] then
  1712. is_chace[v.base_type] = {}
  1713. end
  1714. if not is_chace[v.base_type][vv.sub_type] and open_level <= my_level then
  1715. is_chace[v.base_type][vv.sub_type] = vv
  1716. vv.id = v.id
  1717. vv.sort_id = v.sort_id
  1718. if v.base_type == CustomActivityModel.CustomActBaseType.RUSH_RANK then --开服冲榜
  1719. local today_list = self:GetTodayRankType()
  1720. for n,l in ipairs(today_list) do
  1721. local rush_rank_cfg = self:GetRushRankCfg(l)
  1722. if rush_rank_cfg then
  1723. vv.name = rush_rank_cfg.name
  1724. vv.rank_type = l
  1725. table_insert(menu_name_list, DeepCopy(vv))
  1726. break
  1727. end
  1728. end
  1729. elseif v.base_type == CustomActivityModel.CustomActBaseType.LIMIT_GIFT then --限购礼包
  1730. local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,vv.sub_type)
  1731. if award_data then
  1732. for n,l in pairs(award_data.reward_list) do
  1733. if l.status ~= 2 then
  1734. table_insert(menu_name_list, DeepCopy(vv))
  1735. break
  1736. end
  1737. end
  1738. end
  1739. elseif v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT then --0元礼包
  1740. if self:CheckZeroGiftTabIsOpen(vv.sub_type) then
  1741. table_insert(menu_name_list, DeepCopy(vv))
  1742. end
  1743. elseif v.base_type == CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING then --开服团购不能是全民动员的嵌入式活动
  1744. local is_mobilization_act = false
  1745. for n,l in pairs(vv.condition_list) do
  1746. if l[1] == "custom_act" and tonumber(l[2]) == 71 then
  1747. is_mobilization_act = true
  1748. break
  1749. end
  1750. end
  1751. if not is_mobilization_act then
  1752. table_insert(menu_name_list, DeepCopy(vv))
  1753. end
  1754. -- elseif v.base_type == CustomActivityModel.CustomActBaseType.INVEST_ACT then -- 投资活动
  1755. -- if self:CheckInvestActTabIsOpen(vv.sub_type) then
  1756. -- table_insert(menu_name_list, DeepCopy(vv))
  1757. -- end
  1758. elseif v.base_type == CustomActivityModel.CustomActBaseType.COM_RANK then -- 通用排行
  1759. if self:CheckComRankTabIsOpen(vv.sub_type) then
  1760. table_insert(menu_name_list, DeepCopy(vv))
  1761. end
  1762. elseif v.base_type == CustomActivityModel.CustomActBaseType.SUPER_AWARD then -- 超能大奖
  1763. if self:CheckSuperAwardTabIsOpen(v.base_type,vv.sub_type) then
  1764. table_insert(menu_name_list, DeepCopy(vv))
  1765. end
  1766. else
  1767. table_insert(menu_name_list, vv)
  1768. end
  1769. end
  1770. end
  1771. end
  1772. end
  1773. else--直接插入 由前端决定是否开放的活动
  1774. v.sub_type = 1
  1775. table_insert(menu_name_list, v)
  1776. end
  1777. end
  1778. end
  1779. --这里判断是否有竞榜开放 然后插入进列表里面
  1780. local competing_open_list = CompetingListModel:getInstance():GetCompetingOpenActList(act_type)
  1781. if competing_open_list and #competing_open_list > 0 then
  1782. for k,v in pairs(competing_open_list) do
  1783. table_insert(menu_name_list, v)
  1784. end
  1785. end
  1786. self.menu_name_list = menu_name_list
  1787. return menu_name_list
  1788. end
  1789. --检查超能大奖是否开启
  1790. function KfActivityModel:CheckSuperAwardTabIsOpen( base_type,sub_type )
  1791. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  1792. if act_list then
  1793. local recharge_num = 0
  1794. local consume_num = 0
  1795. for k,v in pairs(act_list.condition_list) do
  1796. if v[1] == "recharge" then
  1797. recharge_num = tonumber(v[2])
  1798. elseif v[1] == "consume" then
  1799. consume_num = tonumber(v[2])
  1800. end
  1801. end
  1802. local cur_recharge_num = 0
  1803. local cur_consume_num = 0
  1804. local award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
  1805. local complete_num = 0
  1806. if award_data and award_data.reward_list then
  1807. for kk,vv in ipairs(award_data.reward_list) do
  1808. if #vv.condition_list == 1 then
  1809. for m,n in ipairs(vv.condition_list) do
  1810. if n[1] == "recharge" then
  1811. cur_recharge_num = vv.progress
  1812. break
  1813. elseif n[1] == "consume" then
  1814. cur_consume_num = vv.progress
  1815. break
  1816. end
  1817. end
  1818. end
  1819. complete_num = (vv.status == 2 and 1 or 0) + complete_num
  1820. end
  1821. if recharge_num <= cur_recharge_num and consume_num <= cur_consume_num then
  1822. local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
  1823. if TableSize(all_act_list) == 1 then--一个的时候直接开 2个只能开一个
  1824. return true
  1825. elseif TableSize(all_act_list) == 2 then
  1826. if recharge_num>0 and consume_num>0 then--判断上一个是否全部完成
  1827. for i,v in pairs(all_act_list) do
  1828. if v.sub_type ~= sub_type then
  1829. complete_num = 0
  1830. local sub_award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,v.sub_type)
  1831. if sub_award_data then
  1832. for kk,vv in ipairs(sub_award_data.reward_list) do
  1833. complete_num = (vv.status == 2 and 1 or 0) + complete_num
  1834. end
  1835. return complete_num >= #sub_award_data.reward_list
  1836. end
  1837. end
  1838. end
  1839. else
  1840. return complete_num < #award_data.reward_list
  1841. end
  1842. end
  1843. end
  1844. end
  1845. end
  1846. return false
  1847. end
  1848. function KfActivityModel:CheckActivityIdOpen( act_type,id )
  1849. if id then
  1850. local data = self:UpdateTab(act_type)
  1851. local item_data = nil
  1852. for k,v in pairs(data) do
  1853. if v.id == id then
  1854. item_data = v
  1855. break
  1856. end
  1857. end
  1858. if not item_data then
  1859. return false
  1860. end
  1861. end
  1862. return true
  1863. end
  1864. function KfActivityModel:GetTodayRankType()--获得当天的冲榜类型
  1865. local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
  1866. local rank_type_list = {}
  1867. for _, v in pairs(Config.Rushrank) do
  1868. if openDay >= tonumber(v.start_day) and openDay <= tonumber(v.clear_day) - 1 then
  1869. rank_type_list[#rank_type_list + 1] = tonumber(v.id)
  1870. end
  1871. end
  1872. if #rank_type_list >= 2 then
  1873. local sort_func = function ( a, b )
  1874. return a < b
  1875. end
  1876. table.sort(rank_type_list, sort_func)
  1877. end
  1878. return rank_type_list
  1879. end
  1880. function KfActivityModel:GetRankTypeOpenDay(rank_type)--获得当天的冲榜类型
  1881. for _, v in pairs(Config.Rushrank) do
  1882. if v.id == rank_type then
  1883. return v.start_day
  1884. end
  1885. end
  1886. return 1
  1887. end
  1888. --设置冲榜信息
  1889. function KfActivityModel:SetRushRankInfo(vo)
  1890. local new_rank_list = {}
  1891. for i,v in ipairs(vo.rank_list) do
  1892. new_rank_list[v.rank] = v
  1893. end
  1894. vo.rank_list = new_rank_list
  1895. if not self.rush_rank_info[vo.sub_type] then
  1896. self.rush_rank_info[vo.sub_type] = {}
  1897. end
  1898. self.rush_rank_info[vo.sub_type][vo.rank_type] = vo
  1899. local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
  1900. local op_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
  1901. for k, v in pairs(op_act_list) do
  1902. if v.act_type == CustomActivityModel.CustomIconActType.KfAct then--开服冲榜
  1903. self:CheckActIconBoolOpen(v.sub_type)
  1904. break
  1905. end
  1906. end
  1907. end
  1908. function KfActivityModel:GetRushRankInfo(sub_type,rank_type)
  1909. if self.rush_rank_info[sub_type] then
  1910. return self.rush_rank_info[sub_type][rank_type]
  1911. end
  1912. end
  1913. --设置目标奖励信息
  1914. function KfActivityModel:SetTargetRewardList(vo)
  1915. self.target_reward_list = {}
  1916. for i,v in ipairs(vo.goal_list) do
  1917. if not self.target_reward_list[v.rank_type] then
  1918. self.target_reward_list[v.rank_type] = {}
  1919. end
  1920. self.target_reward_list[v.rank_type][v.goal] = v
  1921. end
  1922. self:IsNeedRed(KfActivityModel.TabID.RushRank,nil,vo.sub_type)
  1923. end
  1924. function KfActivityModel:GetTargetRewardList( rank_type )
  1925. return self.target_reward_list[rank_type]
  1926. end
  1927. --获得冲榜配置
  1928. function KfActivityModel:GetRushRankCfg( rank_type )
  1929. return self.rush_rank_cfg[rank_type]
  1930. end
  1931. --获得冲榜总配置
  1932. function KfActivityModel:GetAllRushRankCfg( rank_type )
  1933. return self.rush_rank_cfg
  1934. end
  1935. --获得冲榜奖励配置
  1936. function KfActivityModel:GetRushRankAwardCfg( id )
  1937. return self.rush_rank_award_cfg[id]
  1938. end
  1939. function KfActivityModel:GetRushGoalAwardCfg( id )
  1940. return self.rush_rank_goal_cfg[id]
  1941. end
  1942. --获得排名配置
  1943. function KfActivityModel:GetRushRankListCfg( id )
  1944. local award_cfg =DeepCopy(self:GetRushRankAwardCfg(id))
  1945. local rank_list = {}
  1946. local rank_limit_list = {}
  1947. if award_cfg then
  1948. for i,v in ipairs(award_cfg) do
  1949. for k=v.rank_min,v.rank_max do
  1950. rank_list[k] = v.rank_limit
  1951. local str_list = Split(Trim(v.about),"@") or {"",""}
  1952. rank_limit_list[k] = str_list and str_list[2] or ""
  1953. end
  1954. end
  1955. end
  1956. return rank_list,rank_limit_list
  1957. end
  1958. --得到冲榜阶级说明
  1959. function KfActivityModel:GetRushRankLimitInfo(limit,index)
  1960. local limitStr, value1, value2 = "", nil, nil
  1961. index = index or 1
  1962. if TableSize(limit) > 0 then
  1963. local str = tostring(limit[index][1])
  1964. if Trim(str) == "lv" then
  1965. limitStr = "等级"
  1966. value1 = tonumber(limit[index][2])
  1967. elseif Trim(str) == "combat" then
  1968. limitStr = "战力"
  1969. value1 = tonumber(limit[index][2])
  1970. elseif Trim(str) == "gold" then
  1971. limitStr = "充值"
  1972. value1 = tonumber(limit[index][2])
  1973. elseif Trim(str) == "stone_lv" then
  1974. limitStr = "宝石"
  1975. value1 = tonumber(limit[index][2])
  1976. elseif Trim(str) == "horse_stage" then
  1977. limitStr = "坐骑"
  1978. value1 = tonumber(limit[index][2][1])
  1979. value2 = tonumber(limit[index][2][2])
  1980. elseif Trim(str) == "pet_stage" then
  1981. limitStr = "AI娘"
  1982. value1 = tonumber(limit[index][2][1])
  1983. value2 = tonumber(limit[index][2][2])
  1984. end
  1985. end
  1986. return Trim(str), limitStr, value1, value2
  1987. end
  1988. --累充充值总数
  1989. function KfActivityModel:SetRecharge(base_type, sub_type, number)
  1990. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  1991. if act_list then
  1992. self.seven_recharge_total = self.seven_recharge_total or {}
  1993. self.seven_recharge_total[sub_type] = number
  1994. if not self.recharge_total then
  1995. self.recharge_total = {}
  1996. end
  1997. if not self.recharge_total[base_type] then
  1998. self.recharge_total[base_type] = {}
  1999. end
  2000. self.recharge_total[base_type][sub_type] = number
  2001. end
  2002. end
  2003. function KfActivityModel:SetZeroGiftInfo( vo )
  2004. local new_data = {}
  2005. for kk,vv in pairs(vo.reward_list) do
  2006. new_data[vv.grade] = vv
  2007. end
  2008. vo.reward_list = new_data
  2009. if vo and vo.sub_type then
  2010. self.zero_gift_view_info[vo.sub_type] = {}
  2011. self.zero_gift_view_info[vo.sub_type] = vo
  2012. else
  2013. self.zero_gift_view_info[vo.sub_type] = {}
  2014. end
  2015. self:ZeroGiftNeedTimeLater()
  2016. -- local is_show_time = vo.start_time and (vo.start_time - TimeUtil:getServerTime()) > 0
  2017. local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
  2018. local act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
  2019. for k, v in pairs(act_list) do
  2020. if v.act_type == CustomActivityModel.CustomIconActType.GiftAct then--限时礼包类型
  2021. self:CheckActIconBoolOpen(v.sub_type)
  2022. break
  2023. end
  2024. end
  2025. end
  2026. function KfActivityModel:GetZeroGiftInfo(sub_type)
  2027. return self.zero_gift_view_info[sub_type] or nil
  2028. end
  2029. function KfActivityModel:GetZeroGiftGradeInfo(sub_type,grade)
  2030. if not self.zero_gift_view_info[sub_type] then return nil end
  2031. for k,v in pairs(self.zero_gift_view_info[sub_type].reward_list) do
  2032. if v.grade == grade then
  2033. return v
  2034. end
  2035. end
  2036. return nil
  2037. end
  2038. function KfActivityModel:ZeroGiftNeedTimeLater( )--是否需要倒计时刷新
  2039. for k,v in pairs(self.zero_gift_view_info) do
  2040. local limit_time = 0
  2041. local limit_data = nil
  2042. for kk,vv in pairs(v.reward_list) do
  2043. if vv.time - TimeUtil:getServerTime() > 0 then
  2044. if limit_time - TimeUtil:getServerTime() > 0 then
  2045. if limit_time > vv.time then
  2046. limit_time = vv.time
  2047. limit_data = vv
  2048. end
  2049. else
  2050. limit_time = vv.time
  2051. limit_data = vv
  2052. end
  2053. end
  2054. end
  2055. if limit_time - TimeUtil:getServerTime() > 0 then
  2056. self:SetZeroGiftActDetailShow(v.sub_type,limit_data)
  2057. else
  2058. if self.zero_gift_time_id_list[v.sub_type] then
  2059. GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[v.sub_type])
  2060. self.zero_gift_time_id_list[v.sub_type] = nil
  2061. end
  2062. end
  2063. end
  2064. end
  2065. function KfActivityModel:SetZeroGiftActDetailShow( sub_type,data )
  2066. if self.zero_gift_time_id_list[sub_type] then
  2067. GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
  2068. self.zero_gift_time_id_list[sub_type] = nil
  2069. end
  2070. if not sub_type or not data.time then return end
  2071. local sec = data.time - TimeUtil:getServerTime()
  2072. if sec >= 0 then
  2073. local function onTimer()
  2074. sec = data.time - TimeUtil:getServerTime()
  2075. if sec >= 0 then
  2076. -- print("WQ:AllGiftModel [155]倒计时领奖中: ",sec)
  2077. else
  2078. if self.zero_gift_time_id_list[sub_type] then
  2079. local function delay_method( )
  2080. self:Fire(KfActivityModel.REQUEST_INFO,33185,CustomActivityModel.CustomActBaseType.ZERO_GIFT,sub_type)
  2081. end
  2082. setTimeout(delay_method, 0.5)
  2083. GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
  2084. self.zero_gift_time_id_list[sub_type] = nil
  2085. end
  2086. end
  2087. end
  2088. if not self.zero_gift_time_id_list[sub_type] then
  2089. self.zero_gift_time_id_list[sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  2090. end
  2091. else
  2092. if self.zero_gift_time_id_list[sub_type] then
  2093. GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
  2094. self.zero_gift_time_id_list[sub_type] = nil
  2095. end
  2096. end
  2097. end
  2098. --设置团购信息
  2099. function KfActivityModel:SetGroupBuyingInfo( scmd )
  2100. local list = {}
  2101. for k,v in pairs(scmd.list) do
  2102. list[v.grade] = v
  2103. end
  2104. scmd.list = list
  2105. self.group_buying_view_info[scmd.sub_type] = scmd
  2106. end
  2107. --团购信息推送 设置信息
  2108. function KfActivityModel:SetGroupBuyingInfoByGrade( scmd )
  2109. if self.group_buying_view_info[scmd.sub_type] and self.group_buying_view_info[scmd.sub_type].list
  2110. and self.group_buying_view_info[scmd.sub_type].list[scmd.grade] then
  2111. self.group_buying_view_info[scmd.sub_type].list[scmd.grade] = scmd
  2112. end
  2113. end
  2114. function KfActivityModel:GetGroupBuyingInfo( sub_type )
  2115. return self.group_buying_view_info[sub_type]
  2116. end
  2117. --团购倒计时
  2118. function KfActivityModel:KfGroupBuyingTimeLater( sub_type )
  2119. if self.groupBuying_time_id_list[sub_type] then
  2120. GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
  2121. self.groupBuying_time_id_list[sub_type] = nil
  2122. end
  2123. if not sub_type or not self.group_buying_time_list[sub_type] then return end
  2124. if self.group_buying_time_list[sub_type] > 0 then
  2125. local function onTimer()
  2126. self.group_buying_time_list[sub_type] = self.group_buying_time_list[sub_type] - 1
  2127. if self.group_buying_time_list[sub_type] >= 0 then
  2128. else
  2129. if self.groupBuying_time_id_list[sub_type] then
  2130. GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
  2131. self.groupBuying_time_id_list[sub_type] = nil
  2132. end
  2133. end
  2134. end
  2135. if not self.groupBuying_time_id_list[sub_type] then
  2136. self.groupBuying_time_id_list[sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  2137. end
  2138. else
  2139. if self.groupBuying_time_id_list[sub_type] then
  2140. GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
  2141. self.groupBuying_time_id_list[sub_type] = nil
  2142. end
  2143. end
  2144. end
  2145. --检查开服团购红点子类型
  2146. function KfActivityModel:CheckKfGroupBuyingSubTypeRedDot( sub_type )
  2147. local info = self:GetGroupBuyingInfo(sub_type)
  2148. local base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING
  2149. if not self.act_red_dot_info[base_type] then
  2150. self.act_red_dot_info[base_type] = {}
  2151. end
  2152. if not info or not info.list then
  2153. self.act_red_dot_info[base_type][sub_type] = false
  2154. return
  2155. end
  2156. local sort_func = function ( a, b )
  2157. return a.grade < b.grade
  2158. end
  2159. self.act_red_dot_info[base_type][sub_type] = false
  2160. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  2161. local award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
  2162. local jin_enough = false
  2163. if award_data and award_data.reward_list and info.list then
  2164. local gold_type = 0
  2165. local original_price = 0
  2166. local discount_list = nil
  2167. local member_list = nil
  2168. table.sort(award_data.reward_list, sort_func)
  2169. for kk,vv in ipairs(award_data.reward_list) do
  2170. for m,n in ipairs(vv.condition_list) do
  2171. if n[1] == "gold_type" then
  2172. gold_type = tonumber(n[2])
  2173. elseif n[1] == "original_price" then
  2174. original_price = tonumber(n[2])
  2175. elseif n[1] == "discount" then
  2176. discount_list = n[2]
  2177. elseif n[1] == "member" then
  2178. member_list = n[2]
  2179. end
  2180. end
  2181. if info.list[vv.grade] and gold_type == 2 then
  2182. local is_buy = info.list[vv.grade].price ~= 0--是否购买
  2183. local cur_discount = self:GetKfGroupBuyingCurDiscount(discount_list,member_list,info.list[vv.grade].member)
  2184. if not is_buy and not jin_enough then
  2185. jin_enough = (gold_type == 1 and original_price*cur_discount/10 <= RoleManager.Instance.mainRoleInfo.jin) or original_price*cur_discount/10 <= RoleManager.Instance.mainRoleInfo.jinLock
  2186. end
  2187. local get_num = is_buy and (info.list[vv.grade].price - cur_discount*original_price/10) or 0
  2188. self.act_red_dot_info[base_type][sub_type] = get_num > 0
  2189. if get_num > 0 then
  2190. break
  2191. end
  2192. end
  2193. end
  2194. end
  2195. -- local group_red_list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.GROUP_BUYING) or {}
  2196. -- if group_red_list[sub_type] == nil then
  2197. -- group_red_list[sub_type] = true
  2198. -- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.GROUP_BUYING,group_red_list)
  2199. -- CookieWrapper.Instance:WriteAll()
  2200. -- end
  2201. if self.group_red_list[sub_type] == nil and not jin_enough then--买不起 没红点
  2202. self.group_red_list[sub_type] = false
  2203. end
  2204. if self.group_red_list[sub_type] == false and jin_enough then--本来买不起 突然有钱了 买的起 那就要有红点了。
  2205. self.group_red_list[sub_type] = nil
  2206. end
  2207. if self.group_red_list[sub_type] == nil then
  2208. for i,v in ipairs(info.list) do
  2209. local is_buy = v.price ~= 0--是否购买
  2210. if not is_buy then--未购买
  2211. self.act_red_dot_info[base_type][sub_type] = true
  2212. break
  2213. end
  2214. end
  2215. end
  2216. -- print("huangcong:KfActivityModel [start:1792] :", self.act_red_dot_info[base_type])
  2217. -- PrintTable(self.act_red_dot_info[base_type])
  2218. -- print("huangcong:KfActivityModel [end]")
  2219. end
  2220. --获取当前折数
  2221. function KfActivityModel:GetKfGroupBuyingCurDiscount( discount_list,member_list,member )
  2222. local cur_discount = 0
  2223. if discount_list and #discount_list > 0 then
  2224. local member_num = member or 0
  2225. for i,v in ipairs(member_list) do
  2226. if tonumber(v) <= member_num then
  2227. cur_discount = tonumber(discount_list[i])
  2228. end
  2229. end
  2230. end
  2231. cur_discount = cur_discount < 0 and 0 or cur_discount
  2232. return cur_discount
  2233. end
  2234. --获得补签消耗
  2235. function KfActivityModel:GetMonopolyDesignPrice( count )
  2236. if Config.Monoprice[count] then
  2237. return Config.Monoprice[count].price
  2238. end
  2239. return 0
  2240. end
  2241. --获得大富翁圈数格子配置
  2242. function KfActivityModel:GetMonopolyLatticeCfg( round,index )
  2243. if not index then
  2244. return self.mono_lattice_cfg[round]
  2245. elseif self.mono_lattice_cfg[round] then
  2246. return self.mono_lattice_cfg[round][index]
  2247. end
  2248. end
  2249. --获得小宝箱奖励
  2250. function KfActivityModel:GetMonopolySmallBoxAward( index )
  2251. return self.mono_smallbox_award_cfg[index]
  2252. end
  2253. --获得幸运卡奖励
  2254. function KfActivityModel:GetMonopolyLuckyAward( index )
  2255. return self.mono_lucky_award_cfg[index]
  2256. end
  2257. --获得大富翁圈数奖励
  2258. function KfActivityModel:GetMonopolyRoundAward( sub_type,round )
  2259. if self.mono_round_award_cfg[sub_type] and not round then
  2260. return self.mono_round_award_cfg[sub_type]
  2261. elseif self.mono_round_award_cfg[sub_type] then
  2262. return self.mono_round_award_cfg[sub_type][round]
  2263. end
  2264. end
  2265. --设置大富翁信息
  2266. function KfActivityModel:SetMonopolyInfo( vo )
  2267. local new_data = vo
  2268. -- local new_lucky_pools = {}
  2269. -- for k,v in pairs(vo.lucky_pools) do
  2270. -- new_lucky_pools[v.index] = v
  2271. -- end
  2272. local new_dice_list = {}
  2273. for k,v in pairs(vo.dice_list) do
  2274. new_dice_list[v.index] = v
  2275. end
  2276. local new_circle_rewards = {}
  2277. for k,v in pairs(vo.circle_rewards) do
  2278. new_circle_rewards[v.circle] = v
  2279. end
  2280. -- new_data.lucky_pools = new_lucky_pools
  2281. if #vo.lucky_pools > 1 then
  2282. local sort_func = function ( a, b )
  2283. return a.index < b.index
  2284. end
  2285. table.sort(vo.lucky_pools, sort_func)
  2286. end
  2287. -- print("huangcong:KfActivityController [start:547] vo:", vo.lucky_pools)
  2288. -- PrintTable(vo.lucky_pools)
  2289. -- print("huangcong:KfActivityController [end]")
  2290. new_data.dice_list = new_dice_list
  2291. new_data.circle_rewards = new_circle_rewards
  2292. self.monopoly_info[vo.sub_type] = vo
  2293. end
  2294. --获得大富翁信息
  2295. function KfActivityModel:GetMonopolyInfo( sub_type )
  2296. return self.monopoly_info[sub_type]
  2297. end
  2298. --检查活动图标(开服活动 精彩活动 主题活动)开启
  2299. function KfActivityModel:CheckActIconBoolOpen( sub_type )
  2300. local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
  2301. local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  2302. local level = RoleManager.Instance.mainRoleInfo.level
  2303. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  2304. local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
  2305. local is_open = false
  2306. local end_time = 0
  2307. local open_level = 1
  2308. local close_level = 9999
  2309. local icon_sub_type = base_type*1000 + sub_type
  2310. if sub_type >= 10001 then
  2311. icon_sub_type = base_type*100000 + sub_type
  2312. end
  2313. if act_list and act_list.etime then
  2314. for l,w in pairs(act_list.condition_list) do
  2315. if type(w) == "table" and w[1] == "role_lv" then
  2316. open_level = tonumber(w[2])
  2317. elseif type(w) == "table" and w[1] == "close_lv" then
  2318. close_level = tonumber(w[2])
  2319. end
  2320. end
  2321. local have_time = TimeUtil:getServerTime( ) - act_list.stime
  2322. end_time = act_list.etime - TimeUtil:getServerTime()
  2323. is_open = have_time > 0 and end_time > 0 and open_level <= level and close_level > level
  2324. if GetModuleIsOpen(331,base_type) then
  2325. if is_open then
  2326. if act_list.act_type == CustomActivityModel.CustomIconActType.JcAct then--开服狂huan
  2327. local act_sub_list = self:UpdateTab(act_list.act_type)
  2328. if TableSize(act_sub_list) > 0 then
  2329. self:UpdateZeroGiftIconState(icon_sub_type)
  2330. end
  2331. end
  2332. if act_list.act_type == CustomActivityModel.CustomIconActType.GiftAct then
  2333. local act_sub_list = self:UpdateTab(act_list.act_type)
  2334. if TableSize(act_sub_list) > 0 then
  2335. local min_time = self:GetActiListMinTime(act_sub_list)
  2336. if min_time and min_time > 0 then
  2337. local str = nil
  2338. if openDay <= 4 and level < 110 then
  2339. str = "110级可领"
  2340. end
  2341. ActivityIconManager:getInstance():addIcon(icon_sub_type, min_time, str)
  2342. else
  2343. ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
  2344. end
  2345. else
  2346. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  2347. end
  2348. elseif act_list.act_type == CustomActivityModel.CustomIconActType.KfAct and openDay <= 8 then--开服排行开服前8天底下要显示开服冲榜信息
  2349. local rank_type_list = self:GetTodayRankType()
  2350. local rank_sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.RUSH_RANK)
  2351. local rank_info = self:GetRushRankInfo(rank_sub_type,rank_type_list and rank_type_list[1])
  2352. local str = "今日主题"
  2353. local rank_max_limit = self:GetRushRankMaxLimit(rank_type_list and rank_type_list[1])--冲榜最大限制
  2354. if rank_info and rank_info.sel_rank and rank_info.sel_rank ~= 0 and rank_info.sel_rank <= rank_max_limit then
  2355. str = string.format("排名:%s",rank_info.sel_rank)
  2356. end
  2357. ActivityIconManager:getInstance():addIcon(icon_sub_type, -1, str)
  2358. else
  2359. ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
  2360. end
  2361. else
  2362. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  2363. end
  2364. else
  2365. -- print("huangcong:KfActivityModel [62]: ",key)
  2366. end
  2367. else
  2368. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  2369. end
  2370. end
  2371. -- 0元礼包特殊更新逻辑
  2372. function KfActivityModel:UpdateZeroGiftIconState(icon_sub_type)
  2373. if RoleManager.Instance.mainRoleInfo.level > 96 then return end
  2374. local zeroGiftHaveOpen = self:GetZeroGiftFirstOpenCookie()
  2375. -- print("Lizhijian:KfActivityModel [start:2264] self.haveBubble ------------------------------------------")
  2376. -- 零元礼包界面打开后不显示气泡
  2377. if not zeroGiftHaveOpen and not self.haveBubble then
  2378. self.haveBubble = true
  2379. -- 0元礼包气泡提示 前端自定义配置,可修改
  2380. local act_icon_info = {
  2381. condition_list = {
  2382. { 'type', 0}, -- 0为直接读取图片,1为读取程序字
  2383. { 'role_lv', 96},
  2384. { 'func', icon_sub_type},
  2385. { 'show', 999}, -- 显示时长
  2386. { 'node', {0}},
  2387. { 'loc', 'right'},
  2388. {'bg_type', 36} -- 气泡样式,对应1或者2的资源后缀
  2389. },
  2390. stime = 0,
  2391. base_type = 999,
  2392. sub_type = -1, -- 气泡显示优先级,-1为最高优先级
  2393. etime = 2147000000, --INT_MAX
  2394. desc = "免费送SR战魂", -- 气泡文本内容
  2395. condition = "",
  2396. is_first_open = 0,
  2397. wlv = 948,
  2398. name = "0元礼包",
  2399. act_type = CustomActivityModel.CustomIconActType.JcAct,
  2400. }
  2401. local function delay_func( ... )
  2402. ActivityIconManager:getInstance():SetActivityIconCustomDescInfo(act_icon_info)
  2403. end
  2404. setTimeout(delay_func,60)
  2405. end
  2406. -- 零元礼包界面打开后不显示光效
  2407. local icon_data = ActivityIconManager:getIconCfg(icon_sub_type)
  2408. if zeroGiftHaveOpen then
  2409. icon_data.effect_name = nil
  2410. else
  2411. icon_data.effect_name = "ui_bianqiang"
  2412. end
  2413. ActivityIconManager:SetIconNewCfgInfo(icon_data)
  2414. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_SINGLE_ICON,icon_sub_type)
  2415. end
  2416. --获得活动列表最小时间
  2417. function KfActivityModel:GetActiListMinTime( all_list )
  2418. local my_level = RoleManager.Instance.mainRoleInfo.level
  2419. local min_end_time = nil
  2420. local server_time = TimeUtil:getServerTime( )
  2421. for k,v in pairs(all_list) do
  2422. local open_level = Config.Modulesub["331@"..v.base_type].open_lv or 1
  2423. local end_time = v.etime
  2424. for l,w in pairs(v.condition_list) do
  2425. if type(w) == "table" and w[1] == "role_lv" then
  2426. open_level = tonumber(w[2])
  2427. break
  2428. end
  2429. end
  2430. if server_time > v.stime and end_time > server_time then--暂时先用这个不然看不到
  2431. if my_level >= open_level and GetModuleIsOpen(331,v.base_type) then
  2432. if v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT then--0元礼包的拿自己的数据
  2433. local zero_info = self:GetZeroGiftInfo(v.sub_type)
  2434. if zero_info and zero_info.reward_list then
  2435. for kk,vv in pairs(zero_info.reward_list) do
  2436. if vv.status ~= 2 then
  2437. if not min_end_time then
  2438. min_end_time = end_time - TimeUtil:getServerTime( )
  2439. else
  2440. min_end_time = (end_time - TimeUtil:getServerTime( )) < min_end_time and (end_time - TimeUtil:getServerTime( )) or min_end_time
  2441. end
  2442. end
  2443. end
  2444. end
  2445. else
  2446. local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
  2447. if award_data and award_data.reward_list then
  2448. for ii,vv in pairs(award_data.reward_list) do
  2449. if vv.status ~= 2 then
  2450. if not min_end_time then
  2451. min_end_time = end_time - TimeUtil:getServerTime( )
  2452. else
  2453. min_end_time = (end_time - TimeUtil:getServerTime( )) < min_end_time and (end_time - TimeUtil:getServerTime( )) or min_end_time
  2454. end
  2455. end
  2456. end
  2457. end
  2458. end
  2459. end
  2460. end
  2461. end
  2462. return min_end_time
  2463. end
  2464. --检查活动图标升级刷新
  2465. function KfActivityModel:CheckActIconLevelUp( level )
  2466. if level >= Config.Modulesub["331@99"].open_lv then--主题活动判断等级
  2467. local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY)
  2468. if all_act_list then
  2469. for i,v in pairs(all_act_list) do
  2470. for l,w in pairs(v.condition_list) do
  2471. if type(w) == "table" and w[1] == "role_lv" then
  2472. local open_level = tonumber(w[2])
  2473. if open_level == level or level == Config.Modulesub["331@99"].open_lv then
  2474. self:CheckActIconBoolOpen(v.sub_type)
  2475. self:CheckMainIconRedDot(v.act_type)
  2476. end
  2477. end
  2478. end
  2479. end
  2480. end
  2481. end
  2482. end
  2483. --获得活动类型资源
  2484. function KfActivityModel:GetActTypeRes( act_type )
  2485. return KfActivityConst.ActTypeRes[act_type]
  2486. end
  2487. --获得界面类
  2488. function KfActivityModel:GetViewClassAndDesc(id,choose_tab_data)
  2489. local view_class = self.act_view_class[id]
  2490. local desc_str = ""
  2491. if choose_tab_data.base_type and choose_tab_data.sub_type then
  2492. local act_list = CustomActivityModel:getInstance():getActList(choose_tab_data.base_type, choose_tab_data.sub_type)
  2493. if act_list then
  2494. if string.len(act_list.desc) == 0 and choose_tab_data.base_type == 7 then
  2495. desc_str = string.format("%s",HtmlColorTxt("活动期间,每日累充到一定金额,即可领取丰厚的返利奖励!", ColorUtil.WHITE_DARK))
  2496. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.MONOPOLY then--大富翁说明在界面里面
  2497. desc_str = ""
  2498. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.Competing then--竞榜有自己的时间
  2499. desc_str = ""
  2500. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.DUN_MUL_DROP then--竞榜有自己的时间
  2501. desc_str = ""
  2502. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.BOSS_TREASURE then--幻魔宝典
  2503. desc_str = ""
  2504. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.RUSH_RANK then--幻魔宝典
  2505. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS then--节日幻魔
  2506. desc_str = ""
  2507. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.LOGIN_PASS then
  2508. desc_str = ""
  2509. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT then--合成机自己有额外说明
  2510. desc_str = ""
  2511. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT then
  2512. desc_str = ""
  2513. elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.JUMP_ONE then
  2514. desc_str = ""
  2515. else
  2516. local desc = ChuanWenManager:getInstance():FormatColorTag2(Trim(act_list.desc),true)
  2517. desc_str = string.format("%s",desc)
  2518. end
  2519. else
  2520. desc_str = ""
  2521. end
  2522. end
  2523. if string.len(desc_str) ~= 0 then
  2524. desc_str = string.format("<color=%s>活动说明:</color>%s","#a9c1e1",desc_str) or ""
  2525. end
  2526. return view_class,desc_str
  2527. end
  2528. --获得活动类型
  2529. function KfActivityModel:GetActType(sub_type,id)
  2530. local act_type = nil
  2531. if id == KfActivityModel.TabID.Competing and sub_type then
  2532. local competing_cfg = CompetingListModel:getInstance():GetCompetingCfg(sub_type)
  2533. if competing_cfg then
  2534. local icon_act_type = CustomActivityModel.CustomIconActType.KfAct--默认放在开服活动图标里面
  2535. for k,v in pairs(competing_cfg.condition) do
  2536. if v[1] == "icon" then
  2537. act_type = tonumber(v[2])
  2538. break
  2539. end
  2540. end
  2541. end
  2542. return act_type
  2543. end
  2544. local server_time = TimeUtil:getServerTime()
  2545. if id then
  2546. for k,v in pairs(KfActivityModel.TabData) do
  2547. if v.id == id then
  2548. local base_type = v.base_type
  2549. local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
  2550. local open_level = 1
  2551. for kk,vv in pairs(all_act_list) do
  2552. open_level = 1
  2553. if server_time > vv.stime and vv.etime > server_time and (not sub_type or sub_type == vv.sub_type) then--满足活动开放时间(0元礼包如果有未领的返还也要显示页签不能消失)
  2554. for l,w in pairs(vv.condition_list) do
  2555. if type(w) == "table" and w[1] == "role_lv" then
  2556. open_level = tonumber(w[2])
  2557. break
  2558. end
  2559. end
  2560. if open_level <= RoleManager.Instance.mainRoleInfo.level then
  2561. act_type = vv.act_type
  2562. break
  2563. end
  2564. end
  2565. end
  2566. break
  2567. end
  2568. end
  2569. else
  2570. local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
  2571. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  2572. if act_list then
  2573. act_type = act_list.act_type
  2574. end
  2575. end
  2576. return act_type
  2577. end
  2578. --设置嗨点活动信息
  2579. function KfActivityModel:SetHighPointInfo( scmd )
  2580. if not self.high_info then
  2581. self.high_info = {}
  2582. end
  2583. if not self.high_info[scmd.base_type] then
  2584. self.high_info[scmd.base_type] = {}
  2585. end
  2586. if not self.high_info[scmd.base_type][scmd.sub_type] then
  2587. self.high_info[scmd.base_type][scmd.sub_type] = {}
  2588. end
  2589. self.high_info[scmd.base_type][scmd.sub_type] = scmd
  2590. local sort_func = function ( a, b )
  2591. return a.order_id < b.order_id
  2592. end
  2593. table.sort(scmd.mod_list, sort_func)
  2594. local new_mod_list = {}
  2595. for i,v in ipairs(scmd.mod_list) do
  2596. local data = v
  2597. local jump_id_list = stringtotable(data.jump_id)
  2598. if jump_id_list then
  2599. data.jump_id = jump_id_list[1]
  2600. end
  2601. new_mod_list[#new_mod_list + 1] = data
  2602. end
  2603. self.high_info[scmd.base_type][scmd.sub_type].mod_list = scmd.mod_list
  2604. if scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then--嗨点更新
  2605. self:IsNeedRed(KfActivityModel.TabID.HighPoint,nil,scmd.sub_type)
  2606. elseif scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换更新
  2607. self:IsNeedRed(KfActivityModel.TabID.HighExchange,nil,scmd.sub_type)
  2608. end
  2609. end
  2610. --嗨点总数推送 需要刷新红点
  2611. function KfActivityModel:SetHighPointSumNum( scmd )
  2612. if self.high_info[scmd.base_type] and self.high_info[scmd.base_type][scmd.sub_type] then
  2613. self.high_info[scmd.base_type][scmd.sub_type].sum_points = scmd.sum_points
  2614. end
  2615. if scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then--嗨点更新
  2616. self:IsNeedRed(KfActivityModel.TabID.HighPoint,nil,scmd.sub_type)
  2617. elseif scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换更新
  2618. self:IsNeedRed(KfActivityModel.TabID.HighExchange,nil,scmd.sub_type)
  2619. end
  2620. end
  2621. --获得嗨点兑换资源图标
  2622. function KfActivityModel:GetHighExchangeIconPic( sub_type )
  2623. local base_type = CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE
  2624. sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  2625. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  2626. if act_list then
  2627. for k,v in pairs(act_list.condition_list) do
  2628. if v[1] and v[2] then
  2629. if v[1] == "act_icon_pic" then
  2630. return tonumber(v[2])
  2631. end
  2632. end
  2633. end
  2634. end
  2635. return 1
  2636. end
  2637. --获得嗨点红点资源信息
  2638. function KfActivityModel:GetHighPointInfo( base_type, sub_type )
  2639. if self.high_info[base_type] then
  2640. return self.high_info[base_type][sub_type]
  2641. end
  2642. end
  2643. --检查嗨点红点
  2644. function KfActivityModel:CheckHighPointRedDot(base_type,sub_type)
  2645. -- if not GetModuleIsOpen(331,base_type) or not sub_type then return false end
  2646. if not sub_type then return false end
  2647. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  2648. local show = false
  2649. local act_type = CustomActivityModel.CustomIconActType.KfAct
  2650. if not self.act_red_dot_info[base_type] then
  2651. self.act_red_dot_info[base_type] = {}
  2652. end
  2653. self.act_red_dot_info[base_type][sub_type] = false
  2654. if act_list then
  2655. act_type = act_list.act_type
  2656. local server_time = TimeUtil:getServerTime( )
  2657. local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
  2658. if server_time > act_list.stime and act_list.etime > server_time then
  2659. if info and info.reward_list then
  2660. for k,n in pairs(info.reward_list) do
  2661. if n.status == 1 then
  2662. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  2663. show = true
  2664. elseif n.status == 0 then
  2665. local parse = n.condition_list
  2666. if parse then
  2667. local max = 0
  2668. local limit_time = 0
  2669. for kk,vv in pairs(parse) do--[{hi_points,250},{limit_times,1},{tag,1},{show_level_range,1,999}]
  2670. if vv[1] == "hi_points" then
  2671. max = tonumber(vv[2])
  2672. elseif vv[1] == "limit_times" then
  2673. limit_time = tonumber(vv[2])
  2674. end
  2675. end
  2676. local max = tonumber(parse[1][2])
  2677. local server_info = self:GetHighPointInfo(act_list.base_type,act_list.sub_type)
  2678. local cur = 0
  2679. if server_info and server_info.sum_points then
  2680. cur = server_info.sum_points
  2681. end
  2682. if act_list.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then
  2683. if cur >= max then
  2684. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  2685. show = true
  2686. end
  2687. elseif act_list.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then
  2688. if limit_time > n.receive_times and (cur >= max or not self.high_login_red_list[act_list.sub_type]) then
  2689. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
  2690. show = true
  2691. end
  2692. end
  2693. end
  2694. end
  2695. end
  2696. end
  2697. end
  2698. end
  2699. return show,act_type
  2700. end
  2701. -- 设置投资活动数据 33141
  2702. function KfActivityModel:SetInvestActData(vo)
  2703. self.invest_event_data[vo.sub_type] = self.invest_event_data[vo.sub_type] or {}
  2704. self.invest_event_data[vo.sub_type].sub_type = vo.sub_type
  2705. self.invest_event_data[vo.sub_type].investment_list = vo.investment_list
  2706. end
  2707. function KfActivityModel:GetInvestActData(sub_type, grade)
  2708. if grade then
  2709. if self.invest_event_data[sub_type]
  2710. and self.invest_event_data[sub_type].investment_list then
  2711. for k, v in pairs(self.invest_event_data[sub_type].investment_list) do
  2712. if v.grade == grade then
  2713. return v
  2714. end
  2715. end
  2716. end
  2717. return nil
  2718. else
  2719. return self.invest_event_data[sub_type]
  2720. end
  2721. end
  2722. -- 获取投资档位的天数奖励领取情况
  2723. function KfActivityModel:GetInvestActGradeReceiveFlag(sub_type, grade, day_num)
  2724. local grade_data = self:GetInvestActData(sub_type, grade)
  2725. if grade_data then
  2726. for k, v in ipairs(grade_data.awards) do
  2727. if v.award_id == day_num then
  2728. return v.status -- 0不可领 1可领 2已领
  2729. end
  2730. end
  2731. end
  2732. return 0
  2733. end
  2734. -- 更新投资档位的购买情况 33142
  2735. function KfActivityModel:UpdateInvestActBuyFlag(vo)
  2736. self.invest_event_data[vo.sub_type] = self.invest_event_data[vo.sub_type] or {}
  2737. self.invest_event_data[vo.sub_type].investment_list = self.invest_event_data[vo.sub_type].investment_list or {}
  2738. for k, v in pairs(self.invest_event_data[vo.sub_type].investment_list) do
  2739. if v.grade == vo.grade then
  2740. v.is_buy = 1
  2741. break
  2742. end
  2743. end
  2744. end
  2745. -- 更新投资活动数据 33144
  2746. function KfActivityModel:UpdateInvestActData(vo)
  2747. if self.invest_event_data[vo.sub_type]
  2748. and self.invest_event_data[vo.sub_type].investment_list then
  2749. for k, grade_data in ipairs(self.invest_event_data[vo.sub_type].investment_list) do
  2750. if grade_data.grade == vo.grade then
  2751. for k2, v in ipairs(grade_data.awards) do
  2752. if v.award_id == vo.day then
  2753. v.status = 2
  2754. break
  2755. end
  2756. end
  2757. break
  2758. end
  2759. end
  2760. end
  2761. end
  2762. -- 检查目标子活动页签是否显示
  2763. function KfActivityModel:CheckInvestActTabIsOpen(sub_type)
  2764. local invest_data = self:GetInvestActData(sub_type)
  2765. if invest_data then
  2766. for k, v in ipairs(invest_data.investment_list) do
  2767. if v.is_buy == 0 then -- 存在未购买,则显示页签
  2768. return true
  2769. end
  2770. -- 已购买的要判断是否有未领取的奖励
  2771. for k2, v2 in ipairs(v.awards) do
  2772. if v2.status ~= 2 then -- 存在不可领或者可领取的,则显示页签
  2773. return true
  2774. end
  2775. end
  2776. end
  2777. end
  2778. return false
  2779. end
  2780. -- 检查投资活动红点
  2781. function KfActivityModel:CheckActInvestRedDot(sub_type)
  2782. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.INVEST_ACT, sub_type)
  2783. local act_type = CustomActivityModel.CustomIconActType.KfAct
  2784. local bool = false
  2785. self.invest_grade_red_cache[sub_type] = self.invest_grade_red_cache[sub_type] or {}
  2786. if act_list then
  2787. act_type = act_list.act_type
  2788. if not self.act_red_dot_info[act_list.base_type] then
  2789. self.act_red_dot_info[act_list.base_type] = {}
  2790. end
  2791. local invest_data = self:GetInvestActData(sub_type)
  2792. if invest_data then
  2793. for k, v in ipairs(invest_data.investment_list) do
  2794. local grade_red = false
  2795. if v.is_buy == 1 then
  2796. for k2, v2 in ipairs(v.awards) do
  2797. grade_red = grade_red or v2.status == 1
  2798. end
  2799. end
  2800. bool = bool or grade_red
  2801. -- 同时缓存投资的档位红点
  2802. self.invest_grade_red_cache[sub_type][v.grade] = grade_red
  2803. end
  2804. end
  2805. if not bool then
  2806. local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(act_list.base_type,act_list.sub_type)
  2807. if com_act_red_info then
  2808. bool = com_act_red_info.status == 1
  2809. end
  2810. if not bool and com_act_red_info and com_act_red_info.tab_list then--投资活动比较特殊
  2811. for i,v in ipairs(com_act_red_info.tab_list) do
  2812. if v.status == 1 then
  2813. bool = true
  2814. break
  2815. end
  2816. end
  2817. end
  2818. end
  2819. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  2820. end
  2821. return bool, act_type
  2822. end
  2823. -- 获取缓存的投资档位红点
  2824. function KfActivityModel:GetInvestActGradeRed(sub_type, grade)
  2825. local show_red = self.invest_grade_red_cache[sub_type] and self.invest_grade_red_cache[sub_type][grade] or false
  2826. if not show_red then
  2827. local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(CustomActivityModel.CustomActBaseType.INVEST_ACT,sub_type)
  2828. if com_act_red_info and com_act_red_info.tab_list then--投资活动比较特殊
  2829. for i,v in ipairs(com_act_red_info.tab_list) do
  2830. if v.status == 1 and v.grade == grade then
  2831. show_red = true
  2832. break
  2833. end
  2834. end
  2835. end
  2836. end
  2837. return show_red
  2838. end
  2839. function KfActivityModel:CheckLuckyTurnTableRedDot(sub_type)
  2840. local need_red = false
  2841. local data1 = OperateActivityModel:getInstance():GetLuckyTurnTableBaseInfo(sub_type, 1)
  2842. local data2 = OperateActivityModel:getInstance():GetLuckyTurnTableBaseInfo(sub_type, 2)
  2843. if TableSize(data1) > 0 then
  2844. local rest_num = data1.times - data1.use_times
  2845. need_red = need_red or rest_num > 0
  2846. end
  2847. if TableSize(data2) > 0 then
  2848. local rest_num = data2.times - data2.use_times
  2849. need_red = need_red or rest_num > 0
  2850. end
  2851. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE, sub_type)
  2852. local act_type = CustomActivityModel.CustomIconActType.KfAct
  2853. local bool = false
  2854. if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE] then
  2855. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE] = {}
  2856. end
  2857. if act_list then
  2858. act_type = act_list.act_type
  2859. local server_time = TimeUtil:getServerTime( )
  2860. if server_time > act_list.stime and act_list.etime > server_time then
  2861. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE][sub_type] = need_red
  2862. else
  2863. need_red = false
  2864. end
  2865. end
  2866. return need_red,act_type
  2867. end
  2868. --秒杀基础信息
  2869. function KfActivityModel:SetSecKillBaseInfo( vo )
  2870. self.limit_seckill_base_info = vo
  2871. self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_INFO)
  2872. -- 加个即将开始的倒计时timer提醒
  2873. local cur_time = TimeUtil:getServerTime( )
  2874. local cur_round = vo.round
  2875. self:InitSeckillCache(vo.sub_type)
  2876. -- 场次排序
  2877. local sort_func = function ( a, b )
  2878. return a.round_id < b.round_id
  2879. end
  2880. table.sort(self.limit_seckill_base_info.round_info, sort_func)
  2881. if not (self:GetSecKillRemindCache()[vo.sub_type] == true) then return end -- 判断是否要提醒
  2882. self.limit_sec_kill_has_show_cache = self.limit_sec_kill_has_show_cache or {}
  2883. self.limit_sec_kill_has_show_cache[vo.sub_type] = self.limit_sec_kill_has_show_cache[vo.sub_type] or {}
  2884. if self.limit_sec_kill_has_show_cache[vo.sub_type][cur_round] then -- 弹过的场次就别再弹了
  2885. return
  2886. end
  2887. for k,v in pairs(self.limit_seckill_base_info.round_info) do
  2888. local zero_time = TimeUtil:GetToDayNHourStr(0)
  2889. local cfg_open_time = stringtotable(v.round_time)
  2890. local open_time = zero_time + 60*60*cfg_open_time[1] + 60*cfg_open_time[2] + cfg_open_time[3]--算出开放的时间戳
  2891. local end_time = open_time + v.duration
  2892. local is_end = (cur_time - end_time) >= 0 or v.round_id < cur_round--是否结束了
  2893. local is_open = (cur_time - open_time) >= 0--是否开启了
  2894. --开抢前五分钟就要开始倒计时了
  2895. if not is_end and not is_open then
  2896. local open_act_remind_tips = function ()
  2897. self.limit_sec_kill_has_show_cache[vo.sub_type][cur_round] = true -- 弹过的场次就别再弹了
  2898. local click_event = function () -- 跳转活动
  2899. GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,
  2900. vo.sub_type, KfActivityModel.TabID.LimitSeckill)
  2901. end
  2902. local data = {
  2903. winId = KfActivityModel.TabID.LimitSeckill,
  2904. sub_type = vo.sub_type,
  2905. click_event = click_event,
  2906. }
  2907. GlobalEventSystem:Fire(EventName.SHOW_COMMON_ACT_REMIND_TIPS,data)
  2908. end
  2909. if (open_time - cur_time) <= 120 then -- 已经准备开始了 就弹
  2910. open_act_remind_tips()
  2911. elseif cur_round == v.round_id then -- 就是当前场次
  2912. local function onTimer()
  2913. local cur_time = TimeUtil:getServerTime( )
  2914. if (open_time - cur_time) <= 120 then
  2915. open_act_remind_tips()
  2916. if self.act_sec_kill_timer_list[vo.sub_type] then
  2917. GlobalTimerQuest:CancelQuest(self.act_sec_kill_timer_list[vo.sub_type])
  2918. self.act_sec_kill_timer_list[vo.sub_type] = nil
  2919. end
  2920. end
  2921. end
  2922. if not self.act_sec_kill_timer_list then
  2923. self.act_sec_kill_timer_list = {}
  2924. end
  2925. if self.act_sec_kill_timer_list[vo.sub_type] then
  2926. GlobalTimerQuest:CancelQuest(self.act_sec_kill_timer_list[vo.sub_type])
  2927. self.act_sec_kill_timer_list[vo.sub_type] = nil
  2928. end
  2929. self.act_sec_kill_timer_list[vo.sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  2930. onTimer()
  2931. end
  2932. end
  2933. end
  2934. end
  2935. function KfActivityModel:GetSecKillBaseInfo( )
  2936. return self.limit_seckill_base_info
  2937. end
  2938. function KfActivityModel:IsSecKillAllRoundEnd( )
  2939. local base_info = self:GetSecKillBaseInfo()
  2940. local last_round_info = base_info.round_info[#base_info.round_info]
  2941. local cur_round = base_info.round
  2942. if last_round_info.round_id > cur_round then
  2943. return false
  2944. end
  2945. local cur_time = TimeUtil:getServerTime( )
  2946. local zero_time = TimeUtil:GetToDayNHourStr(0)
  2947. local cfg_open_time = stringtotable(last_round_info.round_time)
  2948. local open_time = zero_time + 60*60*cfg_open_time[1] + 60*cfg_open_time[2] + cfg_open_time[3]--算出开放的时间戳
  2949. local end_time = open_time + last_round_info.duration
  2950. local is_end = (cur_time - end_time) >= 0 --是否结束了
  2951. return is_end
  2952. end
  2953. --场次信息
  2954. function KfActivityModel:SetSecKillRoundInfo( vo )
  2955. local data = {}
  2956. local condition = nil
  2957. for i,v in ipairs(vo.round_info) do
  2958. data[i] = v
  2959. condition = stringtotable(v.condition)
  2960. for ii,vv in ipairs(condition) do
  2961. data[i][vv[1]] = vv[2]
  2962. end
  2963. end
  2964. if not self.limit_seckill_round_info[vo.round] then
  2965. self.limit_seckill_round_info[vo.round] = {}
  2966. end
  2967. local sort_func = function ( a, b )
  2968. return a.grade_id < b.grade_id
  2969. end
  2970. table.sort(data, sort_func)
  2971. self.limit_seckill_round_info[vo.round] = data
  2972. self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO)
  2973. end
  2974. function KfActivityModel:GetSecKillRoundInfo( round )
  2975. if round then
  2976. return self.limit_seckill_round_info[round] or {}
  2977. end
  2978. return {}
  2979. end
  2980. --更新一个信息
  2981. function KfActivityModel:SetSecKillOneInfo(round, grade_id, is_my)
  2982. if not round or not grade_id then
  2983. return
  2984. end
  2985. if self.limit_seckill_round_info[round] then
  2986. for i,v in ipairs(self.limit_seckill_round_info[round]) do
  2987. if v.grade_id == grade_id then
  2988. if is_my then
  2989. v.self_buy = v.self_buy + 1
  2990. else
  2991. v.buy_count = v.buy_count + 1
  2992. end
  2993. break
  2994. end
  2995. end
  2996. end
  2997. self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO)
  2998. end
  2999. --清理秒杀场次信息
  3000. function KfActivityModel:CleanSecKillRoundInfo( )
  3001. self.limit_seckill_round_info = {}
  3002. end
  3003. --记录
  3004. function KfActivityModel:SetSecKillRecordInfo( vo )
  3005. self.limit_seckill_record_info = vo
  3006. self:ChangeVar("limit_seckill_record_info", self.limit_seckill_record_info, false, true)
  3007. end
  3008. function KfActivityModel:SetSecKillOneRecord( vo )
  3009. local data = {
  3010. goods_id = vo.goods_id,
  3011. TvId = vo.TvId,
  3012. server_num = vo.server_num,
  3013. goods_num = vo.goods_num,
  3014. name = vo.name,
  3015. cost = vo.cost,
  3016. }
  3017. table_insert(self.limit_seckill_record_info.buy_log, data)
  3018. self:ChangeVar("limit_seckill_record_info", self.limit_seckill_record_info, false, true)
  3019. end
  3020. function KfActivityModel:GetSecKillRecordInfo( )
  3021. return self.limit_seckill_record_info
  3022. end
  3023. --抢购界面信息
  3024. function KfActivityModel:SetSecKillBuyInfo( vo )
  3025. if not self.limit_seckill_buy_info[vo.round] then
  3026. self.limit_seckill_buy_info[vo.round] = {}
  3027. end
  3028. self.limit_seckill_buy_info[vo.round][vo.grade_id] = vo
  3029. self:ChangeVar("limit_seckill_buy_info", self.limit_seckill_buy_info, false, true)
  3030. end
  3031. function KfActivityModel:GetSecKillBuyInfo(round, grade_id )
  3032. if not round or not grade_id then
  3033. return {}
  3034. end
  3035. if self.limit_seckill_buy_info[round] then
  3036. return self.limit_seckill_buy_info[round][grade_id] or {}
  3037. end
  3038. return {}
  3039. end
  3040. --场次开启需要重新刷一下红点
  3041. function KfActivityModel:LimitSecKillRoundStart( round )
  3042. local data = self:GetSecKillBaseInfo()
  3043. if data and data.round_info and data.round_info[round] then
  3044. if data.round_info[round].label == 2 then
  3045. self.is_open_limit_seckill_view = false
  3046. self:IsNeedRed(KfActivityModel.TabID.LimitSeckill,nil,data.sub_type)
  3047. end
  3048. end
  3049. end
  3050. function KfActivityModel:CheckSecKillRedDot(sub_type)
  3051. local need_red = not self.is_open_limit_seckill_view
  3052. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.LIMIT_SECKILL, sub_type)
  3053. local act_type = CustomActivityModel.CustomIconActType.KfAct
  3054. if act_list then
  3055. act_type = act_list.act_type
  3056. end
  3057. if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL] then
  3058. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL] = {}
  3059. end
  3060. self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL][sub_type] = need_red
  3061. return need_red,act_type
  3062. end
  3063. function KfActivityModel:InitSeckillCache(sub_type)
  3064. if self:GetSecKillBuySureCache( )[sub_type] == nil then
  3065. self:SetSecKillBuySureCache( sub_type, true )
  3066. end
  3067. if self:GetSecKillRemindCache( )[sub_type] == nil then
  3068. self:SetSecKillRemindCache( sub_type, false )
  3069. end
  3070. end
  3071. -- 购买秒杀物品时是否无需确认
  3072. function KfActivityModel:GetSecKillBuySureCache( )
  3073. -- local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,
  3074. -- CookieKey.SEC_KILL_BUY_TIPS) or {}
  3075. self.sec_kill_buy_sure = self.sec_kill_buy_sure or {}
  3076. local list = self.sec_kill_buy_sure
  3077. -- if list[sub_type] == nil then
  3078. -- self:SetSecKillBuySureCache(sub_type, false)
  3079. -- list[sub_type] = false
  3080. -- end
  3081. return list
  3082. end
  3083. -- 每个场次是否需要提醒
  3084. function KfActivityModel:GetSecKillRemindCache( )
  3085. local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,
  3086. CookieKey.SEC_KILL_NEED_REMIND) or {}
  3087. -- if list[sub_type] == nil then
  3088. -- self:SetSecKillRemindCache(sub_type, false)
  3089. -- list[sub_type] = false
  3090. -- end
  3091. return list
  3092. end
  3093. -- 购买时无需提示彩钻购买
  3094. function KfActivityModel:SetSecKillBuySureCache( sub_type, bool )
  3095. self.sec_kill_buy_sure = self.sec_kill_buy_sure or {}
  3096. if bool ~= nil then
  3097. self.sec_kill_buy_sure[sub_type] = bool
  3098. else
  3099. if self.sec_kill_buy_sure[sub_type] ~= nil then
  3100. self.sec_kill_buy_sure[sub_type] = not self.sec_kill_buy_sure[sub_type]
  3101. else
  3102. self.sec_kill_buy_sure[sub_type] = true
  3103. end
  3104. end
  3105. -- local list = self:GetSecKillBuySureCache() or {}
  3106. -- if bool ~= nil then
  3107. -- list[sub_type] = bool
  3108. -- else
  3109. -- if list[sub_type] ~= nil then
  3110. -- list[sub_type] = not list[sub_type]
  3111. -- else
  3112. -- list[sub_type] = true
  3113. -- end
  3114. -- end
  3115. -- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,
  3116. -- CookieTimeType.TYPE_ALWAYS, CookieKey.SEC_KILL_BUY_TIPS, list)
  3117. -- CookieWrapper.Instance:WriteAll()
  3118. end
  3119. function KfActivityModel:SetSecKillRemindCache( sub_type, bool )
  3120. local list = self:GetSecKillRemindCache() or {}
  3121. if bool ~= nil then
  3122. list[sub_type] = bool
  3123. else
  3124. if list[sub_type] ~= nil then
  3125. list[sub_type] = not list[sub_type]
  3126. else
  3127. list[sub_type] = false
  3128. end
  3129. end
  3130. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,
  3131. CookieTimeType.TYPE_ALWAYS, CookieKey.SEC_KILL_NEED_REMIND, list)
  3132. CookieWrapper.Instance:WriteAll()
  3133. end
  3134. --------------抢红包/福袋--start---------------
  3135. -- 处理condition数据
  3136. function KfActivityModel:SetLuckyBagData( base_type, condition_list )
  3137. local data
  3138. if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
  3139. self.red_bag_data = {}
  3140. data = self.red_bag_data
  3141. elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
  3142. self.lucky_bag_data = {}
  3143. data = self.lucky_bag_data
  3144. else
  3145. return
  3146. end
  3147. for k, v in pairs(condition_list) do
  3148. if v[1] == "open_time" then
  3149. data.open_time = {}
  3150. for i, v2 in ipairs(v[2]) do
  3151. table.insert(data.open_time, { hour = tonumber(v2[1]), min = tonumber(v2[2]) } )
  3152. end
  3153. -- 时间从小到大排序:
  3154. local sort_func = function ( a, b )
  3155. if a.hour ~= b.hour then
  3156. return a.hour < b.hour
  3157. else
  3158. return a.min < b.min
  3159. end
  3160. end
  3161. table.sort(data.open_time, sort_func)
  3162. else
  3163. data[Trim(v[1])] = tonumber(v[2])
  3164. end
  3165. end
  3166. -- logWarn('=======Msh:KfActivityModel.lua[1928]=======', base_type)
  3167. -- print('Msh:KfActivityModel.lua[1929] base_type', base_type)
  3168. -- PrintTable(condition_list)
  3169. -- PrintTable(data)
  3170. end
  3171. -- 获取数据
  3172. function KfActivityModel:GetLuckyBagDataByKey( base_type, key )
  3173. local data
  3174. if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
  3175. data = self.red_bag_data
  3176. elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
  3177. data = self.lucky_bag_data
  3178. else
  3179. return
  3180. end
  3181. if data and data[key] then
  3182. return data[key]
  3183. end
  3184. end
  3185. -- 获取今日距离下一次开启活动的时间
  3186. function KfActivityModel:GetLuckyBagNextOpenTime( base_type )
  3187. local data
  3188. if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
  3189. data = self.red_bag_data
  3190. elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
  3191. data = self.lucky_bag_data
  3192. else
  3193. return
  3194. end
  3195. if data and data.open_time then
  3196. local curTime = TimeUtil:getServerTime()
  3197. for i,v in ipairs(data.open_time) do -- 注意遍历的时间必须从小到大 如10:00 12:00 14:00
  3198. local today_open_time = TimeUtil:GetToDayNHourStr(v.hour) + v.min * 60
  3199. local remain_time = today_open_time - curTime
  3200. if remain_time > 0 then
  3201. return today_open_time
  3202. end
  3203. end
  3204. end
  3205. return -1 -- 今日已经没有场次
  3206. end
  3207. -- 获取活动状态
  3208. -- 返回值: state key_time
  3209. -- 活动已结束 0 nil
  3210. -- 活动持续中 1 活动结束时间
  3211. -- 图标开启中 2 下次开启时间
  3212. -- 准备开启图标 3 需要开启图标的时间
  3213. function KfActivityModel:GetLuckyBagActTime( base_type )
  3214. --print('Msh:KfActivityModel.lua[1988] data', base_type)
  3215. local data
  3216. if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
  3217. data = self.red_bag_data
  3218. elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
  3219. data = self.lucky_bag_data
  3220. else
  3221. return
  3222. end
  3223. if data and data.open_time then
  3224. local curTime = TimeUtil:getServerTime()
  3225. for i,v in ipairs(data.open_time) do -- 注意遍历的时间必须从小到大 如10:00 12:00 14:00
  3226. local today_open_time = TimeUtil:GetToDayNHourStr(v.hour) + v.min * 60
  3227. local ac_end_time = today_open_time + data.last_time
  3228. if ac_end_time - curTime > 0 then -- 匹配到的下一场次
  3229. local icon_open_time = today_open_time - data.show_time
  3230. --local remain_time = today_open_time - curTime
  3231. if curTime >= today_open_time then -- 活动持续中
  3232. return 1, ac_end_time
  3233. elseif curTime >= icon_open_time then -- 图标开启中
  3234. return 2, today_open_time
  3235. elseif curTime < icon_open_time then -- 准备开启图标
  3236. return 3, icon_open_time
  3237. else
  3238. -- logWarn('=======Msh:KfActivityModel.lua[2003]==error=====')
  3239. return
  3240. end
  3241. end
  3242. end
  3243. end
  3244. return 0 -- 今日已经没有场次
  3245. end
  3246. function KfActivityModel:GetShowRewardList( base_type, sub_type )
  3247. local reward_data = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type).reward_list
  3248. -- logWarn('=======Msh:KfActivityModel.lua[2024]===666====')
  3249. -- PrintTable(CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type))
  3250. local sort_func = function ( a, b )
  3251. return a.grade < b.grade
  3252. end
  3253. table.sort(reward_data, sort_func)
  3254. local res_list = {}
  3255. local show_count = 10 -- 最多展示10个奖励
  3256. for i,v in ipairs(reward_data) do
  3257. local ui_show = 0
  3258. for i2,v2 in ipairs(v.condition_list) do
  3259. if v2[1] == "ui_show" then
  3260. ui_show = tonumber(v2[2])
  3261. break
  3262. end
  3263. end
  3264. if ui_show == 1 then
  3265. table.insert(res_list, stringtotable(v.reward)[1])
  3266. show_count = show_count - 1
  3267. end
  3268. if show_count <= 0 then
  3269. break
  3270. end
  3271. end
  3272. return res_list
  3273. end
  3274. function KfActivityModel:SetLuckyBagGradeRewardData( base_type )
  3275. local reward_data = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type).reward_list
  3276. self.lucky_bag_reward_data = self.lucky_bag_reward_data or {}
  3277. self.lucky_bag_reward_data[base_type] = {}
  3278. -- local sort_func = function ( a, b )
  3279. -- return a.grade < b.grade
  3280. -- end
  3281. -- table.sort(reward_data, sort_func)
  3282. local data = self.lucky_bag_reward_data[base_type]
  3283. for i,v in ipairs(reward_data) do
  3284. local ui_show = 0
  3285. for i2,v2 in ipairs(v.condition_list) do
  3286. if v2[1] == "ui_show" then
  3287. ui_show = tonumber(v2[2])
  3288. break
  3289. end
  3290. end
  3291. data[v.grade] = {grade = v.grade, reward = stringtotable(v.reward), ui_show = ui_show}
  3292. end
  3293. end
  3294. function KfActivityModel:GetTargetGradeReward( base_type, grade )
  3295. if not (self.lucky_bag_reward_data and self.lucky_bag_reward_data[base_type]) then
  3296. self:SetLuckyBagGradeRewardData( base_type )
  3297. end
  3298. local data = self.lucky_bag_reward_data[base_type][grade]
  3299. return data
  3300. end
  3301. function KfActivityModel:SetLuckyBagLastGetTime( time )
  3302. self.last_lucky_bag_get_time = time
  3303. end
  3304. function KfActivityModel:GetLuckyBagLastGetTime( )
  3305. if self.last_lucky_bag_get_time then
  3306. return self.last_lucky_bag_get_time
  3307. else
  3308. return 0
  3309. end
  3310. end
  3311. --------------抢红包/福袋----end-------------
  3312. --------------惊喜红包----start-------------
  3313. --基础信息
  3314. function KfActivityModel:GetHappyRedBagBaseInfo( sub_type )
  3315. if sub_type then
  3316. return self.happy_red_bag_base_info[sub_type]
  3317. else
  3318. return self.happy_red_bag_base_info
  3319. end
  3320. end
  3321. function KfActivityModel:SetHappyRedBagBaseInfo( value )
  3322. self.happy_red_bag_base_info[value.sub_type] = value
  3323. self:IsNeedRed( KfActivityModel.TabID.HappyRedBag,nil,value.sub_type )
  3324. end
  3325. --全服记录
  3326. function KfActivityModel:GetHappyRedBagHistoryInfo( sub_type )
  3327. if sub_type then
  3328. return self.happy_red_bag_history_info[sub_type]
  3329. else
  3330. return self.happy_red_bag_history_info
  3331. end
  3332. end
  3333. function KfActivityModel:SetHappyRedBagHistoryInfo( value )
  3334. local function sort_call( a,b )
  3335. --从大到小
  3336. return a.time > b.time
  3337. end
  3338. if TableSize(value.log_list) > 1 then
  3339. table.sort( value.log_list, sort_call )
  3340. end
  3341. self.happy_red_bag_history_info[value.sub_type] = value.log_list
  3342. end
  3343. function KfActivityModel:GetHappyRedBagRewardById( id )
  3344. --通过id获得展示奖励列表
  3345. if not Config.Supredpacket[id] then return end
  3346. local conf = Config.Supredpacket[id]
  3347. local result = {
  3348. [1] = stringtotable(conf.mid_draw)[2],
  3349. [2] = stringtotable(conf.up_draw)[2],
  3350. [3] = stringtotable(conf.dream_draw)[2],
  3351. }
  3352. return result
  3353. end
  3354. --获得充值条件
  3355. function KfActivityModel:GetHappyRedBagNeedRechargeById( id )
  3356. if not Config.Supredpacket[id] then return 9999 end
  3357. return Config.Supredpacket[id].recharge_gold
  3358. end
  3359. --获得红包可领取状态
  3360. function KfActivityModel:GetHappyRedBagReceiveStatus( sub_type )
  3361. local data = self:GetHappyRedBagBaseInfo(sub_type)
  3362. if data then
  3363. return data.can_receive
  3364. end
  3365. end
  3366. --已经抽完次数
  3367. function KfActivityModel:IsHappyRedBagDrawMax( sub_type )
  3368. local function GetMaxTimeInPool( id )
  3369. local pool_id = false
  3370. for k,v in pairs(Config.Supredpacket) do
  3371. if v.id == id then
  3372. pool_id = v.draw_pool
  3373. break
  3374. end
  3375. end
  3376. local time = 0
  3377. for k,v in pairs(Config.Supredpacket) do
  3378. if v.draw_pool == pool_id then
  3379. time = time + 1
  3380. end
  3381. end
  3382. return time
  3383. end
  3384. local data = self:GetHappyRedBagBaseInfo(sub_type)
  3385. if data then
  3386. local time = GetMaxTimeInPool(data.id)
  3387. if data.draw_times == time and data.can_receive == 0 then
  3388. return true,time
  3389. else
  3390. return false,time
  3391. end
  3392. end
  3393. return false,0
  3394. end
  3395. function KfActivityModel:GetHappyRedBagRedDotBySubType( sub_type )
  3396. local need_lv = GetModuleOpenLevel(331,78)
  3397. local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, sub_type)
  3398. if act_info and act_info.condition then
  3399. local confition_list = stringtotable(act_info.condition)
  3400. for k,v in pairs(confition_list) do
  3401. if v[1] == "role_lv" then
  3402. need_lv = math.max( need_lv , tonumber(v[2]) )
  3403. end
  3404. end
  3405. end
  3406. local show_red = {}
  3407. if RoleManager.Instance.mainRoleInfo.level < need_lv then return show_red end
  3408. local base_data = self:GetHappyRedBagBaseInfo(sub_type)
  3409. if not base_data then return show_red end
  3410. if self:IsHappyRedBagDrawMax(sub_type) then
  3411. --抽满
  3412. return show_red
  3413. end
  3414. -------------------------
  3415. local need_recharge = self:GetHappyRedBagNeedRechargeById(base_data.id)--充值条件
  3416. if base_data and base_data.box_has_receive == 0 and base_data.draw_times >= 1 then
  3417. --判断宝箱是否可领取
  3418. show_red.box = true
  3419. end
  3420. --判断是否可以领红包(待领取奖励 or 充值达到条件且未抽取)
  3421. if base_data.can_receive == 1 then
  3422. --待领取的时候
  3423. if base_data.draw_times == 1 then
  3424. --第一次领取,需要判断是否达到充值条件
  3425. show_red.red_bag = base_data.recharge_num >= need_recharge
  3426. else
  3427. show_red.red_bag = true
  3428. end
  3429. else
  3430. --未抽取的时候,判断充值是否达到条件,或者是第一次抽取
  3431. show_red.red_bag = (base_data.recharge_num >= need_recharge) or (base_data.draw_times == 0)
  3432. end
  3433. return show_red
  3434. end
  3435. --------------惊喜红包----end-------------
  3436. --------------折扣满减----start-------------
  3437. --基础信息
  3438. function KfActivityModel:GetDiscountFullCutInfo( sub_type )
  3439. if sub_type then
  3440. return self.discount_full_cut_info[sub_type]
  3441. end
  3442. end
  3443. function KfActivityModel:SetDiscountFullCutInfo( data )
  3444. if data and data.sub_type then
  3445. self.discount_full_cut_info[data.sub_type] = data
  3446. -------------------------
  3447. --[[local temp = self.discount_full_cut_draw_free_status[data.sub_type]
  3448. if (temp and (data.free_count < temp)) then
  3449. self.discount_full_cut_draw_free_red[data.sub_type] = true
  3450. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,data.sub_type)
  3451. end
  3452. self.discount_full_cut_draw_free_status[data.sub_type] = data.free_count--]]
  3453. if self.discount_full_cut_draw_free_red[data.sub_type] ~= "has_open" then
  3454. self.discount_full_cut_draw_free_red[data.sub_type] = data.free_count == 0
  3455. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,data.sub_type)
  3456. end
  3457. end
  3458. end
  3459. --购买记录
  3460. function KfActivityModel:GetDiscountFullCutHistory( sub_type )
  3461. if sub_type then
  3462. return self.discount_full_cut_history[sub_type]
  3463. end
  3464. end
  3465. function KfActivityModel:SetDiscountFullCutHistory( data )
  3466. if data and data.sub_type then
  3467. self.discount_full_cut_history[data.sub_type] = data.list
  3468. end
  3469. end
  3470. --获取折扣券配置
  3471. function KfActivityModel:GetDiscountFullCutTicketConf( ticket_type,ticket_id )
  3472. if ticket_id then
  3473. return Config.Discountmallcoupon[ticket_id]
  3474. end
  3475. if ticket_type then
  3476. local list = {}
  3477. for k,v in pairs(Config.Discountmallcoupon) do
  3478. if v.type == ticket_type then
  3479. list[v.goods_id] = v
  3480. end
  3481. end
  3482. return list
  3483. else
  3484. return Config.Discountmallcoupon
  3485. end
  3486. end
  3487. function KfActivityModel:CheckKfDiscountFullCutRedDot( sub_type )
  3488. -------------------------
  3489. local base_type = CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT
  3490. sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  3491. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  3492. local act_type = CustomActivityModel.CustomIconActType.KfAct
  3493. local bool = false
  3494. if not self.act_red_dot_info[base_type] then
  3495. self.act_red_dot_info[base_type] = {}
  3496. end
  3497. self.act_red_dot_info[base_type][sub_type] = false
  3498. if act_list then
  3499. act_type = act_list.act_type
  3500. local server_time = TimeUtil:getServerTime( )
  3501. if server_time > act_list.stime and act_list.etime > server_time then
  3502. bool = self:GetDiscountFullCutRedDotBySubType(sub_type)
  3503. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  3504. end
  3505. end
  3506. return bool,act_type
  3507. end
  3508. function KfActivityModel:GetDiscountFullCutRedDotBySubType( sub_type )
  3509. if not sub_type then return false end
  3510. -------------------------
  3511. local need_lv = GetModuleOpenLevel(331,77)
  3512. local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT, sub_type)
  3513. if act_info and act_info.condition then
  3514. local confition_list = stringtotable(act_info.condition)
  3515. for k,v in pairs(confition_list) do
  3516. if v[1] == "role_lv" then
  3517. need_lv = math.max( need_lv , tonumber(v[2]) )
  3518. end
  3519. end
  3520. end
  3521. if RoleManager.Instance.mainRoleInfo.level < need_lv then
  3522. --等级没到
  3523. return false
  3524. end
  3525. -------------------------
  3526. local bool_1 = (not self.discount_full_cut_mask_first_open_red[sub_type])
  3527. local bool_2 = self.discount_full_cut_draw_goods_red[sub_type]
  3528. local bool_3 = self.discount_full_cut_new_red[sub_type]
  3529. local bool_4 = self.discount_full_cut_draw_free_red[sub_type] == true
  3530. return bool_1 or bool_2 or bool_3 or bool_4
  3531. end
  3532. function KfActivityModel:CheckKfDiscountFullCutGoodsChangeRedDot( )
  3533. --数量变更红点
  3534. local draw_tick_id = KfActivityModel.KfDFullCutLuckyGoodsId
  3535. local num = GoodsModel:getInstance():GetTypeGoodsNum( draw_tick_id )
  3536. if self.discount_full_cut_draw_goods_num ~= num and num > self.discount_full_cut_draw_goods_num then
  3537. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT)
  3538. for k,v in pairs(all_list) do
  3539. self.discount_full_cut_draw_goods_red[v.sub_type] = true
  3540. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,v.sub_type)
  3541. end
  3542. end
  3543. self.discount_full_cut_draw_goods_num = num
  3544. end
  3545. --活动刚开给个红点
  3546. function KfActivityModel:AddKfDiscountFullCutNewOpenRedDot( sub_type,bool )
  3547. if not sub_type then return end
  3548. self.discount_full_cut_new_red[sub_type] = bool
  3549. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
  3550. end
  3551. --开界面红点处理
  3552. function KfActivityModel:AddKfDiscountFullCutMaskFirstOpenRedDot( sub_type,bool )
  3553. if not sub_type then return end
  3554. self.discount_full_cut_mask_first_open_red[sub_type] = bool
  3555. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
  3556. end
  3557. --开抽奖界面消抽奖券红点
  3558. function KfActivityModel:AddKfDiscountFullCutMaskGoodsRedDot( sub_type )
  3559. if not sub_type then return end
  3560. self.discount_full_cut_draw_goods_red[sub_type] = false
  3561. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
  3562. end
  3563. --开抽奖界面消免费红点
  3564. function KfActivityModel:AddKfDiscountFullCutMaskFreeRedDot( sub_type )
  3565. do return end--以前免费红点是一次性的,现在不是了
  3566. -------------------------
  3567. if not sub_type then return end
  3568. self.discount_full_cut_draw_free_red[sub_type] = "has_open"
  3569. self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
  3570. end
  3571. --设置折扣满减奖池数据
  3572. function KfActivityModel:SetDiscountFullCutLuckyTableList( vo )
  3573. if vo and vo.sub_type then
  3574. self.discount_full_cut_lucky_list[vo.sub_type] = vo.goods_list
  3575. end
  3576. end
  3577. --获得折扣满减奖池数据
  3578. function KfActivityModel:GetDiscountFullCutLuckyTableList( sub_type )
  3579. return self.discount_full_cut_lucky_list[sub_type]
  3580. end
  3581. --------------折扣满减----end--------------
  3582. --------------阶段兑换----start--------------
  3583. function KfActivityModel:CheckStageExchangeGoodsChangeRedDot( )
  3584. --道具变更红点检查
  3585. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE)
  3586. for k,v in pairs(all_list) do
  3587. self:IsNeedRed(KfActivityModel.TabID.StageExchange,nil,v.sub_type)
  3588. end
  3589. end
  3590. function KfActivityModel:GetStageExchangeRedDotBySubType( sub_type )
  3591. --活动开启首次登陆红点
  3592. local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.STAGE_EXCHANGE_RED) or {}
  3593. if not red_first_data[sub_type] then
  3594. -------------------------
  3595. --没开过界面
  3596. return true
  3597. end
  3598. -------------------------
  3599. local check_price_list = false--当前要比价用的
  3600. --阶段开启奖励可临取时,临取按钮红点提示
  3601. local operate_model = OperateActivityModel:getInstance()
  3602. local base_data = operate_model:GetStageExchangeInfo(sub_type)
  3603. if not base_data then return false end
  3604. local unlock_phase = operate_model:GetStageExchangeUnlockPhase(sub_type)
  3605. local open_reward_status = 0
  3606. for i,v in ipairs(base_data) do
  3607. if v.phase == unlock_phase then
  3608. open_reward_status = v.open_reward_status
  3609. check_price_list = DeepCopy(v.goods_list or {})
  3610. break
  3611. end
  3612. end
  3613. if open_reward_status == 1 then
  3614. return true
  3615. end
  3616. -------------------------
  3617. local cost_id = operate_model:GetStageExchangeCostId( sub_type )
  3618. local goods_num = GoodsModel:getInstance():GetTypeGoodsNum( cost_id )
  3619. -------------------------
  3620. --价格为0,可买,阶段商店页签红点提示
  3621. for k,v in pairs(check_price_list) do
  3622. if v.cost_goods_num == 0 and v.exchange_num < v.limit_num then
  3623. return true
  3624. end
  3625. end
  3626. --玩家道具总额足够兑换本阶段商店最高价道具时,阶段商店页签红点提示
  3627. --获取价格列表
  3628. local function sort_call( a,b )
  3629. --从大到小
  3630. return a.cost_goods_num > b.cost_goods_num
  3631. end
  3632. table.sort( check_price_list, sort_call )
  3633. for i,v in pairs(check_price_list) do
  3634. if v.exchange_num < v.limit_num then
  3635. --最高价位
  3636. return goods_num >= v.cost_goods_num
  3637. end
  3638. end
  3639. return false
  3640. end
  3641. --新活动开启 or 奖池因玩家升级引起刷新,红点变化
  3642. function KfActivityModel:MaskStageExchangeOpenRedDot( sub_type )
  3643. local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.STAGE_EXCHANGE_RED) or {}
  3644. if not data[sub_type] then
  3645. data[sub_type] = true
  3646. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.STAGE_EXCHANGE_RED,data)
  3647. CookieWrapper.Instance:WriteAll()
  3648. self:IsNeedRed(KfActivityModel.TabID.StageExchange,nil,sub_type)
  3649. end
  3650. end
  3651. --------------阶段兑换----end--------------
  3652. --获得通用排行排名数据
  3653. function KfActivityModel:GetComRankCfg( type_key )
  3654. return self.com_rank_score_cfg[type_key]
  3655. end
  3656. --设置通用结算排行数据
  3657. function KfActivityModel:SetComRankInfo( vo )
  3658. local new_rank_list = {}
  3659. for k,v in pairs(vo.rank_list) do
  3660. new_rank_list[v.rank] = v
  3661. end
  3662. vo.rank_list = new_rank_list
  3663. self.com_rank_info[vo.sub_type] = vo
  3664. end
  3665. --获得通用结算排行数据
  3666. function KfActivityModel:GetComRankInfo( sub_type )
  3667. return self.com_rank_info[sub_type]
  3668. end
  3669. function KfActivityModel:CheckComRankTabIsOpen( sub_type )
  3670. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.COM_RANK,sub_type)
  3671. if act_list then
  3672. local show_time = 0
  3673. for k,v in pairs(act_list.condition_list) do
  3674. if v[1] == "show_time" then
  3675. show_time = tonumber(v[2])
  3676. break
  3677. end
  3678. end
  3679. local server_time = TimeUtil:getServerTime( )
  3680. local end_time = act_list.etime + show_time
  3681. if server_time > act_list.stime and end_time > server_time then
  3682. return true
  3683. end
  3684. end
  3685. return false
  3686. end
  3687. --------------源晶复制机----start--------------
  3688. --是否需要显示源晶复制机按钮
  3689. function KfActivityModel:IsShowMoneyCopy( type_tag )
  3690. return false
  3691. end
  3692. function KfActivityModel:GetMoneyCopyData( sub_type )
  3693. return self.money_copy_data[sub_type]
  3694. end
  3695. function KfActivityModel:SetMoneyCopyData( data )
  3696. self.money_copy_data[data.sub_type] = data
  3697. end
  3698. --通过标记获取活动子类
  3699. function KfActivityModel:GetMoneyCopySubTypeByTag( tag )
  3700. local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
  3701. local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
  3702. local show_place = false
  3703. for k,v in pairs(sub_type_list) do
  3704. show_place = false
  3705. for kk,vv in pairs(v.condition_list) do
  3706. if vv[1] == "show_place" then
  3707. show_place = vv[2]
  3708. end
  3709. end
  3710. if show_place then
  3711. if tag == "chargeplus" and show_place == "chargeplus" then
  3712. --首充追加界面
  3713. return v.sub_type
  3714. end
  3715. elseif tag == "charge" then
  3716. --普通充值界面用的
  3717. return v.sub_type
  3718. end
  3719. end
  3720. return false
  3721. end
  3722. --获取是否在活动时间内,返回开始时间和活动时间
  3723. function KfActivityModel:IsInMoneyCopyTime( sub_type )
  3724. local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
  3725. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  3726. if act_list then
  3727. -------------------------
  3728. local need_lv = GetModuleOpenLevel(331,5)
  3729. local confition_list = stringtotable(act_list.condition)
  3730. for k,v in pairs(confition_list) do
  3731. if v[1] == "role_lv" then
  3732. need_lv = math.max( need_lv , tonumber(v[2]) )
  3733. end
  3734. end
  3735. if need_lv > RoleManager.Instance.mainRoleInfo.level then
  3736. --等级不足
  3737. return false,0,0
  3738. end
  3739. -------------------------
  3740. local show_type = false
  3741. for k,v in pairs(act_list.condition_list) do
  3742. if v[1] == "show_place" then
  3743. show_type = v[2]
  3744. break
  3745. end
  3746. end
  3747. local server_time = TimeUtil:getServerTime( )
  3748. if show_type then
  3749. local base_data = self:GetMoneyCopyData( sub_type )
  3750. if base_data and base_data.stime > 0 and base_data.etime > 0 then
  3751. return (server_time > base_data.stime and base_data.etime > server_time), base_data.stime, base_data.etime
  3752. else
  3753. return false,0,0
  3754. end
  3755. else
  3756. return (server_time > act_list.stime and act_list.etime > server_time), act_list.stime, act_list.etime
  3757. end
  3758. end
  3759. return false,0,0
  3760. end
  3761. --获取红点
  3762. function KfActivityModel:IsMoneyCopyRedByTag( tag )
  3763. local sub_type = self:GetMoneyCopySubTypeByTag(tag)
  3764. if sub_type then
  3765. return self:IsMoneyCopyRedBySubType( sub_type )
  3766. end
  3767. return false
  3768. end
  3769. function KfActivityModel:IsMoneyCopyRedBySubType( sub_type )
  3770. local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
  3771. sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  3772. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  3773. if act_list then
  3774. local in_time = self:IsInMoneyCopyTime(sub_type)
  3775. if in_time then
  3776. --活动期内才需要红点了
  3777. local base_data = self:GetMoneyCopyData(sub_type)
  3778. if base_data and base_data.total > 0 then
  3779. local cur_time_tb = os.date( '*t' ,TimeUtil:getServerTime())
  3780. local last_time_tb = os.date( '*t' ,base_data.last_time)
  3781. if last_time_tb.day ~= cur_time_tb.day or last_time_tb.month ~= cur_time_tb.month then
  3782. return true
  3783. end
  3784. end
  3785. end
  3786. end
  3787. return false
  3788. end
  3789. --------------源晶复制机----end--------------
  3790. --------------黑白棋----start--------------
  3791. function KfActivityModel:GetReversiRedDotBySubType( sub_type )
  3792. --活动开启首次登陆红点
  3793. local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.REVERSI_RED) or {}
  3794. if not red_first_data[sub_type] then
  3795. -------------------------
  3796. --没开过界面
  3797. return true
  3798. end
  3799. -- 当玩家有免费抽奖次数时
  3800. local bool_red = self:GetReversiFreeDrawRed(sub_type)
  3801. bool_red = bool_red or self:GetReversiFreeRreshRed(sub_type)
  3802. if not bool_red then
  3803. local base_type = CustomActivityModel.CustomActBaseType.REVERSI
  3804. local free_buff_kind = OperateActivityModel.MaterialSubmitBuffKind.ACT_LUCKY_FREE --是否存在活动加成buff 首次抽奖免费
  3805. local free_buff_cfg,free_buff_info = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(free_buff_kind)
  3806. local buff_free_times = 0
  3807. if free_buff_cfg and free_buff_info then
  3808. local sec = free_buff_info.etime - TimeUtil:getServerTime( )
  3809. if sec > 0 then
  3810. self:ActReversiBuffTimeLate(sec,sub_type)
  3811. buff_free_times = free_buff_cfg.data
  3812. for k,v in pairs(free_buff_info.used) do
  3813. if v.kdata == base_type then--十连还有次数
  3814. buff_free_times = buff_free_times - v.vdata
  3815. break
  3816. end
  3817. end
  3818. if buff_free_times > 0 then
  3819. bool_red = true
  3820. end
  3821. end
  3822. end
  3823. end
  3824. return bool_red
  3825. -- 当奖池刷新(玩家升级导致)时候
  3826. end
  3827. --黑白棋活动BUFF时间倒计时
  3828. function KfActivityModel:ActReversiBuffTimeLate( sub_type )
  3829. if self.act_reversi_buff_timer_id then
  3830. GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
  3831. self.act_reversi_buff_timer_id = nil
  3832. end
  3833. if self.reversi_act_sec and self.reversi_act_sec >= sec then
  3834. return
  3835. else
  3836. self.reversi_act_sec = sec
  3837. end
  3838. local sec = sec or 0
  3839. if sec > 0 then
  3840. local function onTimer()
  3841. sec = sec - 1
  3842. if sec > 0 then
  3843. else
  3844. if self.act_reversi_buff_timer_id then
  3845. GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
  3846. self.act_reversi_buff_timer_id = nil
  3847. end
  3848. KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
  3849. end
  3850. end
  3851. if not self.act_reversi_buff_timer_id then
  3852. self.act_reversi_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
  3853. end
  3854. onTimer()
  3855. else
  3856. if self.act_reversi_buff_timer_id then
  3857. GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
  3858. self.act_reversi_buff_timer_id = nil
  3859. end
  3860. KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
  3861. end
  3862. end
  3863. --免费抽奖次数
  3864. function KfActivityModel:GetReversiFreeDrawRed( sub_type )
  3865. local data = OperateActivityModel:getInstance():GetReversiInfo( sub_type )
  3866. return data and data.free_times > 0
  3867. end
  3868. --当玩家能够免费刷新奖池时
  3869. function KfActivityModel:GetReversiFreeRreshRed( sub_type )
  3870. local data = OperateActivityModel:getInstance():GetReversiCurInfo(sub_type)
  3871. if not data then return false end
  3872. local open_num = 0
  3873. for k,v in pairs(data) do
  3874. if v.status == 1 then
  3875. open_num = open_num + 1
  3876. end
  3877. end
  3878. return open_num >= 16
  3879. end
  3880. function KfActivityModel:MaskReversiOpenRedDot( sub_type,bool )
  3881. local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.REVERSI_RED) or {}
  3882. if data[sub_type] ~= bool then
  3883. data[sub_type] = bool
  3884. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.REVERSI_RED,data)
  3885. CookieWrapper.Instance:WriteAll()
  3886. self:IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
  3887. end
  3888. end
  3889. --------------黑白棋----end--------------
  3890. --------------活动幻魔----start--------------
  3891. function KfActivityModel:GetFestivalBossRedDotBySubType( sub_type )
  3892. --活动开启首次登陆红点
  3893. local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.FESTIVAL_BOSS_RED) or {}
  3894. if not red_first_data[sub_type] then
  3895. -------------------------
  3896. --没开过界面
  3897. return true
  3898. end
  3899. return false
  3900. end
  3901. function KfActivityModel:MaskFestivalBossOpenRedDot( sub_type,bool )
  3902. local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.FESTIVAL_BOSS_RED) or {}
  3903. if data[sub_type] ~= bool then
  3904. data[sub_type] = bool
  3905. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.FESTIVAL_BOSS_RED,data)
  3906. CookieWrapper.Instance:WriteAll()
  3907. self:IsNeedRed(KfActivityModel.TabID.FestivalBoss,nil,sub_type)
  3908. end
  3909. end
  3910. --------------活动幻魔----end--------------
  3911. --------------活跃/登陆 通行证----start--------------
  3912. --活跃/登陆 通行证信息
  3913. function KfActivityModel:GetPassActInfo( act_type,sub_type )
  3914. if self.pass_act_info[act_type] then
  3915. return self.pass_act_info[act_type][sub_type] or false
  3916. end
  3917. return false
  3918. end
  3919. function KfActivityModel:SetPassActInfo( value )
  3920. if value then
  3921. local function sort_call( a,b )
  3922. return a.need < b.need
  3923. end
  3924. table.sort( value.reward_list, sort_call )
  3925. self.pass_act_info[value.act_type] = self.pass_act_info[value.act_type] or {}
  3926. self.pass_act_info[value.act_type][value.sub_type] = value
  3927. self:IsNeedRed(self:ByActTypeGetTabId( value.act_type ),nil,value.sub_type)
  3928. end
  3929. end
  3930. --活跃/登陆 通行证奖励信息
  3931. function KfActivityModel:GetPassActRewardInfo( act_type,sub_type )
  3932. if self.pass_act_reward_info[act_type] then
  3933. return self.pass_act_reward_info[act_type][sub_type] or false
  3934. end
  3935. return false
  3936. end
  3937. function KfActivityModel:SetPassActRewardInfo( value )
  3938. if value then
  3939. local function sort_call( a,b )
  3940. return a.need < b.need
  3941. end
  3942. table.sort( value.reward_list, sort_call )
  3943. self.pass_act_reward_info[value.act_type] = self.pass_act_reward_info[value.act_type] or {}
  3944. self.pass_act_reward_info[value.act_type][value.sub_type] = value
  3945. end
  3946. end
  3947. function KfActivityModel:GetPassActCurLvSelect( act_type,sub_type )
  3948. if act_type == CustomActivityModel.CustomActBaseType.LOGIN_PASS then
  3949. local base_data = self:GetPassActInfo(act_type,sub_type)
  3950. local cur_active = base_data and base_data.active or 1
  3951. if base_data then
  3952. --判断一下是不是全都到期了,到期了就取第一个可未领的
  3953. local award_data = self:GetPassActRewardInfo(act_type,sub_type)
  3954. local max_grade = award_data and #award_data.reward_list or false
  3955. if (cur_active > max_grade) then
  3956. for i,v in ipairs(base_data.reward_list) do
  3957. if v.normal_status~=2 or v.extra_status ~= 2 then
  3958. cur_active = v.grade
  3959. break
  3960. end
  3961. end
  3962. end
  3963. end
  3964. return cur_active
  3965. elseif act_type == CustomActivityModel.CustomActBaseType.LIVELY_PASS then
  3966. --获取最低可领取的奖励段
  3967. --最低不可领取的
  3968. --最大奖励点
  3969. local cur_active = false--普通最低可操作档位
  3970. local base_data = self:GetPassActInfo(act_type,sub_type)
  3971. if base_data then
  3972. for i,v in ipairs(base_data.reward_list) do
  3973. if v.normal_status~=2 then
  3974. cur_active = v.grade
  3975. break
  3976. end
  3977. end
  3978. return cur_active or 1--貌似也不需要,直接选第一个
  3979. --[[if not cur_active then
  3980. --没有那么就要考虑显示最高基本 or 第一个
  3981. local max_grade = 0
  3982. local min_grade = 9999
  3983. local temp = self:GetPassActRewardInfo( act_type,sub_type )
  3984. if temp and temp.reward_list then
  3985. for k,v in pairs(temp.reward_list) do
  3986. max_grade = max_grade < v.grade and v.grade or max_grade
  3987. min_grade = min_grade > v.grade and v.grade or min_grade
  3988. end
  3989. return base_data.is_pay == 1 and max_grade or min_grade
  3990. end
  3991. end--]]
  3992. end
  3993. end
  3994. return 1
  3995. end
  3996. function KfActivityModel:GetPassActRewardStatus( act_type,sub_type,grade )
  3997. local basic = self:GetPassActInfo(act_type,sub_type)
  3998. if not basic then return 0,0 end
  3999. local cur_data = false
  4000. for k,v in pairs(basic.reward_list) do
  4001. if v.grade == grade then
  4002. cur_data = v
  4003. break
  4004. end
  4005. end
  4006. if cur_data then
  4007. return cur_data.normal_status,cur_data.extra_status
  4008. else
  4009. return 0,0
  4010. end
  4011. end
  4012. function KfActivityModel:PassActChangeRewardStatus( act_type,sub_type,grade,reward_opty )
  4013. local base_data = self:GetPassActInfo(act_type,sub_type)
  4014. if (not base_data) then return end
  4015. local have_set = false
  4016. for k,v in pairs(base_data.reward_list) do
  4017. if v.grade == grade then
  4018. if reward_opty == 1 then
  4019. v.normal_status = 2
  4020. have_set = true
  4021. elseif reward_opty == 2 then
  4022. v.extra_status = 2
  4023. have_set = true
  4024. elseif reward_opty == 3 then
  4025. v.normal_status = 2
  4026. v.extra_status = 2
  4027. have_set = true
  4028. end
  4029. end
  4030. end
  4031. if not have_set then
  4032. return false
  4033. else
  4034. self:IsNeedRed(self:ByActTypeGetTabId( act_type ),nil,sub_type)
  4035. end
  4036. end
  4037. --通用通行证红点
  4038. function KfActivityModel:CheckComPassRedDot( base_type,sub_type )
  4039. local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
  4040. local act_type = CustomActivityModel.CustomIconActType.KfAct
  4041. if not act_list then return false,act_type end
  4042. local bool = false
  4043. if not self.act_red_dot_info[base_type] then
  4044. self.act_red_dot_info[base_type] = {}
  4045. end
  4046. self.act_red_dot_info[base_type][sub_type] = false
  4047. -------------------------
  4048. local open_level = Config.Modulesub["331@" .. base_type] and Config.Modulesub["331@" .. base_type].open_lv or 1
  4049. for l,w in pairs(act_list.condition_list) do
  4050. if type(w) == "table" and w[1] == "role_lv" then
  4051. open_level = tonumber(w[2])
  4052. end
  4053. end
  4054. if RoleManager.Instance.mainRoleInfo.level >= open_level then
  4055. local server_time = TimeUtil:getServerTime( )
  4056. if act_list and server_time > act_list.stime and act_list.etime > server_time then
  4057. act_type = act_list.act_type
  4058. bool = self:GetComPassRedDotBySubType(base_type,sub_type)
  4059. self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
  4060. end
  4061. else
  4062. self.check_lv_act_open = self.check_lv_act_open or {}
  4063. self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
  4064. self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
  4065. self.check_lv_act_open[open_level][base_type][sub_type] = true
  4066. end
  4067. return bool,act_type
  4068. end
  4069. function KfActivityModel:GetComPassRedDotBySubType( base_type,sub_type )
  4070. local base_data = self:GetPassActInfo(base_type,sub_type)
  4071. if base_data then
  4072. for k,v in pairs(base_data.reward_list) do
  4073. if v.normal_status == 1 or v.extra_status == 1 then
  4074. return true
  4075. end
  4076. end
  4077. end
  4078. return false
  4079. end
  4080. --------------活跃/登陆 通行证----end--------------
  4081. --构建抢购商城小弹窗信息
  4082. function KfActivityModel:GetRushQuickBuy( goods_id )
  4083. local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
  4084. local sub_type = CustomActivityModel:getInstance():getActMinSubType(base_type)
  4085. if not sub_type then return end
  4086. local server_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
  4087. if not server_data then return end
  4088. local info_list = server_data.reward_list
  4089. if not info_list or not TableSize(info_list) == 0 then return end
  4090. local level = RoleManager.Instance.mainRoleInfo.level
  4091. local item_list = {}
  4092. for i,v in ipairs(info_list) do
  4093. if #v.reward_info == 1 and (v.reward_info[1].goods_id == goods_id or not goods_id) then
  4094. local lv_can = true
  4095. local num_can = true
  4096. for k,vv in pairs(v.condition_list) do
  4097. if vv[1] == "show_level_range" then
  4098. if level < tonumber(vv[2]) or level > tonumber(vv[3]) then
  4099. lv_can = false
  4100. end
  4101. elseif vv[1] == "limit_times" then
  4102. num_can = tonumber(vv[2]) - v.progress > 0
  4103. end
  4104. end
  4105. if lv_can and num_can then
  4106. --符合等级,符合数量条件
  4107. item_list[#item_list + 1] = v
  4108. end
  4109. end
  4110. end
  4111. -------------------------
  4112. if #item_list > 0 then
  4113. return item_list
  4114. end
  4115. end
  4116. -- 判断是否需要展示广告
  4117. function KfActivityModel:CheckFosterRechargeAdsShow( show_type, grade )
  4118. local bool = false
  4119. if not RechargeActivityModel:getInstance():IsRecharge( ) then
  4120. local open_server_day = ServerTimeModel:getInstance():GetOpenServerDay()
  4121. local cfg = KfActivityConst.FosterRechargeData[show_type]
  4122. if cfg and cfg.opday_lim[1] <= open_server_day and cfg.opday_lim[2] >= open_server_day -- 天数
  4123. and cfg.grade[1] <= grade and cfg.grade[2] >= grade then -- 阶数
  4124. bool = true
  4125. end
  4126. end
  4127. return bool
  4128. end
  4129. --设置小额连充信息
  4130. function KfActivityModel:SetKfContinueInfo( vo )
  4131. local can_resign_time = math.floor(vo.total/KfActivityModel.ContinueSignRechargePrice)--可以补签的数量
  4132. vo.can_resign_time = can_resign_time - vo.resign
  4133. --离下一个补签需要充值多少
  4134. vo.offer_price = math.ceil(vo.total/KfActivityModel.ContinueSignRechargePrice) * KfActivityModel.ContinueSignRechargePrice - vo.total
  4135. if vo.offer_price == 0 and vo.can_resign_time == 0 then
  4136. vo.offer_price = KfActivityModel.ContinueSignRechargePrice
  4137. end
  4138. self.kf_continue_info[vo.sub_type] = vo
  4139. self:IsNeedRed(KfActivityModel.TabID.ContinueRecharge,nil,vo.sub_type)
  4140. end
  4141. --获得小额连充补签信息
  4142. function KfActivityModel:GetKfContinueInfo( sub_type )
  4143. return self.kf_continue_info[sub_type]
  4144. end
  4145. ----------活动引导-998-start--------
  4146. -- 设置缓存
  4147. function KfActivityModel:SetActGuideCache( data )
  4148. self.act_guide_cache = self.act_guide_cache or {}
  4149. for l,w in pairs(data.condition_list) do
  4150. if w[1] == "role_lv" then -- 升级时弹(运营同一个等级会配很多个东西,所以存成表)
  4151. self.act_guide_cache.role_lv = self.act_guide_cache.role_lv or {}
  4152. self.act_guide_cache.role_lv[tonumber(w[2])] = self.act_guide_cache.role_lv[tonumber(w[2])] or {}
  4153. table.insert(self.act_guide_cache.role_lv[tonumber(w[2])], data.sub_type) -- 记录一下这个等级
  4154. elseif w[1] == "foster" then --进阶成功时弹
  4155. self.act_guide_cache.foster = self.act_guide_cache.foster or {}
  4156. local temp = {
  4157. [1] = data.sub_type,
  4158. [2] = tonumber(w[2]),
  4159. [3] = tonumber(w[3]),
  4160. [4] = tonumber(w[4]),
  4161. }
  4162. table.insert(self.act_guide_cache.foster, temp)
  4163. elseif w[1] == "end_foster" then
  4164. self.act_guide_cache.end_foster = self.act_guide_cache.end_foster or {}
  4165. local temp = {
  4166. [1] = data.sub_type,
  4167. [2] = tonumber(w[2]),
  4168. [3] = tonumber(w[3]),
  4169. [4] = tonumber(w[4]),
  4170. }
  4171. table.insert(self.act_guide_cache.end_foster, temp)
  4172. elseif w[1] == "type" then
  4173. data.type = tonumber(w[2])
  4174. elseif w[1] == "good" then
  4175. data.good = tonumber(w[2])
  4176. end
  4177. end
  4178. end
  4179. -- 检查是否需要弹出活动引导
  4180. function KfActivityModel:CheckNeedShowActGuide( check_key, check_value)
  4181. if not check_key or not check_value or not self.act_guide_cache or not self.act_guide_cache[check_key] then
  4182. return
  4183. end
  4184. local sub_type = false
  4185. if check_key == "role_lv" then
  4186. if self.act_guide_cache.role_lv[check_value] then
  4187. sub_type = self.act_guide_cache.role_lv[check_value] -- 这是个表
  4188. end
  4189. elseif check_key == "foster" then
  4190. sub_type = sub_type or {}
  4191. for k,v in pairs(self.act_guide_cache[check_key]) do
  4192. if check_value[1] == v[2] and check_value[2] == v[3] and check_value[3] == v[4] then
  4193. table.insert(sub_type, v[1])
  4194. -- sub_type = v[1]
  4195. end
  4196. end
  4197. elseif check_key == "end_foster" then
  4198. sub_type = sub_type or {}
  4199. --print('=======Msh:KfActivityModel.lua[4448] ===TABLE====')
  4200. --PrintTable(self.act_guide_cache[check_key])
  4201. for k,v in pairs(self.act_guide_cache[check_key]) do
  4202. if check_value[1] == v[2] and
  4203. not ((check_value[2] == v[3] and check_value[3] >= v[4] ) or
  4204. (check_value[2] > v[3])) then
  4205. table.insert(sub_type, v[1])
  4206. end
  4207. end
  4208. return sub_type -- 不需要打开界面
  4209. end
  4210. -- print('=======Msh:KfActivityModel.lua[4428] ===TABLE====')
  4211. -- PrintTable(self.act_guide_cache)
  4212. if sub_type and type(sub_type) == "table" then
  4213. --print('=======Msh:KfActivityModel.lua[4431] ===TABLE====')
  4214. --PrintTable(sub_type)
  4215. for i,v in pairs(sub_type) do
  4216. --print('=======Msh:KfActivityModel.lua[4432] ==打开冲=====', data)
  4217. self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, v)
  4218. end
  4219. elseif sub_type then
  4220. print('=======Msh:KfActivityModel.lua[4439] ===TABLE====', sub_type)
  4221. PrintTable(self.act_guide_cache[check_key])
  4222. self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, sub_type)
  4223. end
  4224. end
  4225. function KfActivityModel:ResetActGuideCache( )
  4226. local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
  4227. if self.act_guide_cache and self.act_guide_cache.open_day and self.act_guide_cache.open_day == open_day then
  4228. return
  4229. end
  4230. self.act_guide_cache = {open_day = open_day}
  4231. end
  4232. -- 检测新获得的物品是否是直升丹需要展示 (这里是不走活动协议的)
  4233. function KfActivityModel:IsAddActGuideList( goods_vo )
  4234. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_vo.type_id)
  4235. if basic.subtype == 24 or basic.subtype == 16 then -- 等级直升丹/进阶直升丹
  4236. local bag_goods_dic = GoodsModel:getInstance():GetBagGoodsDic()
  4237. local bag_good_vo = bag_goods_dic[goods_vo.goods_id]
  4238. self.act_guide_add_goods_list = self.act_guide_add_goods_list or {}
  4239. --背包本来没有
  4240. if not bag_good_vo then
  4241. --道具增加
  4242. if goods_vo.goods_num > 0 then
  4243. local copy_new_vo = DeepCopy(goods_vo)
  4244. table.insert(self.act_guide_add_goods_list, copy_new_vo)
  4245. end
  4246. else
  4247. --道具变更,并且增加
  4248. if goods_vo.goods_num > bag_good_vo.goods_num then
  4249. local copy_new_vo = DeepCopy(goods_vo)
  4250. table.insert(self.act_guide_add_goods_list, copy_new_vo)
  4251. end
  4252. end
  4253. end
  4254. end
  4255. -- 检查是否需要弹出直升丹的推荐使用
  4256. function KfActivityModel:CheckActGuideNeedShow( need_close )
  4257. if self.act_guide_add_goods_list and TableSize(self.act_guide_add_goods_list) > 0 then
  4258. -- local data = table.remove(self.act_guide_add_goods_list, 1)
  4259. -- print('=======Msh:KfActivityModel.lua[4481] ===打开界面====')
  4260. self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, nil, nil, true)
  4261. elseif need_close then -- 关闭界面
  4262. -- print('=======Msh:KfActivityModel.lua[4483] =====关界面==')
  4263. -- PrintCallStack()
  4264. self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, nil, true, true)
  4265. end
  4266. end
  4267. function KfActivityModel:GetActGuideAddGoodsData( )
  4268. if self.act_guide_add_goods_list and TableSize(self.act_guide_add_goods_list) > 0 then
  4269. return table.remove(self.act_guide_add_goods_list, 1)
  4270. end
  4271. end
  4272. -- 只靠物品id打开推荐使用
  4273. function KfActivityModel:ShowActGuideUseByGoodsID( goods_id )
  4274. local goods_vo = {
  4275. type_id = goods_id,
  4276. }
  4277. self.act_guide_add_goods_list = self.act_guide_add_goods_list or {}
  4278. table.insert(self.act_guide_add_goods_list, goods_vo)
  4279. self:CheckActGuideNeedShow()
  4280. end
  4281. -- 每次登陆缓存一下是否看过某进阶系统的直升按钮
  4282. function KfActivityModel:CheckFosterActGuideEffectShow( show_type )
  4283. self.foster_act_guide_btn_cache = self.foster_act_guide_btn_cache or {}
  4284. return self.foster_act_guide_btn_cache[show_type]
  4285. end
  4286. -- 记录已经看过的缓存
  4287. function KfActivityModel:SetFosterActGuideBtnCache( show_type )
  4288. self.foster_act_guide_btn_cache = self.foster_act_guide_btn_cache or {}
  4289. self.foster_act_guide_btn_cache[show_type] = true
  4290. end
  4291. function KfActivityModel:ResetFosterActGuideBtnCache( )
  4292. self.foster_act_guide_btn_cache = {}
  4293. end
  4294. -- 记录需要播放高层级升级特效标志
  4295. function KfActivityModel:SetIsNeedTopEffect( bool )
  4296. self.act_guide_is_need_top_effect = bool
  4297. end
  4298. -- 获取特效标志
  4299. function KfActivityModel:GetIsNeedTopEffect( )
  4300. return self.act_guide_is_need_top_effect
  4301. end
  4302. ----------活动引导-998-end-----------
  4303. --获得上榜条件最大限制
  4304. function KfActivityModel:GetRushRankMaxLimit( rank_type )
  4305. local max_rank_limit = 30
  4306. local rank_cfg = self:GetRushRankAwardCfg(rank_type) or {}
  4307. for i,v in ipairs(rank_cfg) do
  4308. max_rank_limit = max_rank_limit < v.rank_max and v.rank_max or max_rank_limit
  4309. end
  4310. return max_rank_limit
  4311. end