源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

4580 lines
172 KiB

KfActivityModel = KfActivityModel or BaseClass(BaseVo, true)
local KfActivityModel = KfActivityModel
KfActivityModel.REQUEST_INFO = "KfActivityModel.REQUEST_INFO"
KfActivityModel.OPEN_ACTIVITY_BASE_VIEW = "KfActivityModel.OPEN_ACTIVITY_BASE_VIEW"--打开主界面
KfActivityModel.UPDATE_ACTIVITY_BASE_VIEW = "KfActivityModel.UPDATE_ACTIVITY_BASE_VIEW"--更新主界面
KfActivityModel.OPEN_RANK_SHOW_VIEW = "KfActivityModel.OPEN_RANK_SHOW_VIEW"--打开往期排行
KfActivityModel.OPEN_RANK_RE_CB_VIEW = "KfActivityModel.OPEN_RANK_RE_CB_VIEW"--冲榜升级变强途径
KfActivityModel.REQUEST_INFO = "KfActivityModel.REQUEST_INFO"--请求协议
KfActivityModel.ANS_UPDATE_VIEW = "KfActivityModel.ANS_UPDATE_VIEW"--更新界面
KfActivityModel.UPDATE_ZERO_GIFT_VIEW = "KfActivityModel.UPDATE_ZERO_GIFT_VIEW"--更新0元礼包界面
KfActivityModel.UPDATE_GROUP_BUYING_VIEW = "KfActivityModel.UPDATE_GROUP_BUYING_VIEW"--更新开服团购界面
KfActivityModel.OPEN_GROUP_BUYING_SHARE_VIEW = "KfActivityModel.OPEN_GROUP_BUYING_SHARE_VIEW"--打开团购分享界面
KfActivityModel.MONOPOLY_DICE_ACTION_START = "KfActivityModel.MONOPOLY_DICE_ACTION_START"--开始大富翁骰子动画
KfActivityModel.MONOPOLY_DICE_ACTION_STOP = "KfActivityModel.MONOPOLY_DICE_ACTION_STOP"--停止大富翁骰子动画
KfActivityModel.UPDATE_LIMIT_SECKILL_INFO ="KfActivityModel.UPDATE_LIMIT_SECKILL_INFO" -- 更新秒杀数据
KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO ="KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO" -- 更新秒杀场次数据
KfActivityModel.OPEN_LIMIT_SECKILL_BUY_VIEW ="KfActivityModel.OPEN_LIMIT_SECKILL_BUY_VIEW" -- 打开限时秒杀购买界面
KfActivityModel.LIMIT_SECKILL_BUY_SUCCESS ="KfActivityModel.LIMIT_SECKILL_BUY_SUCCESS" -- 抢购成功
KfActivityModel.OPEN_SCRAOING_CARD_TIPS_VIEW_VIEW ="KfActivityModel.OPEN_SCRAOING_CARD_TIPS_VIEW_VIEW" -- 打开刮刮卡刮奖
KfActivityModel.UPDATE_HAPPY_RED_BAG_INFO ="KfActivityModel.UPDATE_HAPPY_RED_BAG_INFO" -- 更新惊喜红包数据
KfActivityModel.ANS_DRAW_HAPPY_RED_BAG ="KfActivityModel.ANS_DRAW_HAPPY_RED_BAG" -- 抽取惊喜红包
KfActivityModel.UPDATE_HAPPY_RED_BAG_HISTORY ="KfActivityModel.UPDATE_HAPPY_RED_BAG_HISTORY" -- 惊喜红包全服记录
KfActivityModel.ANS_DISCOUNT_FULL_CUT_INFO = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_INFO" -- 折扣满减数据
KfActivityModel.ANS_DISCOUNT_FULL_CUT_HISTORY = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_HISTORY" -- 折扣满减历史记录
KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY" -- 折扣满减历史记录
KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY_TIP = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_HISTORY_TIP" -- 折扣满减历史记录
KfActivityModel.ANS_DISCOUNT_FULL_CUT_BUY = "KfActivityModel.ANS_DISCOUNT_FULL_CUT_BUY" -- 折扣满减购买
KfActivityModel.SELECT_DISCOUNT_FULL_CUT_GOODS = "KfActivityModel.SELECT_DISCOUNT_FULL_CUT_GOODS" -- 折扣满减购买
KfActivityModel.CHANGE_DISCOUNT_FULL_CUT_TICKET = "KfActivityModel.CHANGE_DISCOUNT_FULL_CUT_TICKET" -- 折扣满减选择券
KfActivityModel.OPEN_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.OPEN_DISCOUNT_FULL_CUT_LUCKY_VIEW" -- 打开折扣转盘界面
KfActivityModel.UPDATE_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.UPDATE_DISCOUNT_FULL_CUT_LUCKY_VIEW"-- 更新折扣转盘界面
KfActivityModel.LUCKY_DISCOUNT_FULL_CUT_LUCKY_VIEW = "KfActivityModel.LUCKY_DISCOUNT_FULL_CUT_LUCKY_VIEW"-- 折扣转盘界面抽奖
KfActivityModel.OPEN_MONEY_COPY_VIEW = "KfActivityModel.OPEN_MONEY_COPY_VIEW" -- 打开彩钻复制机
KfActivityModel.UPDATE_MONEY_COPY_VIEW = "KfActivityModel.UPDATE_MONEY_COPY_VIEW" --更新彩钻复制机
KfActivityModel.ANS_PASS_ACT_BASIC = "KfActivityModel.ANS_PASS_ACT_BASIC" -- 活跃/登陆 通行证信息
KfActivityModel.ANS_PASS_ACT_REWARD_LIST = "KfActivityModel.ANS_PASS_ACT_REWARD_LIST" --活跃/登陆 通行证奖励信息
KfActivityModel.OPEN_PASS_ACT_BUY_TIP = "KfActivityModel.OPEN_PASS_ACT_BUY_TIP" --活跃/登陆 通行证购买界面
KfActivityModel.OPEN_ZERO_GIFT_SHOW_VIEW = "KfActivityModel.OPEN_ZERO_GIFT_SHOW_VIEW"--打开0元礼包展示界面
KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW = "KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW"--打开活动引导基础展示界面
local table_insert = table.insert
KfActivityModel.TabID = {
RushRank = 1,--开服冲榜
OpenRecharge = 2,--开服累充
FosterStage = 3,--开服进阶
LimitGift = 4,--限购礼包
LimitShop = 5,--抢购商城
ContinueRecharge = 6,--连充豪礼
ZeroGift = 7,--0元礼包
GroupBuying = 8,--开服团购
SingleRecharge = 9,--单笔充值
Monopoly = 10,--大富翁
Competing = 11,--竞榜
AccConsume = 15,--累计消费
RewardShow = 16, --活动宣传
InvestAct = 19, --投资活动
LimitSeckill = 20, --限时秒杀
DiscountFullCut = 26,--折扣满减
HappyRedBag = 27,--惊喜红包
ComRank = 28,--通用排行
MoneyCopy = 29,--源晶复制机
LoginPass = 39,--登陆通行证
LivelyPass = 40,--活跃通行证
MainlandJourney = 41,--大陆征途
HighExchange = 42,--嗨点兑换
SakuraGift = 47,--源樱之礼
--(主题活动配置方法、资源文件、代码文件)都写到OperateActivity 但是各类更新全部用KfActivityModel的
SingleDayRecharge = 12,--单日充值
BossDrop = 13,--BOSS掉落
DunMul = 14,--副本多倍
BossTreasure = 17,--幻魔宝典
HighPoint = 18, --嗨点玩法
EDayLogin = 21, --每日登录
LuckyTurntable = 22, --幸运轮盘
ScrapingCard = 23, --刮刮卡
GetLuckyBag = 24, --抢福袋
GetRedBag = 25, --抢福袋
Tarot = 29, --塔罗牌
CollectZi = 30, --集字兑换
StageExchange = 31, --阶段兑换
Adventure = 32, --冒险征途
Jigsaw = 33, --活跃拼图
Reversi = 34,--黑白棋抽奖
FestivalBoss = 35,--节日幻魔
AmasingJigsawPuzzle = 36,--眼疾手快趣味拼图
ThreeFight = 37,--三日作战
PrayTree = 38,--人参果树
ComposeRobot = 43,--合成机
SuperAward = 44,--超能大奖
MaterialSubmit = 45,--材料提交
JumpOne = 46,--跳一跳
SelectEgg = 48,--自选扭蛋
}
--is_most代表是否是多条开放性页签(开服活动\精彩活动\主题活动)(sort_id以后让运营单独调一次即可 我们自增)
KfActivityModel.TabData = {
{id = KfActivityModel.TabID.RewardShow, name = "珍宝展示", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.REWARD_SHOW, is_most = true, sort_id = 1},
{id = KfActivityModel.TabID.RushRank, name = "开服冲榜", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.RUSH_RANK, is_most = true, sort_id = 2},
{id = KfActivityModel.TabID.FosterStage, name = "开服进阶", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.FOSTER_STAGE, is_most = true, sort_id = 3},
{id = KfActivityModel.TabID.OpenRecharge, name = "开服累充", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_RECHARGE, is_most = true, sort_id = 4},
{id = KfActivityModel.TabID.AccConsume, name = "累计消费", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ACC_CONSUME, is_most = true, sort_id = 5},
{id = KfActivityModel.TabID.LimitShop, name = "抢购商城", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP, is_most = true, sort_id = 44},
{id = KfActivityModel.TabID.SingleRecharge, name = "单笔充值", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE, is_most = true, sort_id = 7},
{id = KfActivityModel.TabID.ZeroGift, name = "0元礼包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT, is_most = true, sort_id = 2},
{id = KfActivityModel.TabID.ContinueRecharge, name = "连充豪礼", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE, is_most = true, sort_id = 9},
{id = KfActivityModel.TabID.LimitGift, name = "限购礼包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT, is_most = true, sort_id = 10},
{id = KfActivityModel.TabID.Monopoly, name = "大富翁", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MONOPOLY, is_most = true, sort_id = 11},
{id = KfActivityModel.TabID.GroupBuying, name = "开服团购", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING, is_most = true, sort_id = 12},
{id = KfActivityModel.TabID.Competing, name = "限时冲榜", module_id = 333, base_type = CustomActivityModel.CustomActBaseType.COPETING, is_most = true, sort_id = 13},
{id = KfActivityModel.TabID.SingleDayRecharge, name = "单日充值", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SINGLE_DAY_RECHARGE, is_most = true, sort_id = 14},
{id = KfActivityModel.TabID.BossDrop, name = "幻魔掉落", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.BOSS_DROP, is_most = true, sort_id = 15},
{id = KfActivityModel.TabID.DunMul, name = "副本多倍", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.DUN_MUL_DROP, is_most = true, sort_id = 16},
{id = KfActivityModel.TabID.BossTreasure, name = "幻魔宝典", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.BOSS_TREASURE, is_most = true, sort_id = 17},
{id = KfActivityModel.TabID.HighPoint, name = "嗨点玩法", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HIGH_POINT, is_most = true, sort_id = 18},
{id = KfActivityModel.TabID.InvestAct, name = "投资活动", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.INVEST_ACT, is_most = true, sort_id = 8},
{id = KfActivityModel.TabID.LimitSeckill, name = "限时秒杀", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIMIT_SECKILL, is_most = true, sort_id = 20},
{id = KfActivityModel.TabID.EDayLogin, name = "每日登录", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.E_DAY_LOGIN, is_most = true, sort_id = 21},
{id = KfActivityModel.TabID.LuckyTurntable, name = "幸运轮盘", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE, is_most = true, sort_id = 22},
{id = KfActivityModel.TabID.ScrapingCard, name = "刮刮卡", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SCRAPING_CRAD, is_most = true, sort_id = 23},
{id = KfActivityModel.TabID.GetLuckyBag, name = "抢福袋", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG, is_most = true, sort_id = 24},
{id = KfActivityModel.TabID.GetRedBag, name = "抢红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.GET_RED_BAG, is_most = true, sort_id = 25},
{id = KfActivityModel.TabID.DiscountFullCut, name = "折扣满减", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT, is_most = true, sort_id = 26},
{id = KfActivityModel.TabID.HappyRedBag, name = "惊喜红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, is_most = true, sort_id = 27},
{id = KfActivityModel.TabID.ComRank, name = "通用排行", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COM_RANK, is_most = true, sort_id = 29},
{id = KfActivityModel.TabID.Tarot, name = "塔罗牌", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.TAROT, is_most = true, sort_id = 29},
{id = KfActivityModel.TabID.CollectZi, name = "集字兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COLLECT_ZI, is_most = true, sort_id = 30},
{id = KfActivityModel.TabID.HappyRedBag, name = "惊喜红包", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, is_most = true, sort_id = 31},
{id = KfActivityModel.TabID.StageExchange, name = "阶段兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE, is_most = true, sort_id = 32},
{id = KfActivityModel.TabID.Adventure, name = "冒险征途", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.ADVENTURE, is_most = true, sort_id = 33},
{id = KfActivityModel.TabID.Reversi, name = "黑白棋抽奖", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.REVERSI, is_most = true, sort_id = 34},
{id = KfActivityModel.TabID.Jigsaw, name = "活跃拼图", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.JIGSAW, is_most = true, sort_id = 35},
{id = KfActivityModel.TabID.FestivalBoss, name = "节日幻魔", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS, is_most = true, sort_id = 36},
{id = KfActivityModel.TabID.AmasingJigsawPuzzle, name = "趣味拼图", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.AMUSING_JIGSAW_PUZZLE, is_most = true, sort_id = 37},
{id = KfActivityModel.TabID.ThreeFight, name = "三日作战", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.THREE_FIGHT, is_most = true, sort_id = 37},
{id = KfActivityModel.TabID.PrayTree, name = "人参果树", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.PRAY_TREE, is_most = true, sort_id = 38},
{id = KfActivityModel.TabID.LoginPass, name = "登陆通行证", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LOGIN_PASS, is_most = true, sort_id = 39},
{id = KfActivityModel.TabID.LivelyPass, name = "活跃通行证", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.LIVELY_PASS, is_most = true, sort_id = 40},
{id = KfActivityModel.TabID.MainlandJourney, name = "大陆征途", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MAINLAND_JOURNEY, is_most = true, sort_id = 41},
{id = KfActivityModel.TabID.HighExchange, name = "嗨点兑换", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE, is_most = true, sort_id = 42},
{id = KfActivityModel.TabID.ComposeRobot, name = "合成机", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT, is_most = true, sort_id = 2},
{id = KfActivityModel.TabID.SuperAward, name = "超能大奖", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SUPER_AWARD, is_most = true, sort_id = 6},
{id = KfActivityModel.TabID.MaterialSubmit, name = "材料提交", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, is_most = true, sort_id = 45},
{id = KfActivityModel.TabID.JumpOne, name = "跳一跳", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.JUMP_ONE, is_most = true, sort_id = 46},
{id = KfActivityModel.TabID.SelectEgg, name = "自选扭蛋", module_id = 331, base_type = CustomActivityModel.CustomActBaseType.SELECT_EGG, is_most = true, sort_id = 3},
}
KfActivityModel.MaxRankDay = 9--开服天数限制
KfActivityModel.MaxRankType = 9--榜单类型限制
KfActivityModel.SpecialRankType = 9--榜单特殊类型
KfActivityModel.MonopolyCircleTypeFive = 1--1-5圈
KfActivityModel.MonopolyCircleTypeTen = 2--2-10圈
KfActivityModel.MonopolyMaxCircle = 10--最大10圈
KfActivityModel.MonopolyMaxLattice = 26--最大26格有效格子数(起点终点不算)
KfActivityModel.ComRankStr = {
["recharge"] = {desc = "充值彩钻",btn_desc = "前往充值"},
["consume"] = {desc = "消费彩钻",btn_desc = "前往消费"},
["item"] = {desc = "道具数量",btn_desc = "获取道具"},
}
KfActivityModel.KfDFullCutLuckyGoodsId = 105200--折扣转盘抽奖id
KfActivityModel.AdventureOneCost = 10--冒险征途单次抽取的消耗数
KfActivityModel.AdventureTenCost = 100--冒险征途单次抽取的消耗数
KfActivityModel.ContinueSignRechargePrice = 300--补签需要充值的金额
function KfActivityModel:__init()
KfActivityModel.Instance = self
self.login_red = nil--登陆红点
self:Reset()
end
function KfActivityModel:Reset()
self.view_info = {}--界面信息
self.act_red_dot_info = {}
self.red_dot_info = {}
self.rush_rank_info = {}--冲榜信息
-- self.limit_shop_red_first_open_list = {}--限购商城红点每日登陆列表
self.limit_shop_toggle = {}--限购商城购买确认信息
self.limit_gift_toggle = {}--限购礼包购买确认信息
self.zero_gift_toggle = {}--0元礼包购买确认信息
self.kf_group_buying_toggle = {}--限购礼包购买确认信息
self.high_info = {}--嗨点活动信息
self.high_point_toggle = {}--嗨点复选提示框信息
self.is_close_main_icon = false
self.zero_gift_view_info = {}--0元礼包信息33185、33186
if self.zero_gift_time_id_list then
for k,v in pairs(self.zero_gift_time_id_list) do
GlobalTimerQuest:CancelQuest(v)
v = nil
end
end
self.zero_gift_time_id_list = {}
self.zero_gift_first_open_red_list = {} --首次0元礼包活动的红点
self.zero_gift_first_open_red_flag = {} --首次0元礼包活动的红点是否干掉
--团购活动
self.group_buying_view_info = {}--团购信息
self.group_buying_time_list = {}--团购倒计时时间列表
if self.groupBuying_time_id_list then--团购倒计时列表
for k,v in pairs(self.groupBuying_time_id_list) do
GlobalTimerQuest:CancelQuest(v)
v = nil
end
end
self.groupBuying_time_id_list = {}--计时器ID列表
--大富翁
self.monopoly_info = {}--大富翁信息
self.monopoly_first_open_red_flag = {}--大富翁红点信息
-- 投资活动
self.invest_event_data = {}
self.invest_grade_red_cache = {} -- 投资活动档位红点缓存s
self:InitCfg()
self:InitMonopolyCfg()--初始化大富翁配置
self:InitActViewClassTable()
self:InitRewardShowCfg() -- 初始化珍宝展示配置
--限时秒杀
self.limit_seckill_base_info = {}--基础信息
self.limit_seckill_round_info = {}--场次信息
self.limit_seckill_record_info = {}--购买记录
self.limit_seckill_buy_info = {}--抢购界面信息
self.is_open_limit_seckill_view = false
self.sec_kill_buy_sure = {} -- 消耗彩钻无须确认
self.sec_kill_remind_cache = {} -- 开抢前两分钟提醒
--刮刮卡
self.is_red_scraping_card_list = {}
--塔罗牌
self.is_red_tarot_list = {}
--惊喜红包
self.happy_red_bag_base_info = {}--基础信息
self.happy_red_bag_history_info = {}--抽取全服记录
--折扣满减
self.discount_full_cut_info = {}--基础信息
self.discount_full_cut_history = {}--购买记录
self.discount_full_cut_lucky_list = {}--设置折扣满减奖池数据
self.discount_full_cut_mask_first_open_red = {}--首次开界面红点
self.discount_full_cut_new_red = {}--折扣满减活动新开红点
self.discount_full_cut_draw_goods_red = {}--折扣满减活动物品红点
self.discount_full_cut_draw_goods_num = 0--保存当前折扣满减活动物品数量
self.discount_full_cut_draw_free_red = {}--折扣满减活动免费抽奖次数红点
self.discount_full_cut_draw_free_status = {}--保存当前折扣满减活动免费抽奖次数
--人参果树
self.is_red_praytreelist = {}
--通用排行
self.com_rank_info = {}--封榜活动信息
self.money_copy_data = {}--彩钻复制机
self.pass_act_info = {}--通行证
self.pass_act_reward_info = {}
--小额连充信息
self.kf_continue_info = {}
--开服进阶红点信息
self.forsert_stage_red_info = {}
--开服团购红点信息
self.group_red_list = {}
--嗨点兑换登陆一次红点信息
self.high_login_red_list = {}
self.act_guide_cache = false -- 活动指引记录缓存
self:ResetFosterActGuideBtnCache()
end
function KfActivityModel:getInstance()
if KfActivityModel.Instance == nil then
KfActivityModel.Instance = KfActivityModel.New()
end
return KfActivityModel.Instance
end
--初始化活动界面类
function KfActivityModel:InitActViewClassTable( )
self.act_view_class = {--所有活动界面类
[KfActivityModel.TabID.RushRank] = KfActivityRushRankView,--开服冲榜
[KfActivityModel.TabID.OpenRecharge] = KfActivityOpenRechargeView,--开服累充
[KfActivityModel.TabID.FosterStage] = KfActivityForsterStageView,--开服进阶
[KfActivityModel.TabID.LimitGift] = KfActivityLimitGiftSubView,--限购礼包
[KfActivityModel.TabID.LimitShop] = KfActivityLimitShopView,--抢购商城
[KfActivityModel.TabID.ContinueRecharge] = KfActivityContinueRechargeViewNew,--连充豪礼
[KfActivityModel.TabID.ZeroGift] = KfActivityZeroGiftSubView,--0元礼包
[KfActivityModel.TabID.GroupBuying] = KfGroupBuyingView,--开服团购
[KfActivityModel.TabID.SingleRecharge] = KfActivitySingleRechargeView,--单笔充值
[KfActivityModel.TabID.Monopoly] = KfMonopolyMainView,--大富翁
[KfActivityModel.TabID.Competing] = KfCompetingListMainView,--竞榜
[KfActivityModel.TabID.SingleDayRecharge] = OpSingleRechargeSubView,--单日充值
[KfActivityModel.TabID.BossDrop] = OpBossActDropSubView,--BOSS掉落
[KfActivityModel.TabID.DunMul] = OpDunMultipleDropView,--副本多倍
[KfActivityModel.TabID.AccConsume] = KfActivityAccConsumeView,--累计消费
[KfActivityModel.TabID.RewardShow] = ActivityRewardShowView,--奖励展示
[KfActivityModel.TabID.BossTreasure] = KfBossTreasureView,--幻魔宝典
[KfActivityModel.TabID.HighPoint] = KfActHighPointView,--嗨点玩法
[KfActivityModel.TabID.EDayLogin] = KfActivityEDayLoginView,--每日登录
[KfActivityModel.TabID.ScrapingCard] = KfActivityScrapingCardView,--刮刮卡
[KfActivityModel.TabID.InvestAct] = KfActivityInvestmentView,--投资活动
[KfActivityModel.TabID.LimitSeckill] = LimitSecKillView,--限时秒杀
[KfActivityModel.TabID.LuckyTurntable] = LuckyTurnTableView,--幸运轮盘
[KfActivityModel.TabID.GetLuckyBag] = GetLuckyBagView,--抢福袋
[KfActivityModel.TabID.GetRedBag] = GetLuckyBagView,--抢红包
[KfActivityModel.TabID.DiscountFullCut] = KfDiscountFullCutView,--折扣满减
[KfActivityModel.TabID.HappyRedBag] = KfHappyRedBagView,--惊喜红包
[KfActivityModel.TabID.ComRank] = KfActivityComRankView,--通用排行
[KfActivityModel.TabID.Tarot] = KfActivityTarotView,--塔罗牌
[KfActivityModel.TabID.CollectZi] = OpCollectZiView,--集字兑换
[KfActivityModel.TabID.StageExchange] = OpStageExchangeView,--阶段兑换
[KfActivityModel.TabID.Adventure] = OpAdventureView,--冒险征途
[KfActivityModel.TabID.Jigsaw] = OpJigsawView,--活跃拼图
[KfActivityModel.TabID.Reversi] = OpReversiView,--黑白棋抽奖
[KfActivityModel.TabID.FestivalBoss] = OpFestivalBossView,--节日幻魔
[KfActivityModel.TabID.AmasingJigsawPuzzle] = OpAmasingJigsawView,--节日拼图
[KfActivityModel.TabID.ThreeFight] = OpThreeFightView,--三日作战
[KfActivityModel.TabID.LoginPass] = KfActivityLoginPassView,--登陆通行证
[KfActivityModel.TabID.LivelyPass] = KfActivityLivelyPassView,--活跃通行证
[KfActivityModel.TabID.PrayTree] = OpActivityPrayTreeView,--人参果树
[KfActivityModel.TabID.ComposeRobot] = OpComposeRobotView,--合成机
[KfActivityModel.TabID.HighExchange] = KfActHighExchangeView,--嗨点兑换
[KfActivityModel.TabID.SuperAward] = OpSuperAwardView,--超能大奖
--以下需要开发的新活动
-- [KfActivityModel.TabID.MainlandJourney] = OpActivityPrayTreeView,--大陆征途
-- [KfActivityModel.TabID.ComposeRobot] = OpActivityPrayTreeView,--合成机
[KfActivityModel.TabID.MaterialSubmit] = OpMaterialSubmitView,--材料提交
[KfActivityModel.TabID.JumpOne] = JumpOneMainView,--跳一跳
[KfActivityModel.TabID.SelectEgg] = OpSelectEggView,--自选扭蛋
}
end
--初始化配置
function KfActivityModel:InitCfg( )
self.rush_rank_cfg = {}--冲榜基本配置
local rush_rank_cfg = DeepCopy(Config.Rushrank)
for k,v in pairs(rush_rank_cfg) do
local data = v
data.limit = stringtotable(v.limit)--目标条件
data.figure_id = stringtotable(v.figure_id)--展示模型
data.nominate = stringtotable(v.nominate)--跳转数据
data.name = Trim(v.name)--名字
data.tips = Trim(v.tips)--大奖名字
self.rush_rank_cfg[v.id] = data
if v.start_day > KfActivityModel.MaxRankDay then
KfActivityModel.MaxRankDay = v.start_day
KfActivityModel.MaxRankType = v.id
end
end
self.rush_rank_award_cfg = {}--冲榜排行奖励配置
local rush_rank_award_cfg = DeepCopy(Config.Rushrankreward)
for k,v in pairs(rush_rank_award_cfg) do
local data = v
data.rank_limit = stringtotable(v.rank_limit)--目标条件
data.reward = stringtotable(v.reward)--奖励
data.about = Trim(v.about)--说明
if not self.rush_rank_award_cfg[v.id] then
self.rush_rank_award_cfg[v.id] = {}
end
self.rush_rank_award_cfg[v.id][#self.rush_rank_award_cfg[v.id] + 1] = data
end
local sortFunc = function (a,b)
return a.reward_id < b.reward_id
end
for i,v in ipairs(self.rush_rank_award_cfg) do
table.sort(v, sortFunc)
end
self.rush_rank_goal_cfg = {}--冲榜targer奖励配置
local rush_rank_goal_cfg = DeepCopy(Config.Rushgoalreward)
for k,v in pairs(rush_rank_goal_cfg) do
local data = v
data.goal_value = stringtotable(v.goal_value)--目标条件
data.reward = stringtotable(v.reward)--奖励配置
data.about = Trim(v.about)--说明
if not self.rush_rank_goal_cfg[v.id] then
self.rush_rank_goal_cfg[v.id] = {}
end
self.rush_rank_goal_cfg[v.id][#self.rush_rank_goal_cfg[v.id] + 1] = data
end
for i,v in ipairs(self.rush_rank_goal_cfg) do
table.sort(v, sortFunc)
end
self.com_rank_score_cfg = {}
local com_rank_score_cfg = DeepCopy(Config.Vierankreq)
for k,v in pairs(com_rank_score_cfg) do
local data = v
data.type_value = Trim(v.type_value)--说明
if not self.com_rank_score_cfg[v.type_key] then
self.com_rank_score_cfg[v.type_key] = {}
end
self.com_rank_score_cfg[v.type_key][v.rank] = data
end
end
--初始化大富翁配置
function KfActivityModel:InitMonopolyCfg( )
self.mono_kv_cfg = {}--大富翁常量配置
local mono_kv_cfg = DeepCopy(Config.Monokv)
for k,v in pairs(mono_kv_cfg) do
if k == "gold_dice_count" then
self.mono_kv_cfg.gold_dice_count = v.val--每日最大获得金骰子数量
elseif k == "gold_dice_level" then
self.mono_kv_cfg.gold_dice_level = stringtotable(v.val)--充值赠送金骰子档位
elseif k == "luckycard_count" then
self.mono_kv_cfg.luckycard_count = v.val --幸运卡池数量
elseif k == "mono_total_round" then
self.mono_kv_cfg.mono_total_round = v.val --活动总圈数
elseif k == "normal_dice_count" then
self.mono_kv_cfg.normal_dice_count = v.val --每日最大获得普通骰子数量
elseif k == "normal_dice_level" then
self.mono_kv_cfg.normal_dice_level = stringtotable(v.val) --充值赠送普通骰子档位
end
end
self.mono_lattice_cfg = {}--大富翁圈数格子配置
local mono_lattice_cfg = DeepCopy(Config.Monolattice)
for k,v in pairs(mono_lattice_cfg) do
if not self.mono_lattice_cfg[v.round] then
self.mono_lattice_cfg[v.round] = {}
end
self.mono_lattice_cfg[v.round][v.lattice_index] = v
end
self.mono_smallbox_award_cfg = {}--大富翁小宝箱配置
local mono_smallbox_award_cfg = DeepCopy(Config.Monosmallbox)
for k,v in pairs(mono_smallbox_award_cfg) do
local data = v
data.rewards = stringtotable(data.rewards)[1]
self.mono_smallbox_award_cfg[v.index] = data
end
self.mono_lucky_award_cfg = {}--大富翁幸运卡奖励
local mono_lucky_award_cfg = DeepCopy(Config.Monoluckycard)
for k,v in pairs(mono_lucky_award_cfg) do
local data = v
data.rewards = stringtotable(data.rewards)[1]
self.mono_lucky_award_cfg[v.index] = data
end
self.mono_round_award_cfg = {}--大富翁圈数奖励
local mono_round_award_cfg = DeepCopy(Config.Monoroundrewards)
for k,v in pairs(mono_round_award_cfg) do
local data = v
data.rewards = stringtotable(data.rewards)[1]
data.show = stringtotable(data.show)
if not self.mono_round_award_cfg[v.sub_type] then
self.mono_round_award_cfg[v.sub_type] = {}
end
self.mono_round_award_cfg[v.sub_type][v.round] = data
end
end
-- 初始化珍宝展示的配置
function KfActivityModel:InitRewardShowCfg( )
self.show_res_cfg = {}
for k,v in pairs(Config.Showresource) do
if not self.show_res_cfg[v.item_id] then
self.show_res_cfg[v.item_id] = {}
end
self.show_res_cfg[v.item_id][v.model_id] = self.show_res_cfg[v.item_id][v.model_id] or {}
self.show_res_cfg[v.item_id][v.model_id][v.model_type] = v
end
end
-- 获取珍宝展示配置
function KfActivityModel:GetRewardShowCfg( item_id )
local item_id = tonumber(item_id)
if item_id and self.show_res_cfg[item_id] then
return self.show_res_cfg[item_id]
else
-- logWarn('=======Msh:KfActivityModel.lua[278]=参数有误======', item_id)
end
end
--更新主界面活动图标红点(开服、主题、精彩)CustomActivityModel.CustomIconActType
function KfActivityModel:CheckMainIconRedDot( act_type )
if not act_type then
return
end
local bool = false
local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
local sub_type = nil
local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
for k,v in pairs(sub_type_list) do
if v.act_type == act_type then
sub_type = v.sub_type
break
end
end
if not sub_type then return end
local icon_sub_type = base_type*1000 + sub_type
if sub_type >= 10001 then
icon_sub_type = base_type*100000 + sub_type
end
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
if not act_list then
return
else
if self.red_dot_info[act_type] then
for k,v in pairs(self.red_dot_info[act_type]) do
local module_sub_id = self:ByTabIdGetActType(k)
if GetModuleIsOpen(331,module_sub_id)
or (k == KfActivityModel.TabID.Competing and GetModuleIsOpen(333,nil))--竞榜是333模块的
then
if module_sub_id == CustomActivityModel.CustomActBaseType.SUPER_AWARD then--超能大奖比较特殊
for kk,vv in pairs(v) do
if vv == true and self:CheckSuperAwardTabIsOpen(module_sub_id,kk) then
bool = vv
break
end
end
elseif module_sub_id == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换比较特殊
for sub_type,vv in pairs(v) do
if not self.high_login_red_list[sub_type] then
bool = true
break
end
end
else
for kk,vv in pairs(v) do
if vv == true then
bool = vv
break
end
end
end
end
end
end
-- print("huangcong:KfActivityModel [start:445] :", icon_sub_type,act_type)
-- PrintTable(self.red_dot_info[act_type])
-- print("huangcong:KfActivityModel [end]")
GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, icon_sub_type, bool)
end
end
--通过页签ID获得定制活动类型
function KfActivityModel:ByTabIdGetActType( tabId )
for i,v in ipairs(KfActivityModel.TabData) do
if v.id == tabId then
return v.base_type
end
end
end
--通过定制活动类型获得页签ID
function KfActivityModel:ByActTypeGetTabId( act_type )
for i,v in ipairs(KfActivityModel.TabData) do
if v.base_type == act_type then
return v.id
end
end
end
--这样写红点 每次调全局的只要调两次
function KfActivityModel:IsNeedRedAll( )--暂时去掉
end
function KfActivityModel:IsNeedRed( id,is_all,sub_type )
local bool = false
local act_type = CustomActivityModel.CustomIconActType.KfAct--默认是开服活动
if id == KfActivityModel.TabID.RushRank then--开服冲榜
sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.RUSH_RANK)
bool,act_type = self:CheckRushRankRedDot(sub_type)
elseif id == KfActivityModel.TabID.OpenRecharge then--开服累充
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.KFACTIVITY_RECHARGE,sub_type)
elseif id == KfActivityModel.TabID.FosterStage then--开服进阶
bool,act_type = self:CheckFosterStageRedDot(CustomActivityModel.CustomActBaseType.FOSTER_STAGE,sub_type)
elseif id == KfActivityModel.TabID.LimitGift then--限购礼包
bool,act_type = self:CheckLimitGiftRedDot(sub_type)
elseif id == KfActivityModel.TabID.LimitShop then--限购商城
bool,act_type = self:CheckLimitShopRedDot(sub_type)
elseif id == KfActivityModel.TabID.ContinueRecharge then--连充豪礼
bool,act_type = self:CheckContinueRechargeRedDot(CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE,sub_type)
elseif id == KfActivityModel.TabID.ZeroGift and GetModuleIsOpen(331,36) then--0元礼包
bool,act_type = self:CheckZeroGiftRedDot(sub_type)
elseif id == KfActivityModel.TabID.GroupBuying and GetModuleIsOpen(331,70) then--开服团购
bool,act_type = self:CheckKfGroupBuyingRedDot(sub_type)
elseif id == KfActivityModel.TabID.SingleDayRecharge then
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SINGLE_DAY_RECHARGE,sub_type)
elseif id == KfActivityModel.TabID.SingleRecharge then--单笔充值
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE,sub_type)
if not bool then
local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE,sub_type)
if com_act_red_info then
bool = com_act_red_info.status == 1
end
end
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.SINGLE_RECHARGE][sub_type] = bool
elseif id == KfActivityModel.TabID.Monopoly then--大富翁
bool,act_type = self:CheckMonopolyRedDot(sub_type)
elseif id == KfActivityModel.TabID.Competing then--竞榜--这里先默认放到开服活动类型中
bool,act_type = self:CheckCompetingRedDot(sub_type)
elseif id == KfActivityModel.TabID.BossDrop then--boss掉落
bool,act_type = self:CheckBossDropRedDot(sub_type)
elseif id == KfActivityModel.TabID.DunMul then--副本多倍
bool,act_type = self:CheckDunMulRedDot(sub_type)
elseif id == KfActivityModel.TabID.AccConsume then--开服累充
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.ACC_CONSUME,sub_type)
elseif id == KfActivityModel.TabID.BossTreasure then--幻魔宝典
bool,act_type = self:CheckActBossTreasureRedDot(sub_type)
elseif id == KfActivityModel.TabID.HighPoint then--嗨点玩法
bool,act_type = self:CheckHighPointRedDot(CustomActivityModel.CustomActBaseType.HIGH_POINT,sub_type)
elseif id == KfActivityModel.TabID.InvestAct then--投资活动
bool,act_type = self:CheckActInvestRedDot(sub_type)
elseif id == KfActivityModel.TabID.LimitSeckill then--限时秒杀
bool,act_type = self:CheckSecKillRedDot(sub_type)
elseif id == KfActivityModel.TabID.EDayLogin then--每日登录
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.E_DAY_LOGIN,sub_type)
elseif id == KfActivityModel.TabID.LuckyTurntable then--幸运轮盘
bool,act_type = self:CheckLuckyTurnTableRedDot(sub_type)
elseif id == KfActivityModel.TabID.ScrapingCard then--刮刮卡
bool,act_type = self:CheckScrapingCardRedDot(CustomActivityModel.CustomActBaseType.SCRAPING_CRAD,sub_type)
elseif id == KfActivityModel.TabID.DiscountFullCut then--折扣满减
bool,act_type = self:CheckKfDiscountFullCutRedDot(sub_type)
elseif id == KfActivityModel.TabID.ComRank then--通用排行
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.COM_RANK,sub_type)
elseif id == KfActivityModel.TabID.Tarot then--塔罗牌
bool,act_type = self:CheckActTarotRedDot(CustomActivityModel.CustomActBaseType.TAROT,sub_type)
elseif id == KfActivityModel.TabID.CollectZi then--集字兑换
bool,act_type = self:CheckCollectActRedDot(CustomActivityModel.CustomActBaseType.COLLECT_ZI,sub_type)
elseif id == KfActivityModel.TabID.HappyRedBag then--惊喜红包
bool,act_type = self:CheckActHappyRedBagRedDot(sub_type)
elseif id == KfActivityModel.TabID.StageExchange then--阶段兑换
bool,act_type = self:CheckStageExchangeRedDot(CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE,sub_type)
elseif id == KfActivityModel.TabID.Adventure then--冒险征途
bool,act_type = self:CheckAdventureRedDot(CustomActivityModel.CustomActBaseType.ADVENTURE,sub_type)
elseif id == KfActivityModel.TabID.Reversi then--黑白棋抽奖
bool,act_type = self:CheckReversiRedDot(CustomActivityModel.CustomActBaseType.REVERSI,sub_type)
elseif id == KfActivityModel.TabID.FestivalBoss then--节日幻魔
bool,act_type = self:CheckFestivalBossRedDot(CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS,sub_type)
elseif id == KfActivityModel.TabID.Jigsaw then--活跃拼图
bool, act_type = self:CheckJigsawRedDot(CustomActivityModel.CustomActBaseType.JIGSAW, sub_type)
elseif id == KfActivityModel.TabID.AmasingJigsawPuzzle then--眼疾手快趣味拼图
-- bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.AMUSING_JIGSAW_PUZZLE,sub_type)
elseif id == KfActivityModel.TabID.ThreeFight then--三日作战
bool, act_type = OperateActivityModel:getInstance():CheckThreeFightRedDot(sub_type)
if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT] then
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT] = {}
end
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.THREE_FIGHT][sub_type] = bool
elseif id == KfActivityModel.TabID.LoginPass then--登陆通行证
bool,act_type = self:CheckComPassRedDot(CustomActivityModel.CustomActBaseType.LOGIN_PASS,sub_type)
elseif id == KfActivityModel.TabID.LivelyPass then--活跃通行证
bool,act_type = self:CheckComPassRedDot(CustomActivityModel.CustomActBaseType.LIVELY_PASS,sub_type)
elseif id == KfActivityModel.TabID.PrayTree then--人参果树(祈福活动)
bool,act_type = self:CheckPrayTreeRedDot(CustomActivityModel.CustomActBaseType.PRAY_TREE,sub_type)
elseif id == KfActivityModel.TabID.MainlandJourney then--大陆征途
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.MAINLAND_JOURNEY,sub_type)
elseif id == KfActivityModel.TabID.HighExchange then--嗨点兑换
bool,act_type = self:CheckHighPointRedDot(CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE,sub_type)
elseif id == KfActivityModel.TabID.ComposeRobot then--合成机
bool,act_type = self:CheckActComposeRobotRedDot(CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT,sub_type)
elseif id == KfActivityModel.TabID.SuperAward then--超能大奖
bool,act_type = self:CheckActCommonRedDot(CustomActivityModel.CustomActBaseType.SUPER_AWARD,sub_type)
elseif id == KfActivityModel.TabID.MaterialSubmit then--材料提交
bool,act_type = self:CheckActMaterialSubmitRedDot(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT,sub_type)
elseif id == KfActivityModel.TabID.SelectEgg then--自选扭蛋
bool,act_type = self:CheckActSelectEggRedDot(CustomActivityModel.CustomActBaseType.SELECT_EGG,sub_type)
end
act_type = act_type or CustomActivityModel.CustomIconActType.KfAct
if not self.red_dot_info[act_type] then--红点信息要和活动类型对应
self.red_dot_info[act_type] = {}
end
if not self.red_dot_info[act_type][id] then--红点信息要和活动类型对应
self.red_dot_info[act_type][id] = {}
end
if sub_type then
self.red_dot_info[act_type][id][sub_type] = bool
end
self:Fire(KfActivityModel.ANS_UPDATE_VIEW,id,bool,sub_type)
if not is_all then
self:CheckMainIconRedDot(act_type)
end
-- print("huangcong:KfActivityModel [222]: ",bool,id)
-- PrintTable(self.red_dot_info)
end
--清除活动刷新红点信息
function KfActivityModel:ClearActRedDotInfo( base_type,sub_type )
local id = nil
for i,v in ipairs(KfActivityModel.TabData) do
if base_type == v.base_type then
id = v.id
break
end
end
if id then
for act_type,v in pairs(self.red_dot_info) do
for v_id,vv in pairs(v) do
if v_id == id then
for v_sub_type,vvv in pairs(vv) do
if v_sub_type == sub_type then
self.red_dot_info[act_type][v_id][sub_type] = false
self:CheckMainIconRedDot(act_type)
return
end
end
end
end
end
end
end
--设置0元礼包首次打开cookie
function KfActivityModel:SetZeroGiftFirstOpenCookie( bool )
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.ZERO_GIFT_VIEW_FIRST_OPEN,bool)
CookieWrapper.Instance:WriteAll()
end
--获得0元礼包首次打开cookie
function KfActivityModel:GetZeroGiftFirstOpenCookie( )
local bool = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.ZERO_GIFT_VIEW_FIRST_OPEN) or false
return bool
end
--获得0元礼包是否首次打开过
function KfActivityModel:GetZeroGiftFirstOpenRed(sub_type)
if self.zero_gift_first_open_red_list then
return self.zero_gift_first_open_red_list[sub_type] or false
end
return false
end
--0元礼包首次打开红点
function KfActivityModel:SetZeroGiftFirstOpenRed(sub_type)
if self.zero_gift_first_open_red_list[sub_type] then
self.zero_gift_first_open_red_list[sub_type] = false
self.zero_gift_first_open_red_flag[sub_type] = true
self:IsNeedRed(KfActivityModel.TabID.ZeroGift,nil,sub_type)
end
end
--判断等级是否达到0元礼包可购买等级
function KfActivityModel:IsLvCanBuyZeroGift(level)
local bool = false
local base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT
local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
if not all_list then return false end
local sub_type = CustomActivityModel:getInstance():getActMinSubType(base_type)
for k,v in pairs(all_list) do
local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
if award_data then
for kk,vv in ipairs(award_data.reward_list) do
local cost_num = 99999
local buy_level = 99999
for m,n in ipairs(vv.condition_list) do
if n[1] == "cost" then
cost_num = tonumber(n[2][1][3])
elseif n[1] == "buy_lv" then
buy_level = tonumber(n[2]) or 1
end
if cost_num == 0 and buy_level == level then
bool = true
sub_type = v.sub_type
break
end
end
end
end
end
return bool,sub_type
end
--检查0元礼包红点
function KfActivityModel:CheckZeroGiftRedDot( sub_type )
local show = false
local base_type = CustomActivityModel.CustomActBaseType.ZERO_GIFT
local server_time = TimeUtil:getServerTime()
local my_level = RoleManager.Instance.mainRoleInfo.level
local act_type = CustomActivityModel.CustomIconActType.KfAct
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if not act_list then return show end
act_type = act_list.act_type
act_list = DeepCopy(act_list)
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}--红点信息
end
local sub_type_red = false
self.zero_gift_first_open_red_list[act_list.sub_type] = false
if act_list.is_first_open == 1 and not self.zero_gift_first_open_red_flag[act_list.sub_type] then
self.zero_gift_first_open_red_list[act_list.sub_type] = true
sub_type_red = true
show = true
end
local zero_data = self:GetZeroGiftInfo(act_list.sub_type)
local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
if zero_data and award_data then
for kk,vv in ipairs(zero_data.reward_list) do
if vv.status == 4 then--可领取
sub_type_red = true
show = true
break
end
if vv.status == 0 then--可以免费领
local cost_num = nil
local buy_level = 1
local conditon = {}
for award_k,award_v in pairs(award_data.reward_list) do
if award_v.grade == vv.grade then
conditon = award_v.condition_list
end
end
for m,n in ipairs(conditon) do
if n[1] == "cost" then
cost_num = tonumber(n[2][1][3])
elseif n[1] == "buy_lv" then
buy_level = tonumber(n[2]) or 1
end
end
if cost_num and cost_num == 0 and my_level>=buy_level then
sub_type_red = true
show = true
break
end
end
end
end
self.act_red_dot_info[base_type][act_list.sub_type] = sub_type_red
return show,act_type
end
function KfActivityModel:CheckZeroGiftTabIsOpen(sub_type)
local bool = false
local zero_data = self:GetZeroGiftInfo(sub_type)
if zero_data then
for i,v in ipairs(zero_data.reward_list) do
if v.status == 0 or v.status == 1 or v.status == 4 then
bool = true
end
end
end
return bool
end
--检查boss掉落红点
function KfActivityModel:CheckBossDropRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.BOSS_DROP
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if act_list then
act_type = act_list.act_type
end
return show,act_type
end
--检查副本多倍掉落红点
function KfActivityModel:CheckDunMulRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.DUN_MUL_DROP
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if act_list then
act_type = act_list.act_type
end
return show,act_type
end
--幻魔宝典红点
function KfActivityModel:CheckActBossTreasureRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.BOSS_TREASURE
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
bool = KfBossTreasureModel:getInstance():GetAllRedBySubType( false,sub_type )
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
return bool,act_type
end
--惊喜红包红点
function KfActivityModel:CheckActHappyRedBagRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
end
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
local red_data = self:GetHappyRedBagRedDotBySubType(sub_type)
bool = red_data.box or red_data.red_bag
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
end
return bool,act_type
end
--塔罗牌红点
function KfActivityModel:CheckActTarotRedDot( base_type, sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
local b = OperateActivityModel:getInstance():TarotGetRedDot(sub_type)
if b then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
if not self.is_red_tarot_list[sub_type] then
self.is_red_tarot_list[sub_type] = true
OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33255, sub_type)
end
end
end
return show,act_type
end
--检查竞榜红点
function KfActivityModel:CheckCompetingRedDot( base_type )
local red_bool = false
local red_list = CompetingListModel:getInstance():GetComtingRedList()
if red_list and TableSize(red_list) > 0 then
red_bool = red_list[base_type] or false
end
local act_type = CustomActivityModel.CustomIconActType.KfAct--默认放在开服活动图标里面
local competing_cfg = CompetingListModel:getInstance():GetCompetingCfg(base_type)
if competing_cfg then
for k,v in pairs(competing_cfg.condition) do
if v[1] == "icon" then
act_type = tonumber(v[2])
break
end
end
end
return red_bool,act_type
end
--检查大富翁红点
function KfActivityModel:CheckMonopolyRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.MONOPOLY
local show = false
local server_time = TimeUtil:getServerTime()
local my_level = RoleManager.Instance.mainRoleInfo.level
local act_type = CustomActivityModel.CustomIconActType.KfAct
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if not act_list then return show,act_type end
act_list = DeepCopy(act_list)
act_type = act_list.act_type
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}--红点信息
end
local open_level = Config.Modulesub["331@72"].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
if server_time > act_list.stime and act_list.etime > server_time then
if my_level >= open_level then
self.act_red_dot_info[base_type][act_list.sub_type] = false or not self.monopoly_first_open_red_flag[act_list.sub_type]
if not self.act_red_dot_info[base_type][act_list.sub_type] then
local server_info = self:GetMonopolyInfo(act_list.sub_type)
if server_info and server_info.normal_count then
local is_over = (server_info.cur_index == 26 and server_info.round == KfActivityModel.MonopolyMaxCircle)
--红点
show = (server_info.normal_count + server_info.gold_count > 0) and not is_over
if not show then
for k,v in pairs(server_info.circle_rewards) do
if act_list.circle <= 5 and act_list.status == 1 then
show = true
elseif act_list.circle > 5 and act_list.status == 1 then
show = true
end
end
end
end
self.act_red_dot_info[base_type][act_list.sub_type] = show
end
end
end
return show,act_type
end
--检查开服团购红点
function KfActivityModel:CheckKfGroupBuyingRedDot( sub_type )
local show = false
local base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING
local act_info_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
local act_type = CustomActivityModel.CustomIconActType.KfAct
if act_info_list and sub_type then--传进来只需要刷一次
for i,v in pairs(act_info_list) do
if v.sub_type == sub_type then
act_type = v.act_type
self:CheckKfGroupBuyingSubTypeRedDot(v.sub_type)
local is_mobilization_act = false
for ii,vv in ipairs(v.condition_list) do
if vv[1] == "custom_act" and tonumber(vv[2]) == 71 then
is_mobilization_act = true
MobilizationModel:getInstance():CheckGroupBuyingRed(tonumber(vv[3]))--这边要计算全民动员那边团购的红点
break
end
end
end
end
end
if self.act_red_dot_info[base_type] and TableSize(self.act_red_dot_info[base_type]) > 0 then
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
if act_list then
local is_mobilization_act = false
for ii,vv in ipairs(act_list.condition_list) do
if vv[1] == "custom_act" and tonumber(vv[2]) == 71 then
is_mobilization_act = true
end
end
if not is_mobilization_act then
if self.act_red_dot_info[base_type][sub_type] then
show = v
end
end
end
end
return show,act_type
end
--检查限购礼包红点
function KfActivityModel:CheckLimitGiftRedDot( sub_type )
local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
local show = false
local base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT
local server_time = TimeUtil:getServerTime()
local my_level = RoleManager.Instance.mainRoleInfo.level
local act_type = CustomActivityModel.CustomIconActType.KfAct
all_list = DeepCopy(all_list)
if not all_list then return show,act_type end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
act_list = DeepCopy(act_list)
if not act_list then return show,act_type end
act_type = act_list.act_type
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
local open_level = Config.Modulesub["331@3"].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
-- self.act_red_dot_info[base_type][act_list.sub_type] = false
if server_time > act_list.stime and act_list.etime > server_time then
if my_level >= open_level and GetModuleIsOpen(331,CustomActivityModel.CustomActBaseType.LIMIT_GIFT) then
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]
if not self.act_red_dot_info[base_type][act_list.sub_type] then
local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
if award_data then
local is_buy_over = true
for n,l in pairs(award_data.reward_list) do
if l.status ~= 2 then
is_buy_over = false
break
end
end
if is_buy_over then--买完了就不要作妖了
self.act_red_dot_info[base_type][act_list.sub_type] = false
return false
end
for ii,vv in pairs(award_data.reward_list) do
local conditon = vv.condition_list
if conditon and not self.act_red_dot_info[base_type][act_list.sub_type] then
local cur_price = nil
local recharge_gold = nil
for iii,vvv in ipairs(conditon) do
if vvv[1] == "limit_cost" then
cur_price = tonumber(vvv[2])
elseif vvv[1] == "recharge_gold" then
recharge_gold = tonumber(vvv[2])
end
end
self.act_red_dot_info[base_type][act_list.sub_type] = vv.status == 1 and (cur_price == 0 or recharge_gold ~= nil)
end
end
end
end
end
end
if LimitGiftModel:getInstance().login_red[act_list.sub_type] == nil then
for k,v in pairs(all_list) do
local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
if award_data and award_data.reward_list then
for ii,vv in pairs(award_data.reward_list) do
if LimitGiftModel:getInstance().login_red[act_list.sub_type] == nil then
LimitGiftModel:getInstance().login_red[act_list.sub_type] = vv.status ~= 2
show = vv.status ~= 2
if show then
self.act_red_dot_info[base_type][act_list.sub_type] = true
end
elseif LimitGiftModel:getInstance().login_red[act_list.sub_type] then
break
end
end
end
end
end
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
return show,act_type
end
--检查限购礼包是否卖完
function KfActivityModel:CheckLimitGiftCanBuy( sub_type )
local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
local show = false
local base_type = CustomActivityModel.CustomActBaseType.LIMIT_GIFT
local server_time = TimeUtil:getServerTime()
local my_level = RoleManager.Instance.mainRoleInfo.level
local act_type = CustomActivityModel.CustomIconActType.KfAct
all_list = DeepCopy(all_list)
if not all_list then return show,act_type end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
act_list = DeepCopy(act_list)
if not act_list then return show,act_type end
act_type = act_list.act_type
local open_level = Config.Modulesub["331@3"].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
if server_time > act_list.stime and act_list.etime > server_time then
if my_level >= open_level and GetModuleIsOpen(331,CustomActivityModel.CustomActBaseType.LIMIT_GIFT) then
local award_data = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type,act_list.sub_type)
if award_data then
local is_buy_over = true
local cur_vip = RoleManager.Instance.mainRoleInfo.vip_flag
for n,l in pairs(award_data.reward_list) do
local can_buy = true
for i,v in pairs(l.condition_list) do
if type(v) == "table" and v[1] == "vip" and tonumber(v[2]) > cur_vip then
can_buy = false
break
end
end
if l.status ~= 2 and can_buy then
is_buy_over = false
break
end
end
if not is_buy_over then -- 没卖完
return true
end
end
end
end
return false
end
--检查限购礼包所有红点
function KfActivityModel:CheckLimitGiftAllRedDot( )
local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.LIMIT_GIFT) or {}
for i,v in pairs(all_act_list) do
self:IsNeedRed(KfActivityModel.TabID.LimitGift,nil,v.sub_type)
end
end
--检查冲榜红点
function KfActivityModel:CheckRushRankRedDot( sub_type )
-- if not GetModuleIsOpen(331,10) then return false end
local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
local base_type = CustomActivityModel.CustomActBaseType.RUSH_RANK
local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
local server_time = TimeUtil:getServerTime( )
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
local all_act = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.RUSH_RANK,sub_type)
if all_act then
act_type = all_act.act_type
if server_time > all_act.stime and all_act.etime >= server_time then
local rank_type_list = self:GetTodayRankType()
for k,rank_type in pairs(rank_type_list) do
local target_reward_list = self:GetTargetRewardList(rank_type)
if target_reward_list then
for k,v in pairs(target_reward_list) do
if v.state == 1 then
show = true
break
end
end
end
if show then
break
end
end
self.act_red_dot_info[base_type][sub_type] = show
end
end
if self.act_red_dot_info[base_type] then
for i,v in ipairs(self.act_red_dot_info[base_type]) do
if v then
return v,act_type
end
end
end
return false,act_type
end
--活动通用奖励红点33105
function KfActivityModel:CheckContinueRechargeRedDot(base_type,sub_type)
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
if n.status == 1 then
show = true
end
end
end
end
if not show then
local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(act_list.base_type,act_list.sub_type)
if com_act_red_info then
show = com_act_red_info.status == 1
end
end
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = show
end
return show,act_type
end
--活动通用奖励红点33105
function KfActivityModel:CheckActCommonRedDot(base_type,sub_type)
-- if not GetModuleIsOpen(331,base_type) or not sub_type then return false end
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
if n.status == 1 then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
end
end
end
-- if not show and base_type == CustomActivityModel.CustomActBaseType.CONTINUE_RECHARGE then--连充有额外处理
-- local resign_info = self:GetKfContinueInfo(act_list.sub_type)
-- if resign_info then
-- local award_day = math.ceil((act_list.etime - act_list.stime)/60/60/24)--当前活动剩余多少天
-- local real_day = math.ceil((TimeUtil:getServerTime( ) - act_list.stime)/60/60/24)--当前第几天
-- local day_award_list = {}
-- for k,v in pairs(info.reward_list) do
-- for ii,vv in ipairs(v.condition_list) do
-- if vv[1] == "recharge_gold" and award_day >= v.grade then--天数奖励展示
-- local data = v
-- data.day = v.grade
-- day_award_list[#day_award_list + 1] = data
-- end
-- end
-- end
-- local sort_func = function ( a, b )
-- return a.day < b.day
-- end
-- if #day_award_list > 1 then
-- table.sort(day_award_list, sort_func)
-- end
-- for i,v in ipairs(day_award_list) do
-- if real_day > i and resign_info.can_resign_time > 0 and v.status == 0 then
-- show = true
-- self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
-- break
-- end
-- end
-- end
-- end
end
return show,act_type
end
function KfActivityModel:CheckFosterStageRedDot( base_type,sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
local first_red_list = self:GetFosterStageCookie() or {}
-- if openDay <= 8 and not self.forsert_stage_red_info[act_list.sub_type] then--前八天每次登陆红点
-- show = true
-- elseif openDay > 8 and
if not first_red_list[act_list.sub_type] then
show = true
else
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
if n.status == 1 then
show = true
end
end
end
end
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = show
end
end
return show,act_type
end
--设置开服进阶红点cookie
function KfActivityModel:SetFosterStageCookie( sub_type )
local list = self:GetFosterStageCookie() or {}
list[sub_type] = true
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_DAY2,CookieKey.KF_FORSTER_STAGE_ACT_RED,list)
CookieWrapper.Instance:WriteAll()
end
--获得开服进阶红点cookie
function KfActivityModel:GetFosterStageCookie( )
local bool = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.KF_FORSTER_STAGE_ACT_RED) or {}
return bool
end
--检查限购商城的红点
function KfActivityModel:CheckLimitShopRedDot( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
local show = false
local level = RoleManager.Instance.mainRoleInfo.level
local server_time = TimeUtil:getServerTime( )
local act_type = CustomActivityModel.CustomIconActType.KfAct
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
act_list = DeepCopy(act_list)
act_type = act_list.act_type
local info = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type, act_list.sub_type)
if not self.act_red_dot_info[act_list.base_type] then
self.act_red_dot_info[act_list.base_type] = {}
end
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = false
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
local gold_type = 0
local limit_cost = 0
local show_level_range = {0,999999}
local limit_times = 0
local limit_vip = 0
for i,v in ipairs(n.condition_list) do
if v[1] == "gold_type" then
gold_type = tonumber(v[2])
elseif v[1] == "limit_cost" then
limit_cost = tonumber(v[2])
elseif v[1] == "limit_times" then
limit_times = tonumber(v[2])
elseif v[1] == "show_level_range" then
show_level_range = {tonumber(v[2]),tonumber(v[3])}
elseif v[1] == "limit_vip" then
limit_vip = tonumber(v[2])
end
end
--先满足等级和次数
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
if gold_type == 2 and limit_cost <= RoleManager.Instance.mainRoleInfo.jinLock then--红钻数量满足
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
elseif gold_type == 1 and limit_cost == 0 then--免费
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
elseif gold_type == 2 and limit_cost == 0 then--免费
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
end
end
end
end
end
return show,act_type
end
--检查限购商城是否卖完
function KfActivityModel:CheckLimitShopCanBuy( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
local show = false
local level = RoleManager.Instance.mainRoleInfo.level
local server_time = TimeUtil:getServerTime( )
local act_type = CustomActivityModel.CustomIconActType.KfAct
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
act_list = DeepCopy(act_list)
act_type = act_list.act_type
local info = CustomActivityModel:getInstance():getOneActRewardList(act_list.base_type, act_list.sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
local gold_type = 0
local limit_cost = 0
local show_level_range = {0,999999}
local limit_times = 0
for i,v in ipairs(n.condition_list) do
if v[1] == "gold_type" then
gold_type = tonumber(v[2])
elseif v[1] == "limit_cost" then
limit_cost = tonumber(v[2])
elseif v[1] == "limit_times" then
limit_times = tonumber(v[2])
elseif v[1] == "show_level_range" then
show_level_range = {tonumber(v[2]),tonumber(v[3])}
end
end
--先满足等级和次数
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
return true -- 有满足条件可以买的
end
end
end
end
end
return show,act_type
end
--检查刮刮卡城的红点
function KfActivityModel:CheckScrapingCardRedDot(base_type, sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
local b = OperateActivityModel:getInstance():ScrapingCradGetRedDot(sub_type)
if b then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
if not self.is_red_scraping_card_list[sub_type] then
self.is_red_scraping_card_list[sub_type] = true
OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33244, sub_type)
OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33246, sub_type)
end
end
end
return show,act_type
end
--检查人参果树的红点
function KfActivityModel:CheckPrayTreeRedDot(base_type, sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
local b = OperateActivityModel:getInstance():PrayTreeGetRedDot()
if b then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
if not self.is_red_praytreelist[sub_type] then
self.is_red_praytreelist[sub_type] = true
OperateActivityModel:getInstance():Fire(OperateActivityModel.REQUEST_INFO, 33280, sub_type)
end
end
end
return show,act_type
end
--检查集字红点
function KfActivityModel:CheckCollectActRedDot( base_type,sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
local cookies_list = OperateActivityModel:getInstance():GetJiZiRedDotTipCookie()
local sub_cookies_list = cookies_list[sub_type]
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
local exchange_limit = 0
local goods_exchange_list = {}
for kk,vv in pairs(n.condition_list) do
if vv[1] == "exchange_limit" then--兑换限制
exchange_limit = tonumber(vv[2])
elseif vv[1] == "goods_exchange" then--兑换列表
goods_exchange_list = vv[2]
end
end
local red_bool = GoodsModel:getInstance():GetEnough(goods_exchange_list)
red_bool = red_bool and n.receive_times < exchange_limit
if red_bool and not (sub_cookies_list and sub_cookies_list[n.grade]) then
show = true
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
break
end
end
end
end
end
return show,act_type
end
--阶段兑换红点
function KfActivityModel:CheckStageExchangeRedDot( base_type,sub_type )
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
local server_time = TimeUtil:getServerTime( )
if act_list and server_time > act_list.stime and act_list.etime > server_time then
act_type = act_list.act_type
bool = self:GetStageExchangeRedDotBySubType(sub_type)
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
return bool,act_type
end
--冒险征途红点
function KfActivityModel:CheckAdventureRedDot(base_type,sub_type)
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
-------------------------
--可以抽奖励
local adventure_data = OperateActivityModel:getInstance():GetAdventureNumInfo(sub_type)
if adventure_data then
if adventure_data.score >= KfActivityModel.AdventureOneCost then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
end
-------------------------
--有奖励可领取
if (not show) and info and info.reward_list then
for k,n in pairs(info.reward_list) do
if n.status == 1 then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
end
end
end
end
return show,act_type
end
--黑白棋红点
function KfActivityModel:CheckReversiRedDot( base_type,sub_type )
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not act_list then return false,act_type end
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
-------------------------
local open_level = Config.Modulesub["331@115"] and Config.Modulesub["331@115"].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
if RoleManager.Instance.mainRoleInfo.level >= open_level then
local server_time = TimeUtil:getServerTime( )
if act_list and server_time > act_list.stime and act_list.etime > server_time then
act_type = act_list.act_type
bool = self:GetReversiRedDotBySubType(sub_type)
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
else
self.check_lv_act_open = self.check_lv_act_open or {}
self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
self.check_lv_act_open[open_level][base_type][sub_type] = true
end
return bool,act_type
end
--节日幻魔红点
function KfActivityModel:CheckFestivalBossRedDot( base_type,sub_type )
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not act_list then return false,act_type end
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
-------------------------
local open_level = Config.Modulesub["331@117"] and Config.Modulesub["331@117"].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
if RoleManager.Instance.mainRoleInfo.level >= open_level then
local server_time = TimeUtil:getServerTime( )
if act_list and server_time > act_list.stime and act_list.etime > server_time then
act_type = act_list.act_type
bool = self:GetFestivalBossRedDotBySubType(sub_type)
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
else
self.check_lv_act_open = self.check_lv_act_open or {}
self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
self.check_lv_act_open[open_level][base_type][sub_type] = true
end
return bool,act_type
end
-- 检查活跃拼图红点
function KfActivityModel:CheckJigsawRedDot(base_type, sub_type)
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local reward_cfg = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
local bool = false
local act_type = CustomActivityModel.CustomIconActType.OpAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list and reward_cfg then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
bool = OperateActivityModel:getInstance():GetJigsawRed(sub_type, reward_cfg)
self.act_red_dot_info[base_type][sub_type] = bool
end
end
return bool, act_type
end
-- 检查合成机红点
function KfActivityModel:CheckActComposeRobotRedDot(base_type,sub_type)
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = act_list and act_list.act_type and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
bool = OperateActivityModel:getInstance():GetComposeRobotMainRed(sub_type)
self.act_red_dot_info[base_type][sub_type] = bool
return bool, act_type
end
--检查自选扭蛋红点
function KfActivityModel:CheckActSelectEggRedDot(base_type,sub_type)
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = act_list and act_list.act_type and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
bool = OperateActivityModel:getInstance():GetSelectEggMainRed(sub_type)
self.act_red_dot_info[base_type][sub_type] = bool
return bool, act_type
end
--检查材料上交红点
function KfActivityModel:CheckActMaterialSubmitRedDot( base_type,sub_type )
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = act_list and act_list.act_type or CustomActivityModel.CustomIconActType.OpAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
bool = OperateActivityModel:getInstance():CheckMaterialSubmitRedDot(base_type,sub_type)
self.act_red_dot_info[base_type][sub_type] = bool
return bool, act_type
end
--获得活动信息页签列表
function KfActivityModel:UpdateTab( act_type )
local menu_name_list = {}
local is_chace = {}
local my_level = RoleManager.Instance.mainRoleInfo.level
local open_level = 0
local server_time = TimeUtil:getServerTime( )
for k, v in ipairs(KfActivityModel.TabData) do
open_level = 0
if GetModuleIsOpen(v.module_id,v.base_type)
and v.base_type ~= CustomActivityModel.CustomActBaseType.COPETING --竞榜不在这个判断里面
then
if v.is_most then--是后台定制的活动就要进行数据选取
local sub_type_list = DeepCopy(CustomActivityModel:getInstance():getAllActListByBaseType(v.base_type))
for i,vv in pairs(sub_type_list) do
if act_type == vv.act_type and v.base_type == CustomActivityModel.CustomActBaseType.DUN_MUL_DROP then--副本多倍只有一个页签
vv.id = v.id
vv.sort_id = v.sort_id
table_insert(menu_name_list, vv)
break
else
if act_type == vv.act_type--活动类型首先要相等
and (server_time > vv.stime and vv.etime > server_time --满足活动开放时间
or v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT -- (0元礼包如果有未领的返还也要显示页签不能消失)
or v.base_type == CustomActivityModel.CustomActBaseType.INVEST_ACT -- (投资活动如果有未领的天数奖励,页签不能消失)
or v.base_type == CustomActivityModel.CustomActBaseType.COM_RANK--通用排行
)then
for l,w in pairs(vv.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
break
end
end
if not is_chace[v.base_type] then
is_chace[v.base_type] = {}
end
if not is_chace[v.base_type][vv.sub_type] and open_level <= my_level then
is_chace[v.base_type][vv.sub_type] = vv
vv.id = v.id
vv.sort_id = v.sort_id
if v.base_type == CustomActivityModel.CustomActBaseType.RUSH_RANK then --开服冲榜
local today_list = self:GetTodayRankType()
for n,l in ipairs(today_list) do
local rush_rank_cfg = self:GetRushRankCfg(l)
if rush_rank_cfg then
vv.name = rush_rank_cfg.name
vv.rank_type = l
table_insert(menu_name_list, DeepCopy(vv))
break
end
end
elseif v.base_type == CustomActivityModel.CustomActBaseType.LIMIT_GIFT then --限购礼包
local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,vv.sub_type)
if award_data then
for n,l in pairs(award_data.reward_list) do
if l.status ~= 2 then
table_insert(menu_name_list, DeepCopy(vv))
break
end
end
end
elseif v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT then --0元礼包
if self:CheckZeroGiftTabIsOpen(vv.sub_type) then
table_insert(menu_name_list, DeepCopy(vv))
end
elseif v.base_type == CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING then --开服团购不能是全民动员的嵌入式活动
local is_mobilization_act = false
for n,l in pairs(vv.condition_list) do
if l[1] == "custom_act" and tonumber(l[2]) == 71 then
is_mobilization_act = true
break
end
end
if not is_mobilization_act then
table_insert(menu_name_list, DeepCopy(vv))
end
-- elseif v.base_type == CustomActivityModel.CustomActBaseType.INVEST_ACT then -- 投资活动
-- if self:CheckInvestActTabIsOpen(vv.sub_type) then
-- table_insert(menu_name_list, DeepCopy(vv))
-- end
elseif v.base_type == CustomActivityModel.CustomActBaseType.COM_RANK then -- 通用排行
if self:CheckComRankTabIsOpen(vv.sub_type) then
table_insert(menu_name_list, DeepCopy(vv))
end
elseif v.base_type == CustomActivityModel.CustomActBaseType.SUPER_AWARD then -- 超能大奖
if self:CheckSuperAwardTabIsOpen(v.base_type,vv.sub_type) then
table_insert(menu_name_list, DeepCopy(vv))
end
else
table_insert(menu_name_list, vv)
end
end
end
end
end
else--直接插入 由前端决定是否开放的活动
v.sub_type = 1
table_insert(menu_name_list, v)
end
end
end
--这里判断是否有竞榜开放 然后插入进列表里面
local competing_open_list = CompetingListModel:getInstance():GetCompetingOpenActList(act_type)
if competing_open_list and #competing_open_list > 0 then
for k,v in pairs(competing_open_list) do
table_insert(menu_name_list, v)
end
end
self.menu_name_list = menu_name_list
return menu_name_list
end
--检查超能大奖是否开启
function KfActivityModel:CheckSuperAwardTabIsOpen( base_type,sub_type )
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
local recharge_num = 0
local consume_num = 0
for k,v in pairs(act_list.condition_list) do
if v[1] == "recharge" then
recharge_num = tonumber(v[2])
elseif v[1] == "consume" then
consume_num = tonumber(v[2])
end
end
local cur_recharge_num = 0
local cur_consume_num = 0
local award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
local complete_num = 0
if award_data and award_data.reward_list then
for kk,vv in ipairs(award_data.reward_list) do
if #vv.condition_list == 1 then
for m,n in ipairs(vv.condition_list) do
if n[1] == "recharge" then
cur_recharge_num = vv.progress
break
elseif n[1] == "consume" then
cur_consume_num = vv.progress
break
end
end
end
complete_num = (vv.status == 2 and 1 or 0) + complete_num
end
if recharge_num <= cur_recharge_num and consume_num <= cur_consume_num then
local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
if TableSize(all_act_list) == 1 then--一个的时候直接开 2个只能开一个
return true
elseif TableSize(all_act_list) == 2 then
if recharge_num>0 and consume_num>0 then--判断上一个是否全部完成
for i,v in pairs(all_act_list) do
if v.sub_type ~= sub_type then
complete_num = 0
local sub_award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,v.sub_type)
if sub_award_data then
for kk,vv in ipairs(sub_award_data.reward_list) do
complete_num = (vv.status == 2 and 1 or 0) + complete_num
end
return complete_num >= #sub_award_data.reward_list
end
end
end
else
return complete_num < #award_data.reward_list
end
end
end
end
end
return false
end
function KfActivityModel:CheckActivityIdOpen( act_type,id )
if id then
local data = self:UpdateTab(act_type)
local item_data = nil
for k,v in pairs(data) do
if v.id == id then
item_data = v
break
end
end
if not item_data then
return false
end
end
return true
end
function KfActivityModel:GetTodayRankType()--获得当天的冲榜类型
local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
local rank_type_list = {}
for _, v in pairs(Config.Rushrank) do
if openDay >= tonumber(v.start_day) and openDay <= tonumber(v.clear_day) - 1 then
rank_type_list[#rank_type_list + 1] = tonumber(v.id)
end
end
if #rank_type_list >= 2 then
local sort_func = function ( a, b )
return a < b
end
table.sort(rank_type_list, sort_func)
end
return rank_type_list
end
function KfActivityModel:GetRankTypeOpenDay(rank_type)--获得当天的冲榜类型
for _, v in pairs(Config.Rushrank) do
if v.id == rank_type then
return v.start_day
end
end
return 1
end
--设置冲榜信息
function KfActivityModel:SetRushRankInfo(vo)
local new_rank_list = {}
for i,v in ipairs(vo.rank_list) do
new_rank_list[v.rank] = v
end
vo.rank_list = new_rank_list
if not self.rush_rank_info[vo.sub_type] then
self.rush_rank_info[vo.sub_type] = {}
end
self.rush_rank_info[vo.sub_type][vo.rank_type] = vo
local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
local op_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
for k, v in pairs(op_act_list) do
if v.act_type == CustomActivityModel.CustomIconActType.KfAct then--开服冲榜
self:CheckActIconBoolOpen(v.sub_type)
break
end
end
end
function KfActivityModel:GetRushRankInfo(sub_type,rank_type)
if self.rush_rank_info[sub_type] then
return self.rush_rank_info[sub_type][rank_type]
end
end
--设置目标奖励信息
function KfActivityModel:SetTargetRewardList(vo)
self.target_reward_list = {}
for i,v in ipairs(vo.goal_list) do
if not self.target_reward_list[v.rank_type] then
self.target_reward_list[v.rank_type] = {}
end
self.target_reward_list[v.rank_type][v.goal] = v
end
self:IsNeedRed(KfActivityModel.TabID.RushRank,nil,vo.sub_type)
end
function KfActivityModel:GetTargetRewardList( rank_type )
return self.target_reward_list[rank_type]
end
--获得冲榜配置
function KfActivityModel:GetRushRankCfg( rank_type )
return self.rush_rank_cfg[rank_type]
end
--获得冲榜总配置
function KfActivityModel:GetAllRushRankCfg( rank_type )
return self.rush_rank_cfg
end
--获得冲榜奖励配置
function KfActivityModel:GetRushRankAwardCfg( id )
return self.rush_rank_award_cfg[id]
end
function KfActivityModel:GetRushGoalAwardCfg( id )
return self.rush_rank_goal_cfg[id]
end
--获得排名配置
function KfActivityModel:GetRushRankListCfg( id )
local award_cfg =DeepCopy(self:GetRushRankAwardCfg(id))
local rank_list = {}
local rank_limit_list = {}
if award_cfg then
for i,v in ipairs(award_cfg) do
for k=v.rank_min,v.rank_max do
rank_list[k] = v.rank_limit
local str_list = Split(Trim(v.about),"@") or {"",""}
rank_limit_list[k] = str_list and str_list[2] or ""
end
end
end
return rank_list,rank_limit_list
end
--得到冲榜阶级说明
function KfActivityModel:GetRushRankLimitInfo(limit,index)
local limitStr, value1, value2 = "", nil, nil
index = index or 1
if TableSize(limit) > 0 then
local str = tostring(limit[index][1])
if Trim(str) == "lv" then
limitStr = "等级"
value1 = tonumber(limit[index][2])
elseif Trim(str) == "combat" then
limitStr = "战力"
value1 = tonumber(limit[index][2])
elseif Trim(str) == "gold" then
limitStr = "充值"
value1 = tonumber(limit[index][2])
elseif Trim(str) == "stone_lv" then
limitStr = "宝石"
value1 = tonumber(limit[index][2])
elseif Trim(str) == "horse_stage" then
limitStr = "坐骑"
value1 = tonumber(limit[index][2][1])
value2 = tonumber(limit[index][2][2])
elseif Trim(str) == "pet_stage" then
limitStr = "AI娘"
value1 = tonumber(limit[index][2][1])
value2 = tonumber(limit[index][2][2])
end
end
return Trim(str), limitStr, value1, value2
end
--累充充值总数
function KfActivityModel:SetRecharge(base_type, sub_type, number)
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
if act_list then
self.seven_recharge_total = self.seven_recharge_total or {}
self.seven_recharge_total[sub_type] = number
if not self.recharge_total then
self.recharge_total = {}
end
if not self.recharge_total[base_type] then
self.recharge_total[base_type] = {}
end
self.recharge_total[base_type][sub_type] = number
end
end
function KfActivityModel:SetZeroGiftInfo( vo )
local new_data = {}
for kk,vv in pairs(vo.reward_list) do
new_data[vv.grade] = vv
end
vo.reward_list = new_data
if vo and vo.sub_type then
self.zero_gift_view_info[vo.sub_type] = {}
self.zero_gift_view_info[vo.sub_type] = vo
else
self.zero_gift_view_info[vo.sub_type] = {}
end
self:ZeroGiftNeedTimeLater()
-- local is_show_time = vo.start_time and (vo.start_time - TimeUtil:getServerTime()) > 0
local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
local act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type) or {}
for k, v in pairs(act_list) do
if v.act_type == CustomActivityModel.CustomIconActType.GiftAct then--限时礼包类型
self:CheckActIconBoolOpen(v.sub_type)
break
end
end
end
function KfActivityModel:GetZeroGiftInfo(sub_type)
return self.zero_gift_view_info[sub_type] or nil
end
function KfActivityModel:GetZeroGiftGradeInfo(sub_type,grade)
if not self.zero_gift_view_info[sub_type] then return nil end
for k,v in pairs(self.zero_gift_view_info[sub_type].reward_list) do
if v.grade == grade then
return v
end
end
return nil
end
function KfActivityModel:ZeroGiftNeedTimeLater( )--是否需要倒计时刷新
for k,v in pairs(self.zero_gift_view_info) do
local limit_time = 0
local limit_data = nil
for kk,vv in pairs(v.reward_list) do
if vv.time - TimeUtil:getServerTime() > 0 then
if limit_time - TimeUtil:getServerTime() > 0 then
if limit_time > vv.time then
limit_time = vv.time
limit_data = vv
end
else
limit_time = vv.time
limit_data = vv
end
end
end
if limit_time - TimeUtil:getServerTime() > 0 then
self:SetZeroGiftActDetailShow(v.sub_type,limit_data)
else
if self.zero_gift_time_id_list[v.sub_type] then
GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[v.sub_type])
self.zero_gift_time_id_list[v.sub_type] = nil
end
end
end
end
function KfActivityModel:SetZeroGiftActDetailShow( sub_type,data )
if self.zero_gift_time_id_list[sub_type] then
GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
self.zero_gift_time_id_list[sub_type] = nil
end
if not sub_type or not data.time then return end
local sec = data.time - TimeUtil:getServerTime()
if sec >= 0 then
local function onTimer()
sec = data.time - TimeUtil:getServerTime()
if sec >= 0 then
-- print("WQ:AllGiftModel [155]倒计时领奖中: ",sec)
else
if self.zero_gift_time_id_list[sub_type] then
local function delay_method( )
self:Fire(KfActivityModel.REQUEST_INFO,33185,CustomActivityModel.CustomActBaseType.ZERO_GIFT,sub_type)
end
setTimeout(delay_method, 0.5)
GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
self.zero_gift_time_id_list[sub_type] = nil
end
end
end
if not self.zero_gift_time_id_list[sub_type] then
self.zero_gift_time_id_list[sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
end
else
if self.zero_gift_time_id_list[sub_type] then
GlobalTimerQuest:CancelQuest(self.zero_gift_time_id_list[sub_type])
self.zero_gift_time_id_list[sub_type] = nil
end
end
end
--设置团购信息
function KfActivityModel:SetGroupBuyingInfo( scmd )
local list = {}
for k,v in pairs(scmd.list) do
list[v.grade] = v
end
scmd.list = list
self.group_buying_view_info[scmd.sub_type] = scmd
end
--团购信息推送 设置信息
function KfActivityModel:SetGroupBuyingInfoByGrade( scmd )
if self.group_buying_view_info[scmd.sub_type] and self.group_buying_view_info[scmd.sub_type].list
and self.group_buying_view_info[scmd.sub_type].list[scmd.grade] then
self.group_buying_view_info[scmd.sub_type].list[scmd.grade] = scmd
end
end
function KfActivityModel:GetGroupBuyingInfo( sub_type )
return self.group_buying_view_info[sub_type]
end
--团购倒计时
function KfActivityModel:KfGroupBuyingTimeLater( sub_type )
if self.groupBuying_time_id_list[sub_type] then
GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
self.groupBuying_time_id_list[sub_type] = nil
end
if not sub_type or not self.group_buying_time_list[sub_type] then return end
if self.group_buying_time_list[sub_type] > 0 then
local function onTimer()
self.group_buying_time_list[sub_type] = self.group_buying_time_list[sub_type] - 1
if self.group_buying_time_list[sub_type] >= 0 then
else
if self.groupBuying_time_id_list[sub_type] then
GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
self.groupBuying_time_id_list[sub_type] = nil
end
end
end
if not self.groupBuying_time_id_list[sub_type] then
self.groupBuying_time_id_list[sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
end
else
if self.groupBuying_time_id_list[sub_type] then
GlobalTimerQuest:CancelQuest(self.groupBuying_time_id_list[sub_type])
self.groupBuying_time_id_list[sub_type] = nil
end
end
end
--检查开服团购红点子类型
function KfActivityModel:CheckKfGroupBuyingSubTypeRedDot( sub_type )
local info = self:GetGroupBuyingInfo(sub_type)
local base_type = CustomActivityModel.CustomActBaseType.KF_GROUP_BUYING
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
if not info or not info.list then
self.act_red_dot_info[base_type][sub_type] = false
return
end
local sort_func = function ( a, b )
return a.grade < b.grade
end
self.act_red_dot_info[base_type][sub_type] = false
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
local jin_enough = false
if award_data and award_data.reward_list and info.list then
local gold_type = 0
local original_price = 0
local discount_list = nil
local member_list = nil
table.sort(award_data.reward_list, sort_func)
for kk,vv in ipairs(award_data.reward_list) do
for m,n in ipairs(vv.condition_list) do
if n[1] == "gold_type" then
gold_type = tonumber(n[2])
elseif n[1] == "original_price" then
original_price = tonumber(n[2])
elseif n[1] == "discount" then
discount_list = n[2]
elseif n[1] == "member" then
member_list = n[2]
end
end
if info.list[vv.grade] and gold_type == 2 then
local is_buy = info.list[vv.grade].price ~= 0--是否购买
local cur_discount = self:GetKfGroupBuyingCurDiscount(discount_list,member_list,info.list[vv.grade].member)
if not is_buy and not jin_enough then
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
end
local get_num = is_buy and (info.list[vv.grade].price - cur_discount*original_price/10) or 0
self.act_red_dot_info[base_type][sub_type] = get_num > 0
if get_num > 0 then
break
end
end
end
end
-- local group_red_list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.GROUP_BUYING) or {}
-- if group_red_list[sub_type] == nil then
-- group_red_list[sub_type] = true
-- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.GROUP_BUYING,group_red_list)
-- CookieWrapper.Instance:WriteAll()
-- end
if self.group_red_list[sub_type] == nil and not jin_enough then--买不起 没红点
self.group_red_list[sub_type] = false
end
if self.group_red_list[sub_type] == false and jin_enough then--本来买不起 突然有钱了 买的起 那就要有红点了。
self.group_red_list[sub_type] = nil
end
if self.group_red_list[sub_type] == nil then
for i,v in ipairs(info.list) do
local is_buy = v.price ~= 0--是否购买
if not is_buy then--未购买
self.act_red_dot_info[base_type][sub_type] = true
break
end
end
end
-- print("huangcong:KfActivityModel [start:1792] :", self.act_red_dot_info[base_type])
-- PrintTable(self.act_red_dot_info[base_type])
-- print("huangcong:KfActivityModel [end]")
end
--获取当前折数
function KfActivityModel:GetKfGroupBuyingCurDiscount( discount_list,member_list,member )
local cur_discount = 0
if discount_list and #discount_list > 0 then
local member_num = member or 0
for i,v in ipairs(member_list) do
if tonumber(v) <= member_num then
cur_discount = tonumber(discount_list[i])
end
end
end
cur_discount = cur_discount < 0 and 0 or cur_discount
return cur_discount
end
--获得补签消耗
function KfActivityModel:GetMonopolyDesignPrice( count )
if Config.Monoprice[count] then
return Config.Monoprice[count].price
end
return 0
end
--获得大富翁圈数格子配置
function KfActivityModel:GetMonopolyLatticeCfg( round,index )
if not index then
return self.mono_lattice_cfg[round]
elseif self.mono_lattice_cfg[round] then
return self.mono_lattice_cfg[round][index]
end
end
--获得小宝箱奖励
function KfActivityModel:GetMonopolySmallBoxAward( index )
return self.mono_smallbox_award_cfg[index]
end
--获得幸运卡奖励
function KfActivityModel:GetMonopolyLuckyAward( index )
return self.mono_lucky_award_cfg[index]
end
--获得大富翁圈数奖励
function KfActivityModel:GetMonopolyRoundAward( sub_type,round )
if self.mono_round_award_cfg[sub_type] and not round then
return self.mono_round_award_cfg[sub_type]
elseif self.mono_round_award_cfg[sub_type] then
return self.mono_round_award_cfg[sub_type][round]
end
end
--设置大富翁信息
function KfActivityModel:SetMonopolyInfo( vo )
local new_data = vo
-- local new_lucky_pools = {}
-- for k,v in pairs(vo.lucky_pools) do
-- new_lucky_pools[v.index] = v
-- end
local new_dice_list = {}
for k,v in pairs(vo.dice_list) do
new_dice_list[v.index] = v
end
local new_circle_rewards = {}
for k,v in pairs(vo.circle_rewards) do
new_circle_rewards[v.circle] = v
end
-- new_data.lucky_pools = new_lucky_pools
if #vo.lucky_pools > 1 then
local sort_func = function ( a, b )
return a.index < b.index
end
table.sort(vo.lucky_pools, sort_func)
end
-- print("huangcong:KfActivityController [start:547] vo:", vo.lucky_pools)
-- PrintTable(vo.lucky_pools)
-- print("huangcong:KfActivityController [end]")
new_data.dice_list = new_dice_list
new_data.circle_rewards = new_circle_rewards
self.monopoly_info[vo.sub_type] = vo
end
--获得大富翁信息
function KfActivityModel:GetMonopolyInfo( sub_type )
return self.monopoly_info[sub_type]
end
--检查活动图标(开服活动 精彩活动 主题活动)开启
function KfActivityModel:CheckActIconBoolOpen( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
local level = RoleManager.Instance.mainRoleInfo.level
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
local is_open = false
local end_time = 0
local open_level = 1
local close_level = 9999
local icon_sub_type = base_type*1000 + sub_type
if sub_type >= 10001 then
icon_sub_type = base_type*100000 + sub_type
end
if act_list and act_list.etime then
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
elseif type(w) == "table" and w[1] == "close_lv" then
close_level = tonumber(w[2])
end
end
local have_time = TimeUtil:getServerTime( ) - act_list.stime
end_time = act_list.etime - TimeUtil:getServerTime()
is_open = have_time > 0 and end_time > 0 and open_level <= level and close_level > level
if GetModuleIsOpen(331,base_type) then
if is_open then
if act_list.act_type == CustomActivityModel.CustomIconActType.JcAct then--开服狂huan
local act_sub_list = self:UpdateTab(act_list.act_type)
if TableSize(act_sub_list) > 0 then
self:UpdateZeroGiftIconState(icon_sub_type)
end
end
if act_list.act_type == CustomActivityModel.CustomIconActType.GiftAct then
local act_sub_list = self:UpdateTab(act_list.act_type)
if TableSize(act_sub_list) > 0 then
local min_time = self:GetActiListMinTime(act_sub_list)
if min_time and min_time > 0 then
local str = nil
if openDay <= 4 and level < 110 then
str = "110级可领"
end
ActivityIconManager:getInstance():addIcon(icon_sub_type, min_time, str)
else
ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
end
else
ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
end
elseif act_list.act_type == CustomActivityModel.CustomIconActType.KfAct and openDay <= 8 then--开服排行开服前8天底下要显示开服冲榜信息
local rank_type_list = self:GetTodayRankType()
local rank_sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.RUSH_RANK)
local rank_info = self:GetRushRankInfo(rank_sub_type,rank_type_list and rank_type_list[1])
local str = "今日主题"
local rank_max_limit = self:GetRushRankMaxLimit(rank_type_list and rank_type_list[1])--冲榜最大限制
if rank_info and rank_info.sel_rank and rank_info.sel_rank ~= 0 and rank_info.sel_rank <= rank_max_limit then
str = string.format("排名:%s",rank_info.sel_rank)
end
ActivityIconManager:getInstance():addIcon(icon_sub_type, -1, str)
else
ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
end
else
ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
end
else
-- print("huangcong:KfActivityModel [62]: ",key)
end
else
ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
end
end
-- 0元礼包特殊更新逻辑
function KfActivityModel:UpdateZeroGiftIconState(icon_sub_type)
if RoleManager.Instance.mainRoleInfo.level > 96 then return end
local zeroGiftHaveOpen = self:GetZeroGiftFirstOpenCookie()
-- print("Lizhijian:KfActivityModel [start:2264] self.haveBubble ------------------------------------------")
-- 零元礼包界面打开后不显示气泡
if not zeroGiftHaveOpen and not self.haveBubble then
self.haveBubble = true
-- 0元礼包气泡提示 前端自定义配置,可修改
local act_icon_info = {
condition_list = {
{ 'type', 0}, -- 0为直接读取图片,1为读取程序字
{ 'role_lv', 96},
{ 'func', icon_sub_type},
{ 'show', 999}, -- 显示时长
{ 'node', {0}},
{ 'loc', 'right'},
{'bg_type', 36} -- 气泡样式,对应1或者2的资源后缀
},
stime = 0,
base_type = 999,
sub_type = -1, -- 气泡显示优先级,-1为最高优先级
etime = 2147000000, --INT_MAX
desc = "免费送SR战魂", -- 气泡文本内容
condition = "",
is_first_open = 0,
wlv = 948,
name = "0元礼包",
act_type = CustomActivityModel.CustomIconActType.JcAct,
}
local function delay_func( ... )
ActivityIconManager:getInstance():SetActivityIconCustomDescInfo(act_icon_info)
end
setTimeout(delay_func,60)
end
-- 零元礼包界面打开后不显示光效
local icon_data = ActivityIconManager:getIconCfg(icon_sub_type)
if zeroGiftHaveOpen then
icon_data.effect_name = nil
else
icon_data.effect_name = "ui_bianqiang"
end
ActivityIconManager:SetIconNewCfgInfo(icon_data)
GlobalEventSystem:Fire(ActivityIconManager.UPDATE_SINGLE_ICON,icon_sub_type)
end
--获得活动列表最小时间
function KfActivityModel:GetActiListMinTime( all_list )
local my_level = RoleManager.Instance.mainRoleInfo.level
local min_end_time = nil
local server_time = TimeUtil:getServerTime( )
for k,v in pairs(all_list) do
local open_level = Config.Modulesub["331@"..v.base_type].open_lv or 1
local end_time = v.etime
for l,w in pairs(v.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
break
end
end
if server_time > v.stime and end_time > server_time then--暂时先用这个不然看不到
if my_level >= open_level and GetModuleIsOpen(331,v.base_type) then
if v.base_type == CustomActivityModel.CustomActBaseType.ZERO_GIFT then--0元礼包的拿自己的数据
local zero_info = self:GetZeroGiftInfo(v.sub_type)
if zero_info and zero_info.reward_list then
for kk,vv in pairs(zero_info.reward_list) do
if vv.status ~= 2 then
if not min_end_time then
min_end_time = end_time - TimeUtil:getServerTime( )
else
min_end_time = (end_time - TimeUtil:getServerTime( )) < min_end_time and (end_time - TimeUtil:getServerTime( )) or min_end_time
end
end
end
end
else
local award_data = CustomActivityModel:getInstance():getOneActRewardList(v.base_type,v.sub_type)
if award_data and award_data.reward_list then
for ii,vv in pairs(award_data.reward_list) do
if vv.status ~= 2 then
if not min_end_time then
min_end_time = end_time - TimeUtil:getServerTime( )
else
min_end_time = (end_time - TimeUtil:getServerTime( )) < min_end_time and (end_time - TimeUtil:getServerTime( )) or min_end_time
end
end
end
end
end
end
end
end
return min_end_time
end
--检查活动图标升级刷新
function KfActivityModel:CheckActIconLevelUp( level )
if level >= Config.Modulesub["331@99"].open_lv then--主题活动判断等级
local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY)
if all_act_list then
for i,v in pairs(all_act_list) do
for l,w in pairs(v.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
local open_level = tonumber(w[2])
if open_level == level or level == Config.Modulesub["331@99"].open_lv then
self:CheckActIconBoolOpen(v.sub_type)
self:CheckMainIconRedDot(v.act_type)
end
end
end
end
end
end
end
--获得活动类型资源
function KfActivityModel:GetActTypeRes( act_type )
return KfActivityConst.ActTypeRes[act_type]
end
--获得界面类
function KfActivityModel:GetViewClassAndDesc(id,choose_tab_data)
local view_class = self.act_view_class[id]
local desc_str = ""
if choose_tab_data.base_type and choose_tab_data.sub_type then
local act_list = CustomActivityModel:getInstance():getActList(choose_tab_data.base_type, choose_tab_data.sub_type)
if act_list then
if string.len(act_list.desc) == 0 and choose_tab_data.base_type == 7 then
desc_str = string.format("%s",HtmlColorTxt("活动期间,每日累充到一定金额,即可领取丰厚的返利奖励!", ColorUtil.WHITE_DARK))
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.MONOPOLY then--大富翁说明在界面里面
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.Competing then--竞榜有自己的时间
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.DUN_MUL_DROP then--竞榜有自己的时间
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.BOSS_TREASURE then--幻魔宝典
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.RUSH_RANK then--幻魔宝典
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.FESTIVAL_BOSS then--节日幻魔
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.LOGIN_PASS then
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT then--合成机自己有额外说明
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT then
desc_str = ""
elseif choose_tab_data.base_type == CustomActivityModel.CustomActBaseType.JUMP_ONE then
desc_str = ""
else
local desc = ChuanWenManager:getInstance():FormatColorTag2(Trim(act_list.desc),true)
desc_str = string.format("%s",desc)
end
else
desc_str = ""
end
end
if string.len(desc_str) ~= 0 then
desc_str = string.format("<color=%s>活动说明:</color>%s","#a9c1e1",desc_str) or ""
end
return view_class,desc_str
end
--获得活动类型
function KfActivityModel:GetActType(sub_type,id)
local act_type = nil
if id == KfActivityModel.TabID.Competing and sub_type then
local competing_cfg = CompetingListModel:getInstance():GetCompetingCfg(sub_type)
if competing_cfg then
local icon_act_type = CustomActivityModel.CustomIconActType.KfAct--默认放在开服活动图标里面
for k,v in pairs(competing_cfg.condition) do
if v[1] == "icon" then
act_type = tonumber(v[2])
break
end
end
end
return act_type
end
local server_time = TimeUtil:getServerTime()
if id then
for k,v in pairs(KfActivityModel.TabData) do
if v.id == id then
local base_type = v.base_type
local all_act_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
local open_level = 1
for kk,vv in pairs(all_act_list) do
open_level = 1
if server_time > vv.stime and vv.etime > server_time and (not sub_type or sub_type == vv.sub_type) then--满足活动开放时间(0元礼包如果有未领的返还也要显示页签不能消失)
for l,w in pairs(vv.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
break
end
end
if open_level <= RoleManager.Instance.mainRoleInfo.level then
act_type = vv.act_type
break
end
end
end
break
end
end
else
local base_type = CustomActivityModel.CustomActBaseType.OPERATE_ACTIVITY
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
if act_list then
act_type = act_list.act_type
end
end
return act_type
end
--设置嗨点活动信息
function KfActivityModel:SetHighPointInfo( scmd )
if not self.high_info then
self.high_info = {}
end
if not self.high_info[scmd.base_type] then
self.high_info[scmd.base_type] = {}
end
if not self.high_info[scmd.base_type][scmd.sub_type] then
self.high_info[scmd.base_type][scmd.sub_type] = {}
end
self.high_info[scmd.base_type][scmd.sub_type] = scmd
local sort_func = function ( a, b )
return a.order_id < b.order_id
end
table.sort(scmd.mod_list, sort_func)
local new_mod_list = {}
for i,v in ipairs(scmd.mod_list) do
local data = v
local jump_id_list = stringtotable(data.jump_id)
if jump_id_list then
data.jump_id = jump_id_list[1]
end
new_mod_list[#new_mod_list + 1] = data
end
self.high_info[scmd.base_type][scmd.sub_type].mod_list = scmd.mod_list
if scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then--嗨点更新
self:IsNeedRed(KfActivityModel.TabID.HighPoint,nil,scmd.sub_type)
elseif scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换更新
self:IsNeedRed(KfActivityModel.TabID.HighExchange,nil,scmd.sub_type)
end
end
--嗨点总数推送 需要刷新红点
function KfActivityModel:SetHighPointSumNum( scmd )
if self.high_info[scmd.base_type] and self.high_info[scmd.base_type][scmd.sub_type] then
self.high_info[scmd.base_type][scmd.sub_type].sum_points = scmd.sum_points
end
if scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then--嗨点更新
self:IsNeedRed(KfActivityModel.TabID.HighPoint,nil,scmd.sub_type)
elseif scmd.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then--嗨点兑换更新
self:IsNeedRed(KfActivityModel.TabID.HighExchange,nil,scmd.sub_type)
end
end
--获得嗨点兑换资源图标
function KfActivityModel:GetHighExchangeIconPic( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE
sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
for k,v in pairs(act_list.condition_list) do
if v[1] and v[2] then
if v[1] == "act_icon_pic" then
return tonumber(v[2])
end
end
end
end
return 1
end
--获得嗨点红点资源信息
function KfActivityModel:GetHighPointInfo( base_type, sub_type )
if self.high_info[base_type] then
return self.high_info[base_type][sub_type]
end
end
--检查嗨点红点
function KfActivityModel:CheckHighPointRedDot(base_type,sub_type)
-- if not GetModuleIsOpen(331,base_type) or not sub_type then return false end
if not sub_type then return false end
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local show = false
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
local info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
if server_time > act_list.stime and act_list.etime > server_time then
if info and info.reward_list then
for k,n in pairs(info.reward_list) do
if n.status == 1 then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
elseif n.status == 0 then
local parse = n.condition_list
if parse then
local max = 0
local limit_time = 0
for kk,vv in pairs(parse) do--[{hi_points,250},{limit_times,1},{tag,1},{show_level_range,1,999}]
if vv[1] == "hi_points" then
max = tonumber(vv[2])
elseif vv[1] == "limit_times" then
limit_time = tonumber(vv[2])
end
end
local max = tonumber(parse[1][2])
local server_info = self:GetHighPointInfo(act_list.base_type,act_list.sub_type)
local cur = 0
if server_info and server_info.sum_points then
cur = server_info.sum_points
end
if act_list.base_type == CustomActivityModel.CustomActBaseType.HIGH_POINT then
if cur >= max then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
elseif act_list.base_type == CustomActivityModel.CustomActBaseType.HIGH_EXCHANGE then
if limit_time > n.receive_times and (cur >= max or not self.high_login_red_list[act_list.sub_type]) then
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = true
show = true
end
end
end
end
end
end
end
end
return show,act_type
end
-- 设置投资活动数据 33141
function KfActivityModel:SetInvestActData(vo)
self.invest_event_data[vo.sub_type] = self.invest_event_data[vo.sub_type] or {}
self.invest_event_data[vo.sub_type].sub_type = vo.sub_type
self.invest_event_data[vo.sub_type].investment_list = vo.investment_list
end
function KfActivityModel:GetInvestActData(sub_type, grade)
if grade then
if self.invest_event_data[sub_type]
and self.invest_event_data[sub_type].investment_list then
for k, v in pairs(self.invest_event_data[sub_type].investment_list) do
if v.grade == grade then
return v
end
end
end
return nil
else
return self.invest_event_data[sub_type]
end
end
-- 获取投资档位的天数奖励领取情况
function KfActivityModel:GetInvestActGradeReceiveFlag(sub_type, grade, day_num)
local grade_data = self:GetInvestActData(sub_type, grade)
if grade_data then
for k, v in ipairs(grade_data.awards) do
if v.award_id == day_num then
return v.status -- 0不可领 1可领 2已领
end
end
end
return 0
end
-- 更新投资档位的购买情况 33142
function KfActivityModel:UpdateInvestActBuyFlag(vo)
self.invest_event_data[vo.sub_type] = self.invest_event_data[vo.sub_type] or {}
self.invest_event_data[vo.sub_type].investment_list = self.invest_event_data[vo.sub_type].investment_list or {}
for k, v in pairs(self.invest_event_data[vo.sub_type].investment_list) do
if v.grade == vo.grade then
v.is_buy = 1
break
end
end
end
-- 更新投资活动数据 33144
function KfActivityModel:UpdateInvestActData(vo)
if self.invest_event_data[vo.sub_type]
and self.invest_event_data[vo.sub_type].investment_list then
for k, grade_data in ipairs(self.invest_event_data[vo.sub_type].investment_list) do
if grade_data.grade == vo.grade then
for k2, v in ipairs(grade_data.awards) do
if v.award_id == vo.day then
v.status = 2
break
end
end
break
end
end
end
end
-- 检查目标子活动页签是否显示
function KfActivityModel:CheckInvestActTabIsOpen(sub_type)
local invest_data = self:GetInvestActData(sub_type)
if invest_data then
for k, v in ipairs(invest_data.investment_list) do
if v.is_buy == 0 then -- 存在未购买,则显示页签
return true
end
-- 已购买的要判断是否有未领取的奖励
for k2, v2 in ipairs(v.awards) do
if v2.status ~= 2 then -- 存在不可领或者可领取的,则显示页签
return true
end
end
end
end
return false
end
-- 检查投资活动红点
function KfActivityModel:CheckActInvestRedDot(sub_type)
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.INVEST_ACT, sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
self.invest_grade_red_cache[sub_type] = self.invest_grade_red_cache[sub_type] or {}
if act_list then
act_type = act_list.act_type
if not self.act_red_dot_info[act_list.base_type] then
self.act_red_dot_info[act_list.base_type] = {}
end
local invest_data = self:GetInvestActData(sub_type)
if invest_data then
for k, v in ipairs(invest_data.investment_list) do
local grade_red = false
if v.is_buy == 1 then
for k2, v2 in ipairs(v.awards) do
grade_red = grade_red or v2.status == 1
end
end
bool = bool or grade_red
-- 同时缓存投资的档位红点
self.invest_grade_red_cache[sub_type][v.grade] = grade_red
end
end
if not bool then
local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(act_list.base_type,act_list.sub_type)
if com_act_red_info then
bool = com_act_red_info.status == 1
end
if not bool and com_act_red_info and com_act_red_info.tab_list then--投资活动比较特殊
for i,v in ipairs(com_act_red_info.tab_list) do
if v.status == 1 then
bool = true
break
end
end
end
end
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
return bool, act_type
end
-- 获取缓存的投资档位红点
function KfActivityModel:GetInvestActGradeRed(sub_type, grade)
local show_red = self.invest_grade_red_cache[sub_type] and self.invest_grade_red_cache[sub_type][grade] or false
if not show_red then
local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(CustomActivityModel.CustomActBaseType.INVEST_ACT,sub_type)
if com_act_red_info and com_act_red_info.tab_list then--投资活动比较特殊
for i,v in ipairs(com_act_red_info.tab_list) do
if v.status == 1 and v.grade == grade then
show_red = true
break
end
end
end
end
return show_red
end
function KfActivityModel:CheckLuckyTurnTableRedDot(sub_type)
local need_red = false
local data1 = OperateActivityModel:getInstance():GetLuckyTurnTableBaseInfo(sub_type, 1)
local data2 = OperateActivityModel:getInstance():GetLuckyTurnTableBaseInfo(sub_type, 2)
if TableSize(data1) > 0 then
local rest_num = data1.times - data1.use_times
need_red = need_red or rest_num > 0
end
if TableSize(data2) > 0 then
local rest_num = data2.times - data2.use_times
need_red = need_red or rest_num > 0
end
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE, sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE] then
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE] = {}
end
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LUCKY_TURNTABLE][sub_type] = need_red
else
need_red = false
end
end
return need_red,act_type
end
--秒杀基础信息
function KfActivityModel:SetSecKillBaseInfo( vo )
self.limit_seckill_base_info = vo
self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_INFO)
-- 加个即将开始的倒计时timer提醒
local cur_time = TimeUtil:getServerTime( )
local cur_round = vo.round
self:InitSeckillCache(vo.sub_type)
-- 场次排序
local sort_func = function ( a, b )
return a.round_id < b.round_id
end
table.sort(self.limit_seckill_base_info.round_info, sort_func)
if not (self:GetSecKillRemindCache()[vo.sub_type] == true) then return end -- 判断是否要提醒
self.limit_sec_kill_has_show_cache = self.limit_sec_kill_has_show_cache or {}
self.limit_sec_kill_has_show_cache[vo.sub_type] = self.limit_sec_kill_has_show_cache[vo.sub_type] or {}
if self.limit_sec_kill_has_show_cache[vo.sub_type][cur_round] then -- 弹过的场次就别再弹了
return
end
for k,v in pairs(self.limit_seckill_base_info.round_info) do
local zero_time = TimeUtil:GetToDayNHourStr(0)
local cfg_open_time = stringtotable(v.round_time)
local open_time = zero_time + 60*60*cfg_open_time[1] + 60*cfg_open_time[2] + cfg_open_time[3]--算出开放的时间戳
local end_time = open_time + v.duration
local is_end = (cur_time - end_time) >= 0 or v.round_id < cur_round--是否结束了
local is_open = (cur_time - open_time) >= 0--是否开启了
--开抢前五分钟就要开始倒计时了
if not is_end and not is_open then
local open_act_remind_tips = function ()
self.limit_sec_kill_has_show_cache[vo.sub_type][cur_round] = true -- 弹过的场次就别再弹了
local click_event = function () -- 跳转活动
GlobalEventSystem:Fire(KfActivityModel.OPEN_ACTIVITY_BASE_VIEW,
vo.sub_type, KfActivityModel.TabID.LimitSeckill)
end
local data = {
winId = KfActivityModel.TabID.LimitSeckill,
sub_type = vo.sub_type,
click_event = click_event,
}
GlobalEventSystem:Fire(EventName.SHOW_COMMON_ACT_REMIND_TIPS,data)
end
if (open_time - cur_time) <= 120 then -- 已经准备开始了 就弹
open_act_remind_tips()
elseif cur_round == v.round_id then -- 就是当前场次
local function onTimer()
local cur_time = TimeUtil:getServerTime( )
if (open_time - cur_time) <= 120 then
open_act_remind_tips()
if self.act_sec_kill_timer_list[vo.sub_type] then
GlobalTimerQuest:CancelQuest(self.act_sec_kill_timer_list[vo.sub_type])
self.act_sec_kill_timer_list[vo.sub_type] = nil
end
end
end
if not self.act_sec_kill_timer_list then
self.act_sec_kill_timer_list = {}
end
if self.act_sec_kill_timer_list[vo.sub_type] then
GlobalTimerQuest:CancelQuest(self.act_sec_kill_timer_list[vo.sub_type])
self.act_sec_kill_timer_list[vo.sub_type] = nil
end
self.act_sec_kill_timer_list[vo.sub_type] = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
onTimer()
end
end
end
end
function KfActivityModel:GetSecKillBaseInfo( )
return self.limit_seckill_base_info
end
function KfActivityModel:IsSecKillAllRoundEnd( )
local base_info = self:GetSecKillBaseInfo()
local last_round_info = base_info.round_info[#base_info.round_info]
local cur_round = base_info.round
if last_round_info.round_id > cur_round then
return false
end
local cur_time = TimeUtil:getServerTime( )
local zero_time = TimeUtil:GetToDayNHourStr(0)
local cfg_open_time = stringtotable(last_round_info.round_time)
local open_time = zero_time + 60*60*cfg_open_time[1] + 60*cfg_open_time[2] + cfg_open_time[3]--算出开放的时间戳
local end_time = open_time + last_round_info.duration
local is_end = (cur_time - end_time) >= 0 --是否结束了
return is_end
end
--场次信息
function KfActivityModel:SetSecKillRoundInfo( vo )
local data = {}
local condition = nil
for i,v in ipairs(vo.round_info) do
data[i] = v
condition = stringtotable(v.condition)
for ii,vv in ipairs(condition) do
data[i][vv[1]] = vv[2]
end
end
if not self.limit_seckill_round_info[vo.round] then
self.limit_seckill_round_info[vo.round] = {}
end
local sort_func = function ( a, b )
return a.grade_id < b.grade_id
end
table.sort(data, sort_func)
self.limit_seckill_round_info[vo.round] = data
self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO)
end
function KfActivityModel:GetSecKillRoundInfo( round )
if round then
return self.limit_seckill_round_info[round] or {}
end
return {}
end
--更新一个信息
function KfActivityModel:SetSecKillOneInfo(round, grade_id, is_my)
if not round or not grade_id then
return
end
if self.limit_seckill_round_info[round] then
for i,v in ipairs(self.limit_seckill_round_info[round]) do
if v.grade_id == grade_id then
if is_my then
v.self_buy = v.self_buy + 1
else
v.buy_count = v.buy_count + 1
end
break
end
end
end
self:Fire(KfActivityModel.UPDATE_LIMIT_SECKILL_ROUND_INFO)
end
--清理秒杀场次信息
function KfActivityModel:CleanSecKillRoundInfo( )
self.limit_seckill_round_info = {}
end
--记录
function KfActivityModel:SetSecKillRecordInfo( vo )
self.limit_seckill_record_info = vo
self:ChangeVar("limit_seckill_record_info", self.limit_seckill_record_info, false, true)
end
function KfActivityModel:SetSecKillOneRecord( vo )
local data = {
goods_id = vo.goods_id,
TvId = vo.TvId,
server_num = vo.server_num,
goods_num = vo.goods_num,
name = vo.name,
cost = vo.cost,
}
table_insert(self.limit_seckill_record_info.buy_log, data)
self:ChangeVar("limit_seckill_record_info", self.limit_seckill_record_info, false, true)
end
function KfActivityModel:GetSecKillRecordInfo( )
return self.limit_seckill_record_info
end
--抢购界面信息
function KfActivityModel:SetSecKillBuyInfo( vo )
if not self.limit_seckill_buy_info[vo.round] then
self.limit_seckill_buy_info[vo.round] = {}
end
self.limit_seckill_buy_info[vo.round][vo.grade_id] = vo
self:ChangeVar("limit_seckill_buy_info", self.limit_seckill_buy_info, false, true)
end
function KfActivityModel:GetSecKillBuyInfo(round, grade_id )
if not round or not grade_id then
return {}
end
if self.limit_seckill_buy_info[round] then
return self.limit_seckill_buy_info[round][grade_id] or {}
end
return {}
end
--场次开启需要重新刷一下红点
function KfActivityModel:LimitSecKillRoundStart( round )
local data = self:GetSecKillBaseInfo()
if data and data.round_info and data.round_info[round] then
if data.round_info[round].label == 2 then
self.is_open_limit_seckill_view = false
self:IsNeedRed(KfActivityModel.TabID.LimitSeckill,nil,data.sub_type)
end
end
end
function KfActivityModel:CheckSecKillRedDot(sub_type)
local need_red = not self.is_open_limit_seckill_view
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.LIMIT_SECKILL, sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
if act_list then
act_type = act_list.act_type
end
if not self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL] then
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL] = {}
end
self.act_red_dot_info[CustomActivityModel.CustomActBaseType.LIMIT_SECKILL][sub_type] = need_red
return need_red,act_type
end
function KfActivityModel:InitSeckillCache(sub_type)
if self:GetSecKillBuySureCache( )[sub_type] == nil then
self:SetSecKillBuySureCache( sub_type, true )
end
if self:GetSecKillRemindCache( )[sub_type] == nil then
self:SetSecKillRemindCache( sub_type, false )
end
end
-- 购买秒杀物品时是否无需确认
function KfActivityModel:GetSecKillBuySureCache( )
-- local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,
-- CookieKey.SEC_KILL_BUY_TIPS) or {}
self.sec_kill_buy_sure = self.sec_kill_buy_sure or {}
local list = self.sec_kill_buy_sure
-- if list[sub_type] == nil then
-- self:SetSecKillBuySureCache(sub_type, false)
-- list[sub_type] = false
-- end
return list
end
-- 每个场次是否需要提醒
function KfActivityModel:GetSecKillRemindCache( )
local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,
CookieKey.SEC_KILL_NEED_REMIND) or {}
-- if list[sub_type] == nil then
-- self:SetSecKillRemindCache(sub_type, false)
-- list[sub_type] = false
-- end
return list
end
-- 购买时无需提示彩钻购买
function KfActivityModel:SetSecKillBuySureCache( sub_type, bool )
self.sec_kill_buy_sure = self.sec_kill_buy_sure or {}
if bool ~= nil then
self.sec_kill_buy_sure[sub_type] = bool
else
if self.sec_kill_buy_sure[sub_type] ~= nil then
self.sec_kill_buy_sure[sub_type] = not self.sec_kill_buy_sure[sub_type]
else
self.sec_kill_buy_sure[sub_type] = true
end
end
-- local list = self:GetSecKillBuySureCache() or {}
-- if bool ~= nil then
-- list[sub_type] = bool
-- else
-- if list[sub_type] ~= nil then
-- list[sub_type] = not list[sub_type]
-- else
-- list[sub_type] = true
-- end
-- end
-- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,
-- CookieTimeType.TYPE_ALWAYS, CookieKey.SEC_KILL_BUY_TIPS, list)
-- CookieWrapper.Instance:WriteAll()
end
function KfActivityModel:SetSecKillRemindCache( sub_type, bool )
local list = self:GetSecKillRemindCache() or {}
if bool ~= nil then
list[sub_type] = bool
else
if list[sub_type] ~= nil then
list[sub_type] = not list[sub_type]
else
list[sub_type] = false
end
end
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,
CookieTimeType.TYPE_ALWAYS, CookieKey.SEC_KILL_NEED_REMIND, list)
CookieWrapper.Instance:WriteAll()
end
--------------抢红包/福袋--start---------------
-- 处理condition数据
function KfActivityModel:SetLuckyBagData( base_type, condition_list )
local data
if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
self.red_bag_data = {}
data = self.red_bag_data
elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
self.lucky_bag_data = {}
data = self.lucky_bag_data
else
return
end
for k, v in pairs(condition_list) do
if v[1] == "open_time" then
data.open_time = {}
for i, v2 in ipairs(v[2]) do
table.insert(data.open_time, { hour = tonumber(v2[1]), min = tonumber(v2[2]) } )
end
-- 时间从小到大排序:
local sort_func = function ( a, b )
if a.hour ~= b.hour then
return a.hour < b.hour
else
return a.min < b.min
end
end
table.sort(data.open_time, sort_func)
else
data[Trim(v[1])] = tonumber(v[2])
end
end
-- logWarn('=======Msh:KfActivityModel.lua[1928]=======', base_type)
-- print('Msh:KfActivityModel.lua[1929] base_type', base_type)
-- PrintTable(condition_list)
-- PrintTable(data)
end
-- 获取数据
function KfActivityModel:GetLuckyBagDataByKey( base_type, key )
local data
if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
data = self.red_bag_data
elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
data = self.lucky_bag_data
else
return
end
if data and data[key] then
return data[key]
end
end
-- 获取今日距离下一次开启活动的时间
function KfActivityModel:GetLuckyBagNextOpenTime( base_type )
local data
if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
data = self.red_bag_data
elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
data = self.lucky_bag_data
else
return
end
if data and data.open_time then
local curTime = TimeUtil:getServerTime()
for i,v in ipairs(data.open_time) do -- 注意遍历的时间必须从小到大 如10:00 12:00 14:00
local today_open_time = TimeUtil:GetToDayNHourStr(v.hour) + v.min * 60
local remain_time = today_open_time - curTime
if remain_time > 0 then
return today_open_time
end
end
end
return -1 -- 今日已经没有场次
end
-- 获取活动状态
-- 返回值: state key_time
-- 活动已结束 0 nil
-- 活动持续中 1 活动结束时间
-- 图标开启中 2 下次开启时间
-- 准备开启图标 3 需要开启图标的时间
function KfActivityModel:GetLuckyBagActTime( base_type )
--print('Msh:KfActivityModel.lua[1988] data', base_type)
local data
if base_type == CustomActivityModel.CustomActBaseType.GET_RED_BAG then -- 抢福袋
data = self.red_bag_data
elseif base_type == CustomActivityModel.CustomActBaseType.GET_LUCKY_BAG then -- 抢红包
data = self.lucky_bag_data
else
return
end
if data and data.open_time then
local curTime = TimeUtil:getServerTime()
for i,v in ipairs(data.open_time) do -- 注意遍历的时间必须从小到大 如10:00 12:00 14:00
local today_open_time = TimeUtil:GetToDayNHourStr(v.hour) + v.min * 60
local ac_end_time = today_open_time + data.last_time
if ac_end_time - curTime > 0 then -- 匹配到的下一场次
local icon_open_time = today_open_time - data.show_time
--local remain_time = today_open_time - curTime
if curTime >= today_open_time then -- 活动持续中
return 1, ac_end_time
elseif curTime >= icon_open_time then -- 图标开启中
return 2, today_open_time
elseif curTime < icon_open_time then -- 准备开启图标
return 3, icon_open_time
else
-- logWarn('=======Msh:KfActivityModel.lua[2003]==error=====')
return
end
end
end
end
return 0 -- 今日已经没有场次
end
function KfActivityModel:GetShowRewardList( base_type, sub_type )
local reward_data = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type).reward_list
-- logWarn('=======Msh:KfActivityModel.lua[2024]===666====')
-- PrintTable(CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type))
local sort_func = function ( a, b )
return a.grade < b.grade
end
table.sort(reward_data, sort_func)
local res_list = {}
local show_count = 10 -- 最多展示10个奖励
for i,v in ipairs(reward_data) do
local ui_show = 0
for i2,v2 in ipairs(v.condition_list) do
if v2[1] == "ui_show" then
ui_show = tonumber(v2[2])
break
end
end
if ui_show == 1 then
table.insert(res_list, stringtotable(v.reward)[1])
show_count = show_count - 1
end
if show_count <= 0 then
break
end
end
return res_list
end
function KfActivityModel:SetLuckyBagGradeRewardData( base_type )
local reward_data = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type).reward_list
self.lucky_bag_reward_data = self.lucky_bag_reward_data or {}
self.lucky_bag_reward_data[base_type] = {}
-- local sort_func = function ( a, b )
-- return a.grade < b.grade
-- end
-- table.sort(reward_data, sort_func)
local data = self.lucky_bag_reward_data[base_type]
for i,v in ipairs(reward_data) do
local ui_show = 0
for i2,v2 in ipairs(v.condition_list) do
if v2[1] == "ui_show" then
ui_show = tonumber(v2[2])
break
end
end
data[v.grade] = {grade = v.grade, reward = stringtotable(v.reward), ui_show = ui_show}
end
end
function KfActivityModel:GetTargetGradeReward( base_type, grade )
if not (self.lucky_bag_reward_data and self.lucky_bag_reward_data[base_type]) then
self:SetLuckyBagGradeRewardData( base_type )
end
local data = self.lucky_bag_reward_data[base_type][grade]
return data
end
function KfActivityModel:SetLuckyBagLastGetTime( time )
self.last_lucky_bag_get_time = time
end
function KfActivityModel:GetLuckyBagLastGetTime( )
if self.last_lucky_bag_get_time then
return self.last_lucky_bag_get_time
else
return 0
end
end
--------------抢红包/福袋----end-------------
--------------惊喜红包----start-------------
--基础信息
function KfActivityModel:GetHappyRedBagBaseInfo( sub_type )
if sub_type then
return self.happy_red_bag_base_info[sub_type]
else
return self.happy_red_bag_base_info
end
end
function KfActivityModel:SetHappyRedBagBaseInfo( value )
self.happy_red_bag_base_info[value.sub_type] = value
self:IsNeedRed( KfActivityModel.TabID.HappyRedBag,nil,value.sub_type )
end
--全服记录
function KfActivityModel:GetHappyRedBagHistoryInfo( sub_type )
if sub_type then
return self.happy_red_bag_history_info[sub_type]
else
return self.happy_red_bag_history_info
end
end
function KfActivityModel:SetHappyRedBagHistoryInfo( value )
local function sort_call( a,b )
--从大到小
return a.time > b.time
end
if TableSize(value.log_list) > 1 then
table.sort( value.log_list, sort_call )
end
self.happy_red_bag_history_info[value.sub_type] = value.log_list
end
function KfActivityModel:GetHappyRedBagRewardById( id )
--通过id获得展示奖励列表
if not Config.Supredpacket[id] then return end
local conf = Config.Supredpacket[id]
local result = {
[1] = stringtotable(conf.mid_draw)[2],
[2] = stringtotable(conf.up_draw)[2],
[3] = stringtotable(conf.dream_draw)[2],
}
return result
end
--获得充值条件
function KfActivityModel:GetHappyRedBagNeedRechargeById( id )
if not Config.Supredpacket[id] then return 9999 end
return Config.Supredpacket[id].recharge_gold
end
--获得红包可领取状态
function KfActivityModel:GetHappyRedBagReceiveStatus( sub_type )
local data = self:GetHappyRedBagBaseInfo(sub_type)
if data then
return data.can_receive
end
end
--已经抽完次数
function KfActivityModel:IsHappyRedBagDrawMax( sub_type )
local function GetMaxTimeInPool( id )
local pool_id = false
for k,v in pairs(Config.Supredpacket) do
if v.id == id then
pool_id = v.draw_pool
break
end
end
local time = 0
for k,v in pairs(Config.Supredpacket) do
if v.draw_pool == pool_id then
time = time + 1
end
end
return time
end
local data = self:GetHappyRedBagBaseInfo(sub_type)
if data then
local time = GetMaxTimeInPool(data.id)
if data.draw_times == time and data.can_receive == 0 then
return true,time
else
return false,time
end
end
return false,0
end
function KfActivityModel:GetHappyRedBagRedDotBySubType( sub_type )
local need_lv = GetModuleOpenLevel(331,78)
local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.HAPPY_RED_BAG, sub_type)
if act_info and act_info.condition then
local confition_list = stringtotable(act_info.condition)
for k,v in pairs(confition_list) do
if v[1] == "role_lv" then
need_lv = math.max( need_lv , tonumber(v[2]) )
end
end
end
local show_red = {}
if RoleManager.Instance.mainRoleInfo.level < need_lv then return show_red end
local base_data = self:GetHappyRedBagBaseInfo(sub_type)
if not base_data then return show_red end
if self:IsHappyRedBagDrawMax(sub_type) then
--抽满
return show_red
end
-------------------------
local need_recharge = self:GetHappyRedBagNeedRechargeById(base_data.id)--充值条件
if base_data and base_data.box_has_receive == 0 and base_data.draw_times >= 1 then
--判断宝箱是否可领取
show_red.box = true
end
--判断是否可以领红包(待领取奖励 or 充值达到条件且未抽取)
if base_data.can_receive == 1 then
--待领取的时候
if base_data.draw_times == 1 then
--第一次领取,需要判断是否达到充值条件
show_red.red_bag = base_data.recharge_num >= need_recharge
else
show_red.red_bag = true
end
else
--未抽取的时候,判断充值是否达到条件,或者是第一次抽取
show_red.red_bag = (base_data.recharge_num >= need_recharge) or (base_data.draw_times == 0)
end
return show_red
end
--------------惊喜红包----end-------------
--------------折扣满减----start-------------
--基础信息
function KfActivityModel:GetDiscountFullCutInfo( sub_type )
if sub_type then
return self.discount_full_cut_info[sub_type]
end
end
function KfActivityModel:SetDiscountFullCutInfo( data )
if data and data.sub_type then
self.discount_full_cut_info[data.sub_type] = data
-------------------------
--[[local temp = self.discount_full_cut_draw_free_status[data.sub_type]
if (temp and (data.free_count < temp)) then
self.discount_full_cut_draw_free_red[data.sub_type] = true
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,data.sub_type)
end
self.discount_full_cut_draw_free_status[data.sub_type] = data.free_count--]]
if self.discount_full_cut_draw_free_red[data.sub_type] ~= "has_open" then
self.discount_full_cut_draw_free_red[data.sub_type] = data.free_count == 0
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,data.sub_type)
end
end
end
--购买记录
function KfActivityModel:GetDiscountFullCutHistory( sub_type )
if sub_type then
return self.discount_full_cut_history[sub_type]
end
end
function KfActivityModel:SetDiscountFullCutHistory( data )
if data and data.sub_type then
self.discount_full_cut_history[data.sub_type] = data.list
end
end
--获取折扣券配置
function KfActivityModel:GetDiscountFullCutTicketConf( ticket_type,ticket_id )
if ticket_id then
return Config.Discountmallcoupon[ticket_id]
end
if ticket_type then
local list = {}
for k,v in pairs(Config.Discountmallcoupon) do
if v.type == ticket_type then
list[v.goods_id] = v
end
end
return list
else
return Config.Discountmallcoupon
end
end
function KfActivityModel:CheckKfDiscountFullCutRedDot( sub_type )
-------------------------
local base_type = CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT
sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
if act_list then
act_type = act_list.act_type
local server_time = TimeUtil:getServerTime( )
if server_time > act_list.stime and act_list.etime > server_time then
bool = self:GetDiscountFullCutRedDotBySubType(sub_type)
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
end
return bool,act_type
end
function KfActivityModel:GetDiscountFullCutRedDotBySubType( sub_type )
if not sub_type then return false end
-------------------------
local need_lv = GetModuleOpenLevel(331,77)
local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT, sub_type)
if act_info and act_info.condition then
local confition_list = stringtotable(act_info.condition)
for k,v in pairs(confition_list) do
if v[1] == "role_lv" then
need_lv = math.max( need_lv , tonumber(v[2]) )
end
end
end
if RoleManager.Instance.mainRoleInfo.level < need_lv then
--等级没到
return false
end
-------------------------
local bool_1 = (not self.discount_full_cut_mask_first_open_red[sub_type])
local bool_2 = self.discount_full_cut_draw_goods_red[sub_type]
local bool_3 = self.discount_full_cut_new_red[sub_type]
local bool_4 = self.discount_full_cut_draw_free_red[sub_type] == true
return bool_1 or bool_2 or bool_3 or bool_4
end
function KfActivityModel:CheckKfDiscountFullCutGoodsChangeRedDot( )
--数量变更红点
local draw_tick_id = KfActivityModel.KfDFullCutLuckyGoodsId
local num = GoodsModel:getInstance():GetTypeGoodsNum( draw_tick_id )
if self.discount_full_cut_draw_goods_num ~= num and num > self.discount_full_cut_draw_goods_num then
local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DISCOUNT_FULL_CUT)
for k,v in pairs(all_list) do
self.discount_full_cut_draw_goods_red[v.sub_type] = true
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,v.sub_type)
end
end
self.discount_full_cut_draw_goods_num = num
end
--活动刚开给个红点
function KfActivityModel:AddKfDiscountFullCutNewOpenRedDot( sub_type,bool )
if not sub_type then return end
self.discount_full_cut_new_red[sub_type] = bool
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
end
--开界面红点处理
function KfActivityModel:AddKfDiscountFullCutMaskFirstOpenRedDot( sub_type,bool )
if not sub_type then return end
self.discount_full_cut_mask_first_open_red[sub_type] = bool
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
end
--开抽奖界面消抽奖券红点
function KfActivityModel:AddKfDiscountFullCutMaskGoodsRedDot( sub_type )
if not sub_type then return end
self.discount_full_cut_draw_goods_red[sub_type] = false
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
end
--开抽奖界面消免费红点
function KfActivityModel:AddKfDiscountFullCutMaskFreeRedDot( sub_type )
do return end--以前免费红点是一次性的,现在不是了
-------------------------
if not sub_type then return end
self.discount_full_cut_draw_free_red[sub_type] = "has_open"
self:IsNeedRed(KfActivityModel.TabID.DiscountFullCut,nil,sub_type)
end
--设置折扣满减奖池数据
function KfActivityModel:SetDiscountFullCutLuckyTableList( vo )
if vo and vo.sub_type then
self.discount_full_cut_lucky_list[vo.sub_type] = vo.goods_list
end
end
--获得折扣满减奖池数据
function KfActivityModel:GetDiscountFullCutLuckyTableList( sub_type )
return self.discount_full_cut_lucky_list[sub_type]
end
--------------折扣满减----end--------------
--------------阶段兑换----start--------------
function KfActivityModel:CheckStageExchangeGoodsChangeRedDot( )
--道具变更红点检查
local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE)
for k,v in pairs(all_list) do
self:IsNeedRed(KfActivityModel.TabID.StageExchange,nil,v.sub_type)
end
end
function KfActivityModel:GetStageExchangeRedDotBySubType( sub_type )
--活动开启首次登陆红点
local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.STAGE_EXCHANGE_RED) or {}
if not red_first_data[sub_type] then
-------------------------
--没开过界面
return true
end
-------------------------
local check_price_list = false--当前要比价用的
--阶段开启奖励可临取时,临取按钮红点提示
local operate_model = OperateActivityModel:getInstance()
local base_data = operate_model:GetStageExchangeInfo(sub_type)
if not base_data then return false end
local unlock_phase = operate_model:GetStageExchangeUnlockPhase(sub_type)
local open_reward_status = 0
for i,v in ipairs(base_data) do
if v.phase == unlock_phase then
open_reward_status = v.open_reward_status
check_price_list = DeepCopy(v.goods_list or {})
break
end
end
if open_reward_status == 1 then
return true
end
-------------------------
local cost_id = operate_model:GetStageExchangeCostId( sub_type )
local goods_num = GoodsModel:getInstance():GetTypeGoodsNum( cost_id )
-------------------------
--价格为0,可买,阶段商店页签红点提示
for k,v in pairs(check_price_list) do
if v.cost_goods_num == 0 and v.exchange_num < v.limit_num then
return true
end
end
--玩家道具总额足够兑换本阶段商店最高价道具时,阶段商店页签红点提示
--获取价格列表
local function sort_call( a,b )
--从大到小
return a.cost_goods_num > b.cost_goods_num
end
table.sort( check_price_list, sort_call )
for i,v in pairs(check_price_list) do
if v.exchange_num < v.limit_num then
--最高价位
return goods_num >= v.cost_goods_num
end
end
return false
end
--新活动开启 or 奖池因玩家升级引起刷新,红点变化
function KfActivityModel:MaskStageExchangeOpenRedDot( sub_type )
local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.STAGE_EXCHANGE_RED) or {}
if not data[sub_type] then
data[sub_type] = true
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.STAGE_EXCHANGE_RED,data)
CookieWrapper.Instance:WriteAll()
self:IsNeedRed(KfActivityModel.TabID.StageExchange,nil,sub_type)
end
end
--------------阶段兑换----end--------------
--获得通用排行排名数据
function KfActivityModel:GetComRankCfg( type_key )
return self.com_rank_score_cfg[type_key]
end
--设置通用结算排行数据
function KfActivityModel:SetComRankInfo( vo )
local new_rank_list = {}
for k,v in pairs(vo.rank_list) do
new_rank_list[v.rank] = v
end
vo.rank_list = new_rank_list
self.com_rank_info[vo.sub_type] = vo
end
--获得通用结算排行数据
function KfActivityModel:GetComRankInfo( sub_type )
return self.com_rank_info[sub_type]
end
function KfActivityModel:CheckComRankTabIsOpen( sub_type )
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.COM_RANK,sub_type)
if act_list then
local show_time = 0
for k,v in pairs(act_list.condition_list) do
if v[1] == "show_time" then
show_time = tonumber(v[2])
break
end
end
local server_time = TimeUtil:getServerTime( )
local end_time = act_list.etime + show_time
if server_time > act_list.stime and end_time > server_time then
return true
end
end
return false
end
--------------源晶复制机----start--------------
--是否需要显示源晶复制机按钮
function KfActivityModel:IsShowMoneyCopy( type_tag )
return false
end
function KfActivityModel:GetMoneyCopyData( sub_type )
return self.money_copy_data[sub_type]
end
function KfActivityModel:SetMoneyCopyData( data )
self.money_copy_data[data.sub_type] = data
end
--通过标记获取活动子类
function KfActivityModel:GetMoneyCopySubTypeByTag( tag )
local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(base_type)
local show_place = false
for k,v in pairs(sub_type_list) do
show_place = false
for kk,vv in pairs(v.condition_list) do
if vv[1] == "show_place" then
show_place = vv[2]
end
end
if show_place then
if tag == "chargeplus" and show_place == "chargeplus" then
--首充追加界面
return v.sub_type
end
elseif tag == "charge" then
--普通充值界面用的
return v.sub_type
end
end
return false
end
--获取是否在活动时间内,返回开始时间和活动时间
function KfActivityModel:IsInMoneyCopyTime( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
-------------------------
local need_lv = GetModuleOpenLevel(331,5)
local confition_list = stringtotable(act_list.condition)
for k,v in pairs(confition_list) do
if v[1] == "role_lv" then
need_lv = math.max( need_lv , tonumber(v[2]) )
end
end
if need_lv > RoleManager.Instance.mainRoleInfo.level then
--等级不足
return false,0,0
end
-------------------------
local show_type = false
for k,v in pairs(act_list.condition_list) do
if v[1] == "show_place" then
show_type = v[2]
break
end
end
local server_time = TimeUtil:getServerTime( )
if show_type then
local base_data = self:GetMoneyCopyData( sub_type )
if base_data and base_data.stime > 0 and base_data.etime > 0 then
return (server_time > base_data.stime and base_data.etime > server_time), base_data.stime, base_data.etime
else
return false,0,0
end
else
return (server_time > act_list.stime and act_list.etime > server_time), act_list.stime, act_list.etime
end
end
return false,0,0
end
--获取红点
function KfActivityModel:IsMoneyCopyRedByTag( tag )
local sub_type = self:GetMoneyCopySubTypeByTag(tag)
if sub_type then
return self:IsMoneyCopyRedBySubType( sub_type )
end
return false
end
function KfActivityModel:IsMoneyCopyRedBySubType( sub_type )
local base_type = CustomActivityModel.CustomActBaseType.MONEY_COPY
sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
if act_list then
local in_time = self:IsInMoneyCopyTime(sub_type)
if in_time then
--活动期内才需要红点了
local base_data = self:GetMoneyCopyData(sub_type)
if base_data and base_data.total > 0 then
local cur_time_tb = os.date( '*t' ,TimeUtil:getServerTime())
local last_time_tb = os.date( '*t' ,base_data.last_time)
if last_time_tb.day ~= cur_time_tb.day or last_time_tb.month ~= cur_time_tb.month then
return true
end
end
end
end
return false
end
--------------源晶复制机----end--------------
--------------黑白棋----start--------------
function KfActivityModel:GetReversiRedDotBySubType( sub_type )
--活动开启首次登陆红点
local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.REVERSI_RED) or {}
if not red_first_data[sub_type] then
-------------------------
--没开过界面
return true
end
-- 当玩家有免费抽奖次数时
local bool_red = self:GetReversiFreeDrawRed(sub_type)
bool_red = bool_red or self:GetReversiFreeRreshRed(sub_type)
if not bool_red then
local base_type = CustomActivityModel.CustomActBaseType.REVERSI
local free_buff_kind = OperateActivityModel.MaterialSubmitBuffKind.ACT_LUCKY_FREE --是否存在活动加成buff 首次抽奖免费
local free_buff_cfg,free_buff_info = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(free_buff_kind)
local buff_free_times = 0
if free_buff_cfg and free_buff_info then
local sec = free_buff_info.etime - TimeUtil:getServerTime( )
if sec > 0 then
self:ActReversiBuffTimeLate(sec,sub_type)
buff_free_times = free_buff_cfg.data
for k,v in pairs(free_buff_info.used) do
if v.kdata == base_type then--十连还有次数
buff_free_times = buff_free_times - v.vdata
break
end
end
if buff_free_times > 0 then
bool_red = true
end
end
end
end
return bool_red
-- 当奖池刷新(玩家升级导致)时候
end
--黑白棋活动BUFF时间倒计时
function KfActivityModel:ActReversiBuffTimeLate( sub_type )
if self.act_reversi_buff_timer_id then
GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
self.act_reversi_buff_timer_id = nil
end
if self.reversi_act_sec and self.reversi_act_sec >= sec then
return
else
self.reversi_act_sec = sec
end
local sec = sec or 0
if sec > 0 then
local function onTimer()
sec = sec - 1
if sec > 0 then
else
if self.act_reversi_buff_timer_id then
GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
self.act_reversi_buff_timer_id = nil
end
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
end
end
if not self.act_reversi_buff_timer_id then
self.act_reversi_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
end
onTimer()
else
if self.act_reversi_buff_timer_id then
GlobalTimerQuest:CancelQuest(self.act_reversi_buff_timer_id)
self.act_reversi_buff_timer_id = nil
end
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
end
end
--免费抽奖次数
function KfActivityModel:GetReversiFreeDrawRed( sub_type )
local data = OperateActivityModel:getInstance():GetReversiInfo( sub_type )
return data and data.free_times > 0
end
--当玩家能够免费刷新奖池时
function KfActivityModel:GetReversiFreeRreshRed( sub_type )
local data = OperateActivityModel:getInstance():GetReversiCurInfo(sub_type)
if not data then return false end
local open_num = 0
for k,v in pairs(data) do
if v.status == 1 then
open_num = open_num + 1
end
end
return open_num >= 16
end
function KfActivityModel:MaskReversiOpenRedDot( sub_type,bool )
local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.REVERSI_RED) or {}
if data[sub_type] ~= bool then
data[sub_type] = bool
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.REVERSI_RED,data)
CookieWrapper.Instance:WriteAll()
self:IsNeedRed(KfActivityModel.TabID.Reversi,nil,sub_type)
end
end
--------------黑白棋----end--------------
--------------活动幻魔----start--------------
function KfActivityModel:GetFestivalBossRedDotBySubType( sub_type )
--活动开启首次登陆红点
local red_first_data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.FESTIVAL_BOSS_RED) or {}
if not red_first_data[sub_type] then
-------------------------
--没开过界面
return true
end
return false
end
function KfActivityModel:MaskFestivalBossOpenRedDot( sub_type,bool )
local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.FESTIVAL_BOSS_RED) or {}
if data[sub_type] ~= bool then
data[sub_type] = bool
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.FESTIVAL_BOSS_RED,data)
CookieWrapper.Instance:WriteAll()
self:IsNeedRed(KfActivityModel.TabID.FestivalBoss,nil,sub_type)
end
end
--------------活动幻魔----end--------------
--------------活跃/登陆 通行证----start--------------
--活跃/登陆 通行证信息
function KfActivityModel:GetPassActInfo( act_type,sub_type )
if self.pass_act_info[act_type] then
return self.pass_act_info[act_type][sub_type] or false
end
return false
end
function KfActivityModel:SetPassActInfo( value )
if value then
local function sort_call( a,b )
return a.need < b.need
end
table.sort( value.reward_list, sort_call )
self.pass_act_info[value.act_type] = self.pass_act_info[value.act_type] or {}
self.pass_act_info[value.act_type][value.sub_type] = value
self:IsNeedRed(self:ByActTypeGetTabId( value.act_type ),nil,value.sub_type)
end
end
--活跃/登陆 通行证奖励信息
function KfActivityModel:GetPassActRewardInfo( act_type,sub_type )
if self.pass_act_reward_info[act_type] then
return self.pass_act_reward_info[act_type][sub_type] or false
end
return false
end
function KfActivityModel:SetPassActRewardInfo( value )
if value then
local function sort_call( a,b )
return a.need < b.need
end
table.sort( value.reward_list, sort_call )
self.pass_act_reward_info[value.act_type] = self.pass_act_reward_info[value.act_type] or {}
self.pass_act_reward_info[value.act_type][value.sub_type] = value
end
end
function KfActivityModel:GetPassActCurLvSelect( act_type,sub_type )
if act_type == CustomActivityModel.CustomActBaseType.LOGIN_PASS then
local base_data = self:GetPassActInfo(act_type,sub_type)
local cur_active = base_data and base_data.active or 1
if base_data then
--判断一下是不是全都到期了,到期了就取第一个可未领的
local award_data = self:GetPassActRewardInfo(act_type,sub_type)
local max_grade = award_data and #award_data.reward_list or false
if (cur_active > max_grade) then
for i,v in ipairs(base_data.reward_list) do
if v.normal_status~=2 or v.extra_status ~= 2 then
cur_active = v.grade
break
end
end
end
end
return cur_active
elseif act_type == CustomActivityModel.CustomActBaseType.LIVELY_PASS then
--获取最低可领取的奖励段
--最低不可领取的
--最大奖励点
local cur_active = false--普通最低可操作档位
local base_data = self:GetPassActInfo(act_type,sub_type)
if base_data then
for i,v in ipairs(base_data.reward_list) do
if v.normal_status~=2 then
cur_active = v.grade
break
end
end
return cur_active or 1--貌似也不需要,直接选第一个
--[[if not cur_active then
--没有那么就要考虑显示最高基本 or 第一个
local max_grade = 0
local min_grade = 9999
local temp = self:GetPassActRewardInfo( act_type,sub_type )
if temp and temp.reward_list then
for k,v in pairs(temp.reward_list) do
max_grade = max_grade < v.grade and v.grade or max_grade
min_grade = min_grade > v.grade and v.grade or min_grade
end
return base_data.is_pay == 1 and max_grade or min_grade
end
end--]]
end
end
return 1
end
function KfActivityModel:GetPassActRewardStatus( act_type,sub_type,grade )
local basic = self:GetPassActInfo(act_type,sub_type)
if not basic then return 0,0 end
local cur_data = false
for k,v in pairs(basic.reward_list) do
if v.grade == grade then
cur_data = v
break
end
end
if cur_data then
return cur_data.normal_status,cur_data.extra_status
else
return 0,0
end
end
function KfActivityModel:PassActChangeRewardStatus( act_type,sub_type,grade,reward_opty )
local base_data = self:GetPassActInfo(act_type,sub_type)
if (not base_data) then return end
local have_set = false
for k,v in pairs(base_data.reward_list) do
if v.grade == grade then
if reward_opty == 1 then
v.normal_status = 2
have_set = true
elseif reward_opty == 2 then
v.extra_status = 2
have_set = true
elseif reward_opty == 3 then
v.normal_status = 2
v.extra_status = 2
have_set = true
end
end
end
if not have_set then
return false
else
self:IsNeedRed(self:ByActTypeGetTabId( act_type ),nil,sub_type)
end
end
--通用通行证红点
function KfActivityModel:CheckComPassRedDot( base_type,sub_type )
local act_list = CustomActivityModel:getInstance():getActList(base_type,sub_type)
local act_type = CustomActivityModel.CustomIconActType.KfAct
if not act_list then return false,act_type end
local bool = false
if not self.act_red_dot_info[base_type] then
self.act_red_dot_info[base_type] = {}
end
self.act_red_dot_info[base_type][sub_type] = false
-------------------------
local open_level = Config.Modulesub["331@" .. base_type] and Config.Modulesub["331@" .. base_type].open_lv or 1
for l,w in pairs(act_list.condition_list) do
if type(w) == "table" and w[1] == "role_lv" then
open_level = tonumber(w[2])
end
end
if RoleManager.Instance.mainRoleInfo.level >= open_level then
local server_time = TimeUtil:getServerTime( )
if act_list and server_time > act_list.stime and act_list.etime > server_time then
act_type = act_list.act_type
bool = self:GetComPassRedDotBySubType(base_type,sub_type)
self.act_red_dot_info[act_list.base_type][act_list.sub_type] = bool
end
else
self.check_lv_act_open = self.check_lv_act_open or {}
self.check_lv_act_open[open_level] = self.check_lv_act_open[open_level] or {}
self.check_lv_act_open[open_level][base_type] = self.check_lv_act_open[open_level][base_type] or {}
self.check_lv_act_open[open_level][base_type][sub_type] = true
end
return bool,act_type
end
function KfActivityModel:GetComPassRedDotBySubType( base_type,sub_type )
local base_data = self:GetPassActInfo(base_type,sub_type)
if base_data then
for k,v in pairs(base_data.reward_list) do
if v.normal_status == 1 or v.extra_status == 1 then
return true
end
end
end
return false
end
--------------活跃/登陆 通行证----end--------------
--构建抢购商城小弹窗信息
function KfActivityModel:GetRushQuickBuy( goods_id )
local base_type = CustomActivityModel.CustomActBaseType.KFACTIVITY_LIMIT_SHOP
local sub_type = CustomActivityModel:getInstance():getActMinSubType(base_type)
if not sub_type then return end
local server_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
if not server_data then return end
local info_list = server_data.reward_list
if not info_list or not TableSize(info_list) == 0 then return end
local level = RoleManager.Instance.mainRoleInfo.level
local item_list = {}
for i,v in ipairs(info_list) do
if #v.reward_info == 1 and (v.reward_info[1].goods_id == goods_id or not goods_id) then
local lv_can = true
local num_can = true
for k,vv in pairs(v.condition_list) do
if vv[1] == "show_level_range" then
if level < tonumber(vv[2]) or level > tonumber(vv[3]) then
lv_can = false
end
elseif vv[1] == "limit_times" then
num_can = tonumber(vv[2]) - v.progress > 0
end
end
if lv_can and num_can then
--符合等级,符合数量条件
item_list[#item_list + 1] = v
end
end
end
-------------------------
if #item_list > 0 then
return item_list
end
end
-- 判断是否需要展示广告
function KfActivityModel:CheckFosterRechargeAdsShow( show_type, grade )
local bool = false
if not RechargeActivityModel:getInstance():IsRecharge( ) then
local open_server_day = ServerTimeModel:getInstance():GetOpenServerDay()
local cfg = KfActivityConst.FosterRechargeData[show_type]
if cfg and cfg.opday_lim[1] <= open_server_day and cfg.opday_lim[2] >= open_server_day -- 天数
and cfg.grade[1] <= grade and cfg.grade[2] >= grade then -- 阶数
bool = true
end
end
return bool
end
--设置小额连充信息
function KfActivityModel:SetKfContinueInfo( vo )
local can_resign_time = math.floor(vo.total/KfActivityModel.ContinueSignRechargePrice)--可以补签的数量
vo.can_resign_time = can_resign_time - vo.resign
--离下一个补签需要充值多少
vo.offer_price = math.ceil(vo.total/KfActivityModel.ContinueSignRechargePrice) * KfActivityModel.ContinueSignRechargePrice - vo.total
if vo.offer_price == 0 and vo.can_resign_time == 0 then
vo.offer_price = KfActivityModel.ContinueSignRechargePrice
end
self.kf_continue_info[vo.sub_type] = vo
self:IsNeedRed(KfActivityModel.TabID.ContinueRecharge,nil,vo.sub_type)
end
--获得小额连充补签信息
function KfActivityModel:GetKfContinueInfo( sub_type )
return self.kf_continue_info[sub_type]
end
----------活动引导-998-start--------
-- 设置缓存
function KfActivityModel:SetActGuideCache( data )
self.act_guide_cache = self.act_guide_cache or {}
for l,w in pairs(data.condition_list) do
if w[1] == "role_lv" then -- 升级时弹(运营同一个等级会配很多个东西,所以存成表)
self.act_guide_cache.role_lv = self.act_guide_cache.role_lv or {}
self.act_guide_cache.role_lv[tonumber(w[2])] = self.act_guide_cache.role_lv[tonumber(w[2])] or {}
table.insert(self.act_guide_cache.role_lv[tonumber(w[2])], data.sub_type) -- 记录一下这个等级
elseif w[1] == "foster" then --进阶成功时弹
self.act_guide_cache.foster = self.act_guide_cache.foster or {}
local temp = {
[1] = data.sub_type,
[2] = tonumber(w[2]),
[3] = tonumber(w[3]),
[4] = tonumber(w[4]),
}
table.insert(self.act_guide_cache.foster, temp)
elseif w[1] == "end_foster" then
self.act_guide_cache.end_foster = self.act_guide_cache.end_foster or {}
local temp = {
[1] = data.sub_type,
[2] = tonumber(w[2]),
[3] = tonumber(w[3]),
[4] = tonumber(w[4]),
}
table.insert(self.act_guide_cache.end_foster, temp)
elseif w[1] == "type" then
data.type = tonumber(w[2])
elseif w[1] == "good" then
data.good = tonumber(w[2])
end
end
end
-- 检查是否需要弹出活动引导
function KfActivityModel:CheckNeedShowActGuide( check_key, check_value)
if not check_key or not check_value or not self.act_guide_cache or not self.act_guide_cache[check_key] then
return
end
local sub_type = false
if check_key == "role_lv" then
if self.act_guide_cache.role_lv[check_value] then
sub_type = self.act_guide_cache.role_lv[check_value] -- 这是个表
end
elseif check_key == "foster" then
sub_type = sub_type or {}
for k,v in pairs(self.act_guide_cache[check_key]) do
if check_value[1] == v[2] and check_value[2] == v[3] and check_value[3] == v[4] then
table.insert(sub_type, v[1])
-- sub_type = v[1]
end
end
elseif check_key == "end_foster" then
sub_type = sub_type or {}
--print('=======Msh:KfActivityModel.lua[4448] ===TABLE====')
--PrintTable(self.act_guide_cache[check_key])
for k,v in pairs(self.act_guide_cache[check_key]) do
if check_value[1] == v[2] and
not ((check_value[2] == v[3] and check_value[3] >= v[4] ) or
(check_value[2] > v[3])) then
table.insert(sub_type, v[1])
end
end
return sub_type -- 不需要打开界面
end
-- print('=======Msh:KfActivityModel.lua[4428] ===TABLE====')
-- PrintTable(self.act_guide_cache)
if sub_type and type(sub_type) == "table" then
--print('=======Msh:KfActivityModel.lua[4431] ===TABLE====')
--PrintTable(sub_type)
for i,v in pairs(sub_type) do
--print('=======Msh:KfActivityModel.lua[4432] ==打开冲=====', data)
self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, v)
end
elseif sub_type then
print('=======Msh:KfActivityModel.lua[4439] ===TABLE====', sub_type)
PrintTable(self.act_guide_cache[check_key])
self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, sub_type)
end
end
function KfActivityModel:ResetActGuideCache( )
local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
if self.act_guide_cache and self.act_guide_cache.open_day and self.act_guide_cache.open_day == open_day then
return
end
self.act_guide_cache = {open_day = open_day}
end
-- 检测新获得的物品是否是直升丹需要展示 (这里是不走活动协议的)
function KfActivityModel:IsAddActGuideList( goods_vo )
local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_vo.type_id)
if basic.subtype == 24 or basic.subtype == 16 then -- 等级直升丹/进阶直升丹
local bag_goods_dic = GoodsModel:getInstance():GetBagGoodsDic()
local bag_good_vo = bag_goods_dic[goods_vo.goods_id]
self.act_guide_add_goods_list = self.act_guide_add_goods_list or {}
--背包本来没有
if not bag_good_vo then
--道具增加
if goods_vo.goods_num > 0 then
local copy_new_vo = DeepCopy(goods_vo)
table.insert(self.act_guide_add_goods_list, copy_new_vo)
end
else
--道具变更,并且增加
if goods_vo.goods_num > bag_good_vo.goods_num then
local copy_new_vo = DeepCopy(goods_vo)
table.insert(self.act_guide_add_goods_list, copy_new_vo)
end
end
end
end
-- 检查是否需要弹出直升丹的推荐使用
function KfActivityModel:CheckActGuideNeedShow( need_close )
if self.act_guide_add_goods_list and TableSize(self.act_guide_add_goods_list) > 0 then
-- local data = table.remove(self.act_guide_add_goods_list, 1)
-- print('=======Msh:KfActivityModel.lua[4481] ===打开界面====')
self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, nil, nil, true)
elseif need_close then -- 关闭界面
-- print('=======Msh:KfActivityModel.lua[4483] =====关界面==')
-- PrintCallStack()
self:Fire(KfActivityModel.OPEN_ACT_GUIDE_BASE_VIEW, nil, true, true)
end
end
function KfActivityModel:GetActGuideAddGoodsData( )
if self.act_guide_add_goods_list and TableSize(self.act_guide_add_goods_list) > 0 then
return table.remove(self.act_guide_add_goods_list, 1)
end
end
-- 只靠物品id打开推荐使用
function KfActivityModel:ShowActGuideUseByGoodsID( goods_id )
local goods_vo = {
type_id = goods_id,
}
self.act_guide_add_goods_list = self.act_guide_add_goods_list or {}
table.insert(self.act_guide_add_goods_list, goods_vo)
self:CheckActGuideNeedShow()
end
-- 每次登陆缓存一下是否看过某进阶系统的直升按钮
function KfActivityModel:CheckFosterActGuideEffectShow( show_type )
self.foster_act_guide_btn_cache = self.foster_act_guide_btn_cache or {}
return self.foster_act_guide_btn_cache[show_type]
end
-- 记录已经看过的缓存
function KfActivityModel:SetFosterActGuideBtnCache( show_type )
self.foster_act_guide_btn_cache = self.foster_act_guide_btn_cache or {}
self.foster_act_guide_btn_cache[show_type] = true
end
function KfActivityModel:ResetFosterActGuideBtnCache( )
self.foster_act_guide_btn_cache = {}
end
-- 记录需要播放高层级升级特效标志
function KfActivityModel:SetIsNeedTopEffect( bool )
self.act_guide_is_need_top_effect = bool
end
-- 获取特效标志
function KfActivityModel:GetIsNeedTopEffect( )
return self.act_guide_is_need_top_effect
end
----------活动引导-998-end-----------
--获得上榜条件最大限制
function KfActivityModel:GetRushRankMaxLimit( rank_type )
local max_rank_limit = 30
local rank_cfg = self:GetRushRankAwardCfg(rank_type) or {}
for i,v in ipairs(rank_cfg) do
max_rank_limit = max_rank_limit < v.rank_max and v.rank_max or max_rank_limit
end
return max_rank_limit
end