|
OperateActivityModel = OperateActivityModel or BaseClass(BaseVo, true)
|
|
local OperateActivityModel = OperateActivityModel
|
|
|
|
OperateActivityModel.REQUEST_INFO = "OperateActivityModel.REQUEST_INFO"
|
|
OperateActivityModel.OPEN_ACTIVITY_BASE_VIEW = "OperateActivityModel.OPEN_ACTIVITY_BASE_VIEW"--打开主界面
|
|
OperateActivityModel.UPDATE_ACTIVITY_BASE_VIEW = "OperateActivityModel.UPDATE_ACTIVITY_BASE_VIEW"--更新主界面
|
|
OperateActivityModel.OPEN_RANK_SHOW_VIEW = "OperateActivityModel.OPEN_RANK_SHOW_VIEW"--打开往期排行
|
|
OperateActivityModel.REQUEST_INFO = "OperateActivityModel.REQUEST_INFO"--请求协议
|
|
OperateActivityModel.ANS_UPDATE_VIEW = "OperateActivityModel.ANS_UPDATE_VIEW"--更新界面
|
|
OperateActivityModel.START_LUCKY_TURN_ACTION = "OperateActivityModel.START_LUCKY_TURN_ACTION"--转盘抽奖动画
|
|
OperateActivityModel.QUIK_USE = "OperateActivityModel.QUIK_USE"--触发快捷使用
|
|
OperateActivityModel.SHOW_REWARD_TIP = "OperateActivityModel.SHOW_REWARD_TIP"--显示物品列表(奖池等)
|
|
OperateActivityModel.SHOW_REWARD_TIP_NEW = "OperateActivityModel.SHOW_REWARD_TIP_NEW"--显示物品列表(有小标题)
|
|
|
|
OperateActivityModel.SCRAPING_CARD_BASE_DRAW_UPDATE = "OperateActivityModel.SCRAPING_CARD_UPDATEINFO"--刮刮卡抽卡更新
|
|
OperateActivityModel.SCRAPING_CARD_SCROE_DRAW_UPDATE = "OperateActivityModel.SCRAPING_CARD_SCROE_DRAW_UPDATE"--刮刮卡积分抽卡更新
|
|
OperateActivityModel.SCRAPING_CARD_REFRESH_UPDATE = "OperateActivityModel.SCRAPING_CARD_REFRESH_UPDATE"--刮刮卡重置
|
|
|
|
OperateActivityModel.TAROT_BASE_UPDATE = "OperateActivityModel.TAROT_BASE_UPDATE"--塔罗牌基本信息刷新
|
|
OperateActivityModel.TAROT_RECORD_UPDATE = "OperateActivityModel.TAROT_RECORD_UPDATE"--塔罗牌记录刷新
|
|
OperateActivityModel.TAROT_DRAW_UPDATE = "OperateActivityModel.TAROT_DRAW_UPDATE"--塔罗牌抽卡刷新
|
|
|
|
|
|
|
|
OperateActivityModel.STAGE_EXCHANGE_BASE_UPDATE = "OperateActivityModel.STAGE_EXCHANGE_BASE_UPDATE"--阶段兑换基本信息刷新
|
|
OperateActivityModel.STAGE_EXCHANGE_REWARD_UPDATE = "OperateActivityModel.STAGE_EXCHANGE_REWARD_UPDATE"--阶段兑换阶段奖励列表
|
|
|
|
OperateActivityModel.ADVENTURE_BASE_UPDATE = "OperateActivityModel.ADVENTURE_BASE_UPDATE"--冒险征途基本信息刷新
|
|
|
|
OperateActivityModel.UPDATE_GIDSAW_EVENT_DATA = "OperateActivityModel.UPDATE_GIDSAW_EVENT_DATA" -- 更新活跃拼图协议信息
|
|
OperateActivityModel.REVERSI_BASE_UPDATE = "OperateActivityModel.REVERSI_BASE_UPDATE"--黑白棋总信息刷新
|
|
OperateActivityModel.REVERSI_CUR_STATUS_UPDATE = "OperateActivityModel.REVERSI_CUR_STATUS_UPDATE"--黑白棋当前棋盘状态刷新
|
|
OperateActivityModel.REVERSI_CUR_REWARD_UPDATE = "OperateActivityModel.REVERSI_CUR_REWARD_UPDATE"--黑白棋当前棋盘奖励刷新
|
|
OperateActivityModel.OPEN_REFRESH_TIP = "OperateActivityModel.OPEN_REFRESH_TIP"--黑白棋刷新提示
|
|
OperateActivityModel.DO_REFRESH_ANIM = "OperateActivityModel.DO_REFRESH_ANIM"--执行黑白棋刷新动画
|
|
|
|
OperateActivityModel.OPEN_FESTIVAL_BOSS_REWARD_VIEW = "OperateActivityModel.OPEN_FESTIVAL_BOSS_REWARD_VIEW"--节日幻魔奖励列表
|
|
OperateActivityModel.REFRESH_FESTIVAL_BOSS = "OperateActivityModel.REFRESH_FESTIVAL_BOSS"--节日幻魔数据更新
|
|
|
|
OperateActivityModel.AMASING_JIPSAW_UPDATE_BASEINFO = "OperateActivityModel.AMASING_JIPSAW_UPDATE_BASEINFO"--眼疾手快基本数据
|
|
OperateActivityModel.AMASING_JIPSAW_UPDATE_GAMEINFO = "OperateActivityModel.AMASING_JIPSAW_UPDATE_GAMEINFO"--眼疾手快游戏数据
|
|
OperateActivityModel.AMASING_JIPSAW_UPDATE_GAME_START = "OperateActivityModel.AMASING_JIPSAW_UPDATE_GAME_START"--眼疾手快游戏开始
|
|
OperateActivityModel.AMASING_JIPSAW_UPDATE_GAME_EXCHANGE = "OperateActivityModel.AMASING_JIPSAW_UPDATE_GAME_EXCHANGE"--眼疾手快卡片交换
|
|
OperateActivityModel.AMASING_JIPSAW_UPDATE_REWARD = "OperateActivityModel.AMASING_JIPSAW_UPDATE_REWARD"--眼疾手快奖励
|
|
|
|
OperateActivityModel.PRAY_TREE_BASE_INFO = "OperateActivityModel.PRAY_TREE_BASE_INFO"--人参果树基本信息
|
|
OperateActivityModel.PRAY_TREE_DRAW = "OperateActivityModel.PRAY_TREE_DRAW"--人参果树抽卡
|
|
OperateActivityModel.PRAY_TREE_GET_REWARD = "OperateActivityModel.PRAY_TREE_GET_REWARD"--人参果树获取奖励
|
|
|
|
OperateActivityModel.UPDATE_COMPOSE_ROBOT_ANNOUNCE_INFO = "OperateActivityModel.UPDATE_COMPOSE_ROBOT_ANNOUNCE_INFO"--发明家信息更新
|
|
OperateActivityModel.UPDATE_COMPOSE_ROBOT_FORMULA_INFO = "OperateActivityModel.UPDATE_COMPOSE_ROBOT_FORMULA_INFO"--配方状态信息更新
|
|
OperateActivityModel.UPDATE_COMPOSE_ROBOT_COLLECT_INFO = "OperateActivityModel.UPDATE_COMPOSE_ROBOT_COLLECT_INFO"--配方收藏信息更新
|
|
OperateActivityModel.UPDATE_COMPOSE_ROBOT_MATERIAL_GOODS_NUM = "OperateActivityModel.UPDATE_COMPOSE_ROBOT_MATERIAL_GOODS_NUM"--材料数量更新
|
|
OperateActivityModel.ADD_COMPOSE_ROBOT_MATERIAL = "OperateActivityModel.ADD_COMPOSE_ROBOT_MATERIAL"--添加材料
|
|
OperateActivityModel.MINUS_COMPOSE_ROBOT_MATERIAL = "OperateActivityModel.MINUS_COMPOSE_ROBOT_MATERIAL"--减去材料
|
|
OperateActivityModel.UPDATE_COMPOSE_ROBOT_ASK_CD = "OperateActivityModel.UPDATE_COMPOSE_ROBOT_ASK_CD"--询问cd刷新
|
|
|
|
--自选扭蛋
|
|
OperateActivityModel.UPDATE_SELECT_EGG_VIEW = "OperateActivityModel.UPDATE_SELECT_EGG_VIEW"--刷新自选扭蛋界面
|
|
OperateActivityModel.UPDATE_SELECT_EGG_SELECT_REWARDS = "OperateActivityModel.UPDATE_SELECT_EGG_SELECT_REWARDS"--自选奖励后刷新选中状态
|
|
OperateActivityModel.UPDATE_SELECT_EGG_VIEW_AFTER_DRAW = "OperateActivityModel.UPDATE_SELECT_EGG_VIEW_AFTER_DRAW"--抽奖后刷新界面
|
|
OperateActivityModel.OPEN_SELECT_EGG_PREVIEW = "OperateActivityModel.OPEN_SELECT_EGG_PREVIEW"--预览奖励
|
|
OperateActivityModel.SELECT_EGG_START_DRAW = "OperateActivityModel.SELECT_EGG_START_DRAW"--准备发出抽奖协议
|
|
OperateActivityModel.AFTER_SELECT_EGG_DRAW = "OperateActivityModel.AFTER_SELECT_EGG_DRAW"--抽奖后放动画
|
|
OperateActivityModel.DO_SELECT_SELECT_EGG_REWARD = "OperateActivityModel.DO_SELECT_SELECT_EGG_REWARD"--要选择奖励的事件,通知主界面判断是否要切换栏目
|
|
OperateActivityModel.CANCLE_CHANGE_RARE_LINE = "OperateActivityModel.CANCLE_CHANGE_RARE_LINE"--取消切换栏目
|
|
|
|
OperateActivityModel.OPEN_SUPER_AWARD_SHOW_VIEW = "OperateActivityModel.OPEN_SUPER_AWARD_SHOW_VIEW"--打开超能大奖奖励展示界面
|
|
|
|
OperateActivityModel.OPEN_MATERIALSUBMIT_REQ_VIEW = "OperateActivityModel.OPEN_MATERIALSUBMIT_REQ_VIEW"--打开材料提交彩钻提交界面
|
|
OperateActivityModel.OPEN_MATERIAL_SUBMIT_BUFF_VIEW = "OperateActivityModel.OPEN_MATERIAL_SUBMIT_BUFF_VIEW"--打开材料提交buff界面
|
|
|
|
function OperateActivityModel:__init()
|
|
OperateActivityModel.Instance = self
|
|
self.login_red = nil--登陆红点
|
|
self:Reset()
|
|
end
|
|
|
|
OperateActivityModel.ScrapingCardFLAGTYPE =
|
|
{
|
|
RANDOM_DRAW = 1,
|
|
CUSTOM_DRAW = 2
|
|
}
|
|
|
|
OperateActivityModel.MaterialSubmitBuffKind = {
|
|
PEACH_EXP = 1,--触发加成后,参加舞池派对和公会篝火期间检验额外加成100%
|
|
BOSS_HUT_ADD = 2,--触发加成后,每次挑战赏金幻魔首次钻石鼓舞免费
|
|
BOSS_ATTACK_ADD = 3,--触发加成后,参加赏金幻魔和专属幻魔时,伤害结算计算BUFF加成,对BOSS伤害提高10%,BOSS对人物伤害降低10%,针对原属性采用加算
|
|
ADVENTURE_EXP_UP = 4,--触发加成后,玩家每分钟放置冒险经验收益提升100%(增对初始数值计算)
|
|
BOSS_DROP_DOUBLE = 5,--触发加成后,玩家赏金幻魔/专属幻魔掉落概率+100%
|
|
EGG_LUCKY_NUM = 6,--触发加成后,<color@1>龙神宝库</color>幸运值持续维持999,抽中不清空
|
|
BOSS_ADD_TIME = 11,--触发加成后,刷新所有赏金幻魔复活状态,且玩家挑战剩余次数+1
|
|
DUN_DOUBLE = 12,--触发加成后,通关材料副本可获得双倍奖励
|
|
DUN_ADD_TIMES = 13,--触发加成后,所有材料副本、守卫幼宠剩余次数+1
|
|
LUCKY_OFFER = 14,--触发加成后,龙神宝库首次10连抽、50连抽分别享受八折优惠
|
|
ADVENTURE_EXP = 15,--触发加成后,玩家放置冒险获得1次免费2倍速(不计入消耗次数)
|
|
GUILD_SPORT = 16,--拼单献礼触发加成后,<color@1>社团协助</color>玩法每人收益提升10%
|
|
ACT_LUCKY_OFFER = 21,--触发加成后,玩家参加定制活动108刮刮卡/111塔罗牌/115黑白棋时,前10次非免费抽奖享受8折
|
|
ACT_LUCKY_FREE = 22,--触发加成后,玩家参加定制活动108刮刮卡/111塔罗牌/115黑白棋时,首次抽奖免费
|
|
}
|
|
|
|
function OperateActivityModel:Reset()
|
|
self.view_info = {}--界面信息
|
|
self.act_red_dot_info = {}
|
|
self.red_dot_info = {}
|
|
self.is_close_main_icon = false
|
|
self.lucky_turn_table_base_info = {}--幸运转盘基础信息
|
|
self.lucky_turn_table_record_info = {}--幸运转盘记录信息
|
|
self.lucky_turn_table_open = false--是否打开了幸运转盘
|
|
self.lucky_turn_subtype = nil--幸运转盘多开子活动
|
|
self.lucky_turn_table_type = nil --幸运转盘的种类
|
|
self.is_skip_lucky_turn_table_action = false--跳过动画
|
|
|
|
---刮刮卡
|
|
self.sc_all_reward_list = false
|
|
self.sc_base_info = {}
|
|
self.sc_cfg = false
|
|
|
|
---塔罗牌卡
|
|
self.tarot_all_reward_list = false
|
|
self.tarot_base_info = {}
|
|
self.tarot_draw_cnt_list = {}
|
|
self.tarot_cfg = false
|
|
|
|
--阶段兑换
|
|
self.stage_exchange_info = {}
|
|
|
|
--冒险征途
|
|
self.adventure_num_info = {}--进度值信息
|
|
self.adventure_task_info = {}--任务信息
|
|
self.adventure_random_pool = {}--奖池列表
|
|
--黑白棋
|
|
self.reversi_info = {}
|
|
self.reversi_cur_info = {}
|
|
self.reversi_cur_pool_info = {}
|
|
|
|
-- 活跃拼图
|
|
self.jigsaw_event_list = {} -- 活跃拼图协议数据
|
|
self.jigsaw_red_cache = {} -- 拼图红点
|
|
|
|
--三日作战信息
|
|
self.three_fight_view_info = {}
|
|
self.three_fight_toggle = {}--三日作战补给购买复选
|
|
|
|
--人参果树
|
|
self.pray_tree_info = false --人参果树基本数据
|
|
self.pray_tree_reward_list = {} --人参果树奖励配置
|
|
|
|
-- 眼疾手快
|
|
self.amasing_jipsaw_info = {} -- 眼疾手快基本数据
|
|
|
|
--合成机
|
|
self.compose_robot_material_cfg = {} --原材料配置
|
|
self.compose_robot_formula_cfg = {} --配方配置
|
|
self.compose_robot_pool_cfg = {}--奖池配置
|
|
self.compose_robot_normal_pool_cfg = {}--普通奖池
|
|
self.compose_robot_collect_list = {} --收藏的合成配方列表
|
|
self.compose_robot_formula_data = {} --配方状态信息
|
|
self.compose_robot_announce_data = {} --广播滚动的发明家信息
|
|
self.compose_robot_now_use_material_list = {} --当前选中的材料列表
|
|
self.compose_robot_act_first_red = {} --活动开启的一次性红点
|
|
self.compose_robot_have_open_view = {} --是否打开过界面的标记
|
|
self.is_in_compose_view = {}
|
|
self.compose_robot_red_info = {}
|
|
self.compose_robot_ask_time = {}
|
|
|
|
--自选扭蛋
|
|
self.select_egg_ser_data = {}--自选扭蛋奖励等后端数据
|
|
self.select_egg_red_info = {}--自选扭蛋红点信息
|
|
self.select_egg_is_in_drawing = false
|
|
|
|
|
|
|
|
self.material_submit_info = {}--材料上交信息
|
|
|
|
self:InitCfg()
|
|
end
|
|
|
|
function OperateActivityModel:getInstance()
|
|
if OperateActivityModel.Instance == nil then
|
|
OperateActivityModel.Instance = OperateActivityModel.New()
|
|
end
|
|
return OperateActivityModel.Instance
|
|
end
|
|
|
|
--初始化配置
|
|
function OperateActivityModel:InitCfg( )
|
|
self.drop_time_limit = {}--BOSS掉落基本配置
|
|
local drop_time_limit = DeepCopy(Config.Droptimelimit)
|
|
local link = nil
|
|
for k,v in pairs(drop_time_limit) do
|
|
local data = v
|
|
link = stringtotable(v.link)--跳转数据
|
|
data.link = link and link[1]
|
|
data.award = stringtotable(v.award)--掉落奖励
|
|
data.desc = Trim(v.desc)--名字
|
|
data.tips = Trim(v.tips)--大奖名字
|
|
if not self.drop_time_limit[v.drop_type] then
|
|
self.drop_time_limit[v.drop_type] = {}
|
|
end
|
|
self.drop_time_limit[v.drop_type][v.drop_way] = data
|
|
end
|
|
|
|
self:InitThreeFightTaskCFG()--初始化三日作战任务表配置
|
|
self:InitThreeFightTaskActCFG()--初始化三日作战任务活动配置
|
|
|
|
self:InitComposeRobotMaterialCfg()--初始化合成机材料配置
|
|
self:InitComposeRobotFormulaCfg()--初始化合成机配方配置
|
|
self:InitComposeRobotPoolCfg()--初始化合成机奖池配置
|
|
end
|
|
|
|
--检查主界面红点(合并活动全部放在KFmodel里面了)
|
|
function OperateActivityModel:CheckMainIconRedDot()
|
|
|
|
end
|
|
|
|
--检测开服活动活动图标是否需要开启[兼顾设置开服活动活动内部的活动列表](合并活动全部放在KFmodel里面了)
|
|
function OperateActivityModel:CheckIconBoolOpen()
|
|
|
|
end
|
|
|
|
--这样写红点 每次调全局的只要调两次
|
|
function OperateActivityModel:IsNeedRedAll( )
|
|
|
|
end
|
|
|
|
--(合并活动全部放在KFmodel里面了)
|
|
function OperateActivityModel:IsNeedRed( id,is_all,sub_type )
|
|
-- local bool = false
|
|
-- self:Fire(OperateActivityModel.ANS_UPDATE_VIEW,id,bool)
|
|
-- if not is_all then
|
|
-- self:CheckMainIconRedDot()
|
|
-- end
|
|
-- print("huangcong:OperateActivityModel [222]: ",bool,id)
|
|
-- PrintTable(self.red_dot_info)
|
|
end
|
|
|
|
--获得活动信息页签列表(合并活动全部放在KFmodel里面了)
|
|
function OperateActivityModel:UpdateTab( )
|
|
|
|
end
|
|
|
|
--获得活动信息页签列表(合并活动全部放在KFmodel里面了)
|
|
function OperateActivityModel:CheckActivityIdOpen( id )
|
|
|
|
end
|
|
|
|
--获得界面类
|
|
function OperateActivityModel:GetViewClass(id)
|
|
|
|
end
|
|
|
|
--获得boss掉落奖励获取途径配置
|
|
function OperateActivityModel:GetBossDropTimeLimitCfg( drop_type )
|
|
return self.drop_time_limit[drop_type]
|
|
end
|
|
|
|
--得到副本是否是多倍掉落的数据信息
|
|
function OperateActivityModel:GetDunIsMulDropVo( dun_id,dun_type )
|
|
local sub_type_list = DeepCopy(CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DUN_MUL_DROP))
|
|
local temp_list = {}
|
|
for i,v in pairs(sub_type_list) do
|
|
for ii,vv in ipairs(v.condition_list) do
|
|
if vv[1] and vv[2] then
|
|
if vv[1] == "type" then
|
|
if dun_id then--目前只有进阶副本只传副本ID
|
|
if tonumber(vv[3]) == dun_id then
|
|
temp_list[#temp_list + 1] = v
|
|
end
|
|
elseif dun_type then--副本类型
|
|
if tonumber(vv[2]) == dun_type then
|
|
temp_list[#temp_list + 1] = v
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if #temp_list == 1 then
|
|
return temp_list[1]
|
|
else
|
|
local sort_list = {}
|
|
local curTime = TimeUtil:getServerTime()
|
|
for kk,vv in ipairs(temp_list) do
|
|
if vv.stime <= curTime and curTime <= vv.etime then
|
|
return vv
|
|
else
|
|
sort_list[#sort_list + 1] = vv
|
|
end
|
|
end
|
|
if #sort_list > 0 then--如果没有找到时间内开放的活动 找与当前时间差值小的活动展示
|
|
local sort_func = function ( a, b )--开始时间从小到大
|
|
return a.stime < b.stime
|
|
end
|
|
if #sort_list > 1 then
|
|
table.sort(sort_list, sort_func)
|
|
end
|
|
|
|
for k,v in pairs(sort_list) do--找到开始时间里当前时间最近的
|
|
if curTime < v.stime then
|
|
return v
|
|
end
|
|
end
|
|
return sort_list[#sort_list]--没找到返回最后一个
|
|
end
|
|
end
|
|
end
|
|
|
|
--得到副本是否是多倍掉落
|
|
function OperateActivityModel:GetDunIsMulDrop( dun_id,dun_type )
|
|
local sub_type_list = DeepCopy(CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DUN_MUL_DROP))
|
|
local mul_info = self:GetDunIsMulDropVo(dun_id,dun_type)
|
|
local mul_num = 0
|
|
local open_lv = 1
|
|
local dun_type = dun_type or 1
|
|
local temp_list = {}
|
|
|
|
if mul_info then
|
|
for ii,vv in ipairs(mul_info.condition_list) do
|
|
if vv[1] and vv[2] then
|
|
if vv[1] == "open_lv" then
|
|
open_lv = tonumber(vv[2])
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
local act_sec = mul_info.etime - TimeUtil:getServerTime()--活动剩余时间
|
|
local act_have_start = mul_info.stime - TimeUtil:getServerTime()--活动剩余时间
|
|
if act_have_start <= 0 and act_sec > 0 then
|
|
for i,v in ipairs(mul_info.condition_list) do
|
|
if v[1] and v[2] then
|
|
if v[1] == "multiple" then
|
|
mul_num = tonumber(v[2])
|
|
end
|
|
end
|
|
end
|
|
if open_lv > RoleManager.Instance.mainRoleInfo.level then
|
|
return false,mul_num
|
|
elseif dun_type == BaseDungeonModel.DUN_TYPE.VIP and RoleManager.Instance.mainRoleInfo.vip_flag < 1 then
|
|
return false,mul_num
|
|
else
|
|
return true,mul_num
|
|
end
|
|
end
|
|
else
|
|
return false,mul_num
|
|
end
|
|
end
|
|
--幸运转盘界面信息
|
|
function OperateActivityModel:SetLuckyTurnTableBaseInfo( subtype, turn_type, vo )
|
|
if subtype and turn_type then
|
|
if not self.lucky_turn_table_base_info[subtype] then
|
|
self.lucky_turn_table_base_info[subtype] = {}
|
|
end
|
|
self.lucky_turn_table_base_info[subtype][turn_type] = vo
|
|
end
|
|
self:ChangeVar("lucky_turn_table_base_info", self.lucky_turn_table_base_info, false, true)
|
|
end
|
|
|
|
function OperateActivityModel:GetLuckyTurnTableBaseInfo( subtype, turn_type )
|
|
if self.lucky_turn_table_base_info[subtype] then
|
|
return self.lucky_turn_table_base_info[subtype][turn_type] or {}
|
|
else
|
|
return {}
|
|
end
|
|
end
|
|
--幸运转盘记录信息
|
|
function OperateActivityModel:SetLuckyTurenTableRecordInfo( subtype, turn_type, vo )
|
|
if subtype and turn_type then
|
|
if not self.lucky_turn_table_record_info[subtype] then
|
|
self.lucky_turn_table_record_info[subtype] = {}
|
|
end
|
|
self.lucky_turn_table_record_info[subtype][turn_type] = vo
|
|
end
|
|
self:ChangeVar("lucky_turn_table_record_info", self.lucky_turn_table_record_info, false, true)
|
|
end
|
|
|
|
function OperateActivityModel:GetLuckyTurnTableRecordInfo( subtype, turn_type )
|
|
if self.lucky_turn_table_record_info[subtype] then
|
|
return self.lucky_turn_table_record_info[subtype][turn_type] or {}
|
|
end
|
|
return {}
|
|
end
|
|
|
|
function OperateActivityModel:IsLuckyTurnTableOpen( )
|
|
return self.lucky_turn_table_open
|
|
end
|
|
|
|
function OperateActivityModel:RefreshLuckyTurnTableSCMD( )
|
|
if self.lucky_turn_table_open and self.lucky_turn_subtype and self.lucky_turn_table_type then
|
|
self:Fire(OperateActivityModel.REQUEST_INFO, 33202, self.lucky_turn_subtype, self.lucky_turn_table_type)
|
|
end
|
|
end
|
|
|
|
---------------------------------------刮刮卡开始 ---------------------------------------
|
|
function OperateActivityModel:SetScrapingCardBaseInfo(vo)
|
|
self.sc_base_info = self.sc_base_info or {}
|
|
self.sc_base_info.sub_type = vo.sub_type
|
|
self.sc_base_info.all_reward_list = vo.reward_list
|
|
self.sc_base_info.card_list = {}
|
|
for i,v in ipairs(vo.card_list) do
|
|
self.sc_base_info.card_list[v.pos] = v.goods_list[1]
|
|
end
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_BASE_DRAW_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:SetScrapingCardScoreInfo(vo)
|
|
self.sc_base_info = self.sc_base_info or {}
|
|
self.sc_base_info.sub_type = vo.sub_type
|
|
|
|
self.sc_base_info.score = vo.score
|
|
self.sc_base_info.next_score = vo.next_score
|
|
self.sc_base_info.draw_times = vo.draw_times
|
|
|
|
local draw_list_pos = {}
|
|
for i,v in ipairs(vo.draw_list) do
|
|
draw_list_pos[v.draw_pos] = true
|
|
end
|
|
local score_reward_list = {}
|
|
for i,v in ipairs(vo.reward_list) do
|
|
score_reward_list[v.pos] =
|
|
{
|
|
goods = v.goods_list[1],
|
|
is_get = draw_list_pos[v.pos] or false,
|
|
}
|
|
end
|
|
self.sc_base_info.score_reward_list = score_reward_list
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ScrapingCard, nil, vo.sub_type)
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_SCROE_DRAW_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:SaveScrapingCardBaseDrawResult(vo)
|
|
local pos = false
|
|
self.sc_base_info.card_list = self.sc_base_info.card_list or {}
|
|
for i,v in ipairs(vo.reward_list) do
|
|
self.sc_base_info.card_list[v.pos] = v.goods_list[1]
|
|
if not pos then
|
|
pos = v.pos
|
|
end
|
|
end
|
|
local get_scroce = vo.score - self.sc_base_info.score
|
|
self.sc_base_info.score = vo.score
|
|
if vo.option == 1 and pos then
|
|
local t = vo.reward_list[1].goods_list[1]
|
|
local d =
|
|
{
|
|
sub_type = vo.sub_type,
|
|
goods_type_id = t.goods_type_id,
|
|
num = t.num,
|
|
}
|
|
|
|
KfActivityModel:getInstance():Fire(KfActivityModel.OPEN_SCRAOING_CARD_TIPS_VIEW_VIEW, d)
|
|
self.sc_base_info.ignore_pos = pos
|
|
end
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ScrapingCard, nil, vo.sub_type)
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_BASE_DRAW_UPDATE)
|
|
Message.show(string.format("获得 %s 刮刮卡积分", HtmlColorTxt(get_scroce, ColorUtil.SHALLOW_GREEN)))
|
|
end
|
|
|
|
function OperateActivityModel:SaveScrapingCardScoreDrawResult(vo)
|
|
self.sc_base_info.score = vo.score
|
|
self.sc_base_info.next_score = vo.next_score
|
|
|
|
local draw_list_pos = {}
|
|
for i,v in ipairs(vo.draw_list) do
|
|
draw_list_pos[v.draw_pos] = true
|
|
end
|
|
local score_reward_list = {}
|
|
for i,v in ipairs(vo.reward_list) do
|
|
score_reward_list[v.pos] =
|
|
{
|
|
goods = v.goods_list[1],
|
|
is_get = draw_list_pos[v.pos] or false,
|
|
}
|
|
end
|
|
self.sc_base_info.score_reward_list = score_reward_list
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ScrapingCard, nil, vo.sub_type)
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_SCROE_DRAW_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:RefreshScrapingCardBaseDraw()
|
|
self.sc_base_info = self.sc_base_info or {}
|
|
self.sc_base_info.card_list = {}
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_BASE_DRAW_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:ScrapingCardInitCfg(vo)
|
|
self.sc_cfg = vo
|
|
end
|
|
|
|
function OperateActivityModel:ScrapingCardShowRewardTips(vo)
|
|
if vo.pos then
|
|
self.sc_base_info.ignore_pos = false
|
|
if self.sc_base_info and self.sc_base_info.card_list and self.sc_base_info.card_list[vo.pos] then
|
|
local goods_type_id = self.sc_base_info.card_list[vo.pos].goods_type_id
|
|
local num = self.sc_base_info.card_list[vo.pos].num
|
|
local goods_fly_data = {[1] = goods_type_id}
|
|
if TableSize(goods_fly_data) > 0 then
|
|
MainUIModel:getInstance():PlayGoodsFlyList(goods_fly_data)
|
|
end
|
|
--飘字
|
|
local goods_fly_data = {
|
|
[1] = {
|
|
goods_type_id = goods_type_id,
|
|
num = num,
|
|
}
|
|
}
|
|
if TableSize(goods_fly_data) > 0 then
|
|
MainUIModel:getInstance():AddFloatInfo(goods_fly_data, true)
|
|
end
|
|
end
|
|
self:Fire(OperateActivityModel.SCRAPING_CARD_BASE_DRAW_UPDATE)
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:ScrapingCardCheckDo(can_do, price, str, ok_func, tips_flag_type)
|
|
function ok_function( )
|
|
if ok_func then
|
|
ok_func()
|
|
end
|
|
end
|
|
function toggle_function( flag )
|
|
if OperateActivityModel.ScrapingCardFLAGTYPE.RANDOM_DRAW == tips_flag_type then
|
|
self.sc_base_info.random_draw_toggle = flag
|
|
elseif OperateActivityModel.ScrapingCardFLAGTYPE.CUSTOM_DRAW == tips_flag_type then
|
|
self.sc_base_info.custom_draw_toggle = flag
|
|
end
|
|
end
|
|
|
|
local show_tips_flag = false
|
|
self.sc_base_info = self.sc_base_info
|
|
if OperateActivityModel.ScrapingCardFLAGTYPE.RANDOM_DRAW == tips_flag_type then
|
|
show_tips_flag = self.sc_base_info.random_draw_toggle or false
|
|
elseif OperateActivityModel.ScrapingCardFLAGTYPE.CUSTOM_DRAW == tips_flag_type then
|
|
show_tips_flag = self.sc_base_info.custom_draw_toggle or false
|
|
end
|
|
if not show_tips_flag then
|
|
if can_do then
|
|
local data =
|
|
{
|
|
show_content = str,
|
|
type = Alert.Type.Four,
|
|
ok_callback = ok_function,
|
|
toggle_function = toggle_function,
|
|
}
|
|
Alert.showbytable(data)
|
|
else
|
|
price = price or 0
|
|
local asset, source = WordManager:GetCommonMoneyIcon(1)
|
|
local data = {
|
|
gold_ab_res = asset,
|
|
gold_res = source,
|
|
price = price,
|
|
insufficientText = "",
|
|
priceText = str,
|
|
titleText = "提示",
|
|
ok_callback = ok_function,
|
|
toggle_function = toggle_function,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, data)
|
|
end
|
|
else
|
|
ok_func()
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:ScrapingGetDrawCfg()
|
|
local need_item_id = 102350
|
|
local one_draw_cnt = 10
|
|
local item_money = 1
|
|
local cfg = self.sc_cfg
|
|
if cfg and cfg.condition_list then
|
|
for k,v in pairs(cfg.condition_list ) do
|
|
if v[1] == "scratch_card_cost" then
|
|
if v[2][1] and v[2][1][2] then
|
|
need_item_id = tonumber(v[2][1][2])
|
|
one_draw_cnt = tonumber(v[2][1][3])
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local item_cfg = Config.Goodsprice[self.need_item_id]
|
|
if item_cfg then
|
|
item_money = item_cfg.price
|
|
end
|
|
return need_item_id, one_draw_cnt, item_money
|
|
end
|
|
|
|
function OperateActivityModel:ScrapingCradGetRedDot(sub_type)
|
|
local b = false
|
|
if self.sc_base_info and self.sc_base_info.score and self.sc_base_info.next_score then
|
|
b = self.sc_base_info.score >= self.sc_base_info.next_score
|
|
end
|
|
if not b then
|
|
local base_type = CustomActivityModel.CustomActBaseType.TAROT
|
|
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:ActScrapingCardBuffTimeLate(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
|
|
b = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return b
|
|
end
|
|
|
|
--刮刮卡活动BUFF时间倒计时
|
|
function OperateActivityModel:ActScrapingCardBuffTimeLate( sec,sub_type )
|
|
if self.act_scraping_card_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_scraping_card_buff_timer_id)
|
|
self.act_scraping_card_buff_timer_id = nil
|
|
end
|
|
if self.scraping_card_act_sec and self.scraping_card_act_sec >= sec then
|
|
return
|
|
else
|
|
self.scraping_card_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_scraping_card_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_scraping_card_buff_timer_id)
|
|
self.act_scraping_card_buff_timer_id = nil
|
|
end
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ScrapingCard,nil,sub_type)
|
|
end
|
|
end
|
|
if not self.act_scraping_card_buff_timer_id then
|
|
self.act_scraping_card_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
|
|
end
|
|
onTimer()
|
|
else
|
|
if self.act_scraping_card_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_scraping_card_buff_timer_id)
|
|
self.act_scraping_card_buff_timer_id = nil
|
|
end
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ScrapingCard,nil,sub_type)
|
|
end
|
|
end
|
|
|
|
|
|
function OperateActivityModel:ScrapingCradIsOpen(sub_type)
|
|
local b = false
|
|
if self.sc_cfg and self.sc_cfg.sub_type == sub_type then
|
|
local time = TimeUtil:getServerTime()
|
|
if time >= self.sc_cfg.stime and time <= self.sc_cfg.etime then
|
|
b = true
|
|
end
|
|
end
|
|
if not b then
|
|
Message.show("活动未开启")
|
|
end
|
|
return b
|
|
end
|
|
---------------------------------------刮刮卡结束 ---------------------------------------
|
|
|
|
|
|
---------------------------------------塔罗牌开始 ---------------------------------------
|
|
|
|
function OperateActivityModel:SetTarotBaseInfo(vo)
|
|
self.tarot_base_info = self.tarot_base_info or {}
|
|
self.tarot_base_info.sub_type = vo.sub_type
|
|
local reward_pool = vo.reward_pool
|
|
table.sort(reward_pool, function (a, b)
|
|
return a.index < b.index
|
|
end)
|
|
self.tarot_base_info.reward_pool = reward_pool
|
|
local get_reward_list = {}
|
|
local cnt = 0
|
|
for i,v in ipairs( vo.reward_pool) do
|
|
if v.status ~= 0 then
|
|
get_reward_list[v.status] = v
|
|
cnt = cnt + 1
|
|
end
|
|
end
|
|
local card_list = vo.card_list
|
|
table.sort(card_list, function (a, b)
|
|
return a.pos < b.pos
|
|
end)
|
|
self.tarot_base_info.card_list = card_list
|
|
self.tarot_base_info.get_reward_list = get_reward_list
|
|
|
|
self.tarot_draw_cnt_list = self.tarot_draw_cnt_list or {}
|
|
self.tarot_draw_cnt_list[vo.sub_type] = cnt
|
|
|
|
self:Fire(OperateActivityModel.TAROT_BASE_UPDATE)
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Tarot, nil, vo.sub_type)
|
|
end
|
|
|
|
function OperateActivityModel:UpdateTarorDrag(vo)
|
|
if self.tarot_base_info then
|
|
if self.tarot_base_info.reward_pool then
|
|
for i,v in ipairs(self.tarot_base_info.reward_pool) do
|
|
if v.index == vo.index then
|
|
v.status = vo.pos
|
|
self.tarot_base_info.get_reward_list = self.tarot_base_info.get_reward_list or {}
|
|
self.tarot_base_info.get_reward_list[vo.pos] = v
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
if self.tarot_base_info.card_list then
|
|
for i,v in ipairs(self.tarot_base_info.card_list) do
|
|
if v.pos == vo.pos then
|
|
v.status = 1
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
self.tarot_draw_cnt_list = self.tarot_draw_cnt_list or {}
|
|
self.tarot_draw_cnt_list[vo.sub_type] = self.tarot_draw_cnt_list[vo.sub_type] or 0
|
|
self.tarot_draw_cnt_list[vo.sub_type] = self.tarot_draw_cnt_list[vo.sub_type] + 1
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Tarot, nil, vo.sub_type)
|
|
self:Fire(OperateActivityModel.TAROT_DRAW_UPDATE, vo.pos)
|
|
end
|
|
|
|
function OperateActivityModel:GetTargetRewardInfoByPos(pos)
|
|
local info
|
|
if self.tarot_base_info and self.tarot_base_info.get_reward_list then
|
|
info = self.tarot_base_info.get_reward_list[pos]
|
|
end
|
|
return info
|
|
end
|
|
|
|
function OperateActivityModel:GetTargetResList(list, size, sub_type)
|
|
local res_list = {}
|
|
if list and #list > 0 and size and size >= #list then
|
|
self.tarot_base_info.res_list = self.tarot_base_info.res_list or {}
|
|
self.tarot_base_info.res_list[sub_type] = self.tarot_base_info.res_list[sub_type] or {}
|
|
local function init_res_list(need_size, max_size)
|
|
local t = {}
|
|
local res_table = {}
|
|
for i=1,max_size do
|
|
t[i] = i
|
|
end
|
|
|
|
for i=1,need_size do
|
|
local idx = math.random(1, #t)
|
|
local tt = table.remove(t, idx)
|
|
res_table[i] = tt
|
|
end
|
|
return res_table
|
|
end
|
|
if #self.tarot_base_info.res_list[sub_type] == 0 then
|
|
self.tarot_base_info.res_list[sub_type] = init_res_list(#list, size)
|
|
else
|
|
local is_open = false
|
|
for i,v in ipairs(list) do
|
|
if v.status ~= 0 then
|
|
is_open = true
|
|
break
|
|
end
|
|
end
|
|
if not is_open then
|
|
self.tarot_base_info.res_list[sub_type] = init_res_list(#list, size)
|
|
end
|
|
end
|
|
res_list = self.tarot_base_info.res_list[sub_type]
|
|
end
|
|
return res_list
|
|
end
|
|
|
|
function OperateActivityModel:UpdateTarorRefresh(vo)
|
|
self:Fire(OperateActivityModel.TAROT_BASE_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:SetTarotResetFlag(flag)
|
|
self.tarot_base_info = self.tarot_base_info or {}
|
|
self.tarot_base_info.reset_flag = flag
|
|
end
|
|
|
|
function OperateActivityModel:GetTarotResetFlag()
|
|
return self.tarot_base_info.reset_flag
|
|
end
|
|
|
|
function OperateActivityModel:SetTarotRecordInfo(vo)
|
|
self.tarot_base_info = self.tarot_base_info or {}
|
|
self.tarot_base_info.sub_type = vo.sub_type
|
|
local goods_log = {}
|
|
for i,v in ipairs(vo.goods_log) do
|
|
table.insert(goods_log, v)
|
|
end
|
|
self.tarot_base_info.goods_log = goods_log
|
|
self:Fire(OperateActivityModel.TAROT_RECORD_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:SetTarotRecordInfoAdd(vo)
|
|
self.tarot_base_info = self.tarot_base_info or {}
|
|
self.tarot_base_info.goods_log = self.tarot_base_info.goods_log or {}
|
|
table.insert(self.tarot_base_info.goods_log, 1, vo)
|
|
if #self.tarot_base_info.goods_log > 30 then
|
|
table.remove(self.tarot_base_info.goods_log, #self.tarot_base_info.goods_log)
|
|
end
|
|
self:Fire(OperateActivityModel.TAROT_RECORD_UPDATE)
|
|
end
|
|
|
|
function OperateActivityModel:GetTargetRandomPos()
|
|
local pos = 0
|
|
local t = {}
|
|
if self.tarot_base_info and self.tarot_base_info.card_list then
|
|
for i,v in ipairs(self.tarot_base_info.card_list) do
|
|
if v.status == 0 then
|
|
table.insert(t, i)
|
|
end
|
|
end
|
|
if #t > 1 then
|
|
local idx = math.random(1, #t)
|
|
pos = t[idx]
|
|
elseif #t == 1 then
|
|
pos = t[1]
|
|
end
|
|
end
|
|
return pos
|
|
end
|
|
|
|
function OperateActivityModel:SetTarotCfg(vo)
|
|
self.tarot_cfg = self.tarot_cfg or {}
|
|
self.tarot_cfg[vo.sub_type]= vo
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Tarot, nil, vo.sub_type)
|
|
end
|
|
|
|
function OperateActivityModel:IsTarotOver()
|
|
local b = false
|
|
if self.tarot_cfg then
|
|
local cur_time = TimeUtil:getServerTime()
|
|
if self.tarot_cfg.etime > cur_time then
|
|
b = true
|
|
end
|
|
end
|
|
return b
|
|
end
|
|
|
|
function OperateActivityModel:GetTarotAllRewardList(base_type, sub_type)
|
|
if not self.tarot_all_reward_list or not self.tarot_all_reward_list[base_type] or not self.tarot_all_reward_list[base_type][sub_type] then
|
|
self.tarot_all_reward_list = self.tarot_all_reward_list or {}
|
|
local act_info = CustomActivityModel:getInstance():getOneActRewardList(base_type, sub_type)
|
|
if act_info then
|
|
local list = {}
|
|
for i=#act_info.reward_list,1,-1 do
|
|
local t = stringtotable(act_info.reward_list[i].reward)
|
|
table.insert(list, t[1])
|
|
end
|
|
self.tarot_all_reward_list = self.tarot_all_reward_list or {}
|
|
self.tarot_all_reward_list[base_type] = self.tarot_all_reward_list[base_type] or {}
|
|
if list and #list > 1 then
|
|
table.sort(list, function ( a,b )
|
|
a.basic = a.basic or GoodsModel:getInstance():GetGoodsBasicByTypeId(tonumber(a[2]))
|
|
b.basic = b.basic or GoodsModel:getInstance():GetGoodsBasicByTypeId(tonumber(b[2]))
|
|
return a.basic.color > b.basic.color
|
|
end)
|
|
end
|
|
self.tarot_all_reward_list[base_type][sub_type] = list
|
|
end
|
|
end
|
|
return self.tarot_all_reward_list and self.tarot_all_reward_list[base_type] and self.tarot_all_reward_list[base_type][sub_type] or {}
|
|
end
|
|
|
|
function OperateActivityModel:GetTarotDrawCnt()
|
|
local cnt = 0
|
|
if self.tarot_base_info and self.tarot_base_info.card_list then
|
|
for i,v in ipairs(self.tarot_base_info.card_list) do
|
|
if v.status ~= 0 then
|
|
cnt = cnt + 1
|
|
end
|
|
end
|
|
end
|
|
return cnt
|
|
end
|
|
|
|
function OperateActivityModel:GetDragCostInfo(sub_type, cnt)
|
|
local info =
|
|
{
|
|
goods_id = 102350,
|
|
cost_num = 9,
|
|
price = 1,
|
|
price_type = 1,
|
|
}
|
|
if self.tarot_cfg and self.tarot_cfg[sub_type] and self.tarot_cfg[sub_type].condition_list then
|
|
local cfg = self.tarot_cfg[sub_type]
|
|
|
|
if cfg.condition_list[1] and cfg.condition_list[1][2] then
|
|
info.goods_id = tonumber(cfg.condition_list[1][2])
|
|
end
|
|
local draw_cnt = cnt or self:GetTarotDrawCnt() + 1
|
|
if cfg.condition_list[2] and cfg.condition_list[2][2] then
|
|
info.cost_num = tonumber(cfg.condition_list[2][2][draw_cnt])
|
|
end
|
|
end
|
|
local cfg = Config.Goodsprice
|
|
if cfg[info.goods_id] then
|
|
info.price = cfg[info.goods_id].price
|
|
info.price_type = cfg[info.goods_id].price_type
|
|
end
|
|
return info
|
|
end
|
|
|
|
function OperateActivityModel:GetRefreshCostInfo(sub_type)
|
|
local info =
|
|
{
|
|
goods_id = 102314,
|
|
cost_num = 1,
|
|
price = 1,
|
|
price_type = 1,
|
|
}
|
|
if self.tarot_cfg and self.tarot_cfg[sub_type] and self.tarot_cfg[sub_type].condition_list then
|
|
local cfg = self.tarot_cfg[sub_type]
|
|
if cfg.condition_list[3] and cfg.condition_list[3][2] and cfg.condition_list[3][2][1] then
|
|
local d = cfg.condition_list[3][2][1]
|
|
info.goods_id = tonumber(d[2])
|
|
info.cost_num = tonumber(d[3])
|
|
end
|
|
end
|
|
|
|
local cfg = Config.Goodsprice
|
|
if cfg[info.goods_id] then
|
|
info.price = cfg[info.goods_id].price
|
|
info.price_type = cfg[info.goods_id].price_type
|
|
end
|
|
return info
|
|
end
|
|
|
|
function OperateActivityModel:GetDragGoodsId()
|
|
local goods_id = 102350
|
|
for k,v in pairs(self.tarot_cfg) do
|
|
local cfg = v
|
|
if cfg.condition_list[1] and cfg.condition_list[1][2] then
|
|
goods_id = tonumber(cfg.condition_list[1][2])
|
|
end
|
|
break
|
|
end
|
|
return goods_id
|
|
end
|
|
|
|
function OperateActivityModel:GetRefreshGoodsId()
|
|
local goods_id = 102314
|
|
for k,v in pairs(self.tarot_cfg) do
|
|
local cfg = v
|
|
if cfg.condition_list[3] and cfg.condition_list[3][2] and cfg.condition_list[3][2][1] and cfg.condition_list[3][2][1][2] then
|
|
goods_id = tonumber(cfg.condition_list[3][2][1][2])
|
|
end
|
|
break
|
|
end
|
|
return goods_id
|
|
end
|
|
|
|
function OperateActivityModel:TarotIsOpen(sub_type)
|
|
local b = false
|
|
if self.tarot_cfg and self.tarot_cfg[sub_type] then
|
|
local cfg = self.tarot_cfg[sub_type]
|
|
local time = TimeUtil:getServerTime()
|
|
if time >= cfg.stime and time <= cfg.etime then
|
|
b = true
|
|
end
|
|
end
|
|
if not b then
|
|
Message.show("活动未开启")
|
|
end
|
|
return b
|
|
end
|
|
|
|
|
|
function OperateActivityModel:TarotCheckDo(can_do, price, str, ok_func)
|
|
function ok_function( )
|
|
if ok_func then
|
|
ok_func()
|
|
end
|
|
end
|
|
function toggle_function( flag )
|
|
self.tarot_base_info.custom_draw_toggle = flag
|
|
end
|
|
|
|
local show_tips_flag = self.tarot_base_info.custom_draw_toggle or false
|
|
if not can_do and not show_tips_flag then
|
|
price = price or 0
|
|
local asset, source = WordManager:GetCommonMoneyIcon(1)
|
|
local data = {
|
|
gold_ab_res = asset,
|
|
gold_res = source,
|
|
price = price,
|
|
insufficientText = "",
|
|
priceText = str,
|
|
titleText = "提示",
|
|
ok_callback = ok_function,
|
|
toggle_function = toggle_function,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, data)
|
|
else
|
|
ok_func()
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:TarotCheckRefresh(can_do, price, str, ok_func)
|
|
function ok_function( )
|
|
if ok_func then
|
|
ok_func()
|
|
end
|
|
end
|
|
function toggle_function( flag )
|
|
self.tarot_base_info.custom_refresh_toggle = flag
|
|
end
|
|
|
|
local show_tips_flag = self.tarot_base_info.custom_refresh_toggle or false
|
|
if not can_do and not show_tips_flag then
|
|
price = price or 0
|
|
local asset, source = WordManager:GetCommonMoneyIcon(1)
|
|
local data = {
|
|
gold_ab_res = asset,
|
|
gold_res = source,
|
|
price = price,
|
|
insufficientText = "",
|
|
priceText = str,
|
|
titleText = "提示",
|
|
ok_callback = ok_function,
|
|
toggle_function = toggle_function,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, data)
|
|
else
|
|
ok_func()
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:TarotGetRedDot(sub_type)
|
|
local b = false
|
|
if self.tarot_cfg and self.tarot_cfg[sub_type] and self.tarot_draw_cnt_list and self.tarot_draw_cnt_list[sub_type] then
|
|
local draw_cost_info = self:GetDragCostInfo(self.tarot_draw_cnt_list[sub_type] + 1)
|
|
b = draw_cost_info.cost_num == 0
|
|
end
|
|
|
|
if not b then
|
|
local base_type = CustomActivityModel.CustomActBaseType.TAROT
|
|
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:ActTarotBuffTimeLate(sec)
|
|
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
|
|
b = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return b
|
|
end
|
|
|
|
--塔罗牌活动BUFF时间倒计时
|
|
function OperateActivityModel:ActTarotBuffTimeLate( sec )
|
|
if self.act_tarot_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_tarot_buff_timer_id)
|
|
self.act_tarot_buff_timer_id = nil
|
|
end
|
|
if self.tarot_act_sec and self.tarot_act_sec >= sec then
|
|
return
|
|
else
|
|
self.tarot_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_tarot_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_tarot_buff_timer_id)
|
|
self.act_tarot_buff_timer_id = nil
|
|
end
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Tarot)
|
|
end
|
|
end
|
|
if not self.act_tarot_buff_timer_id then
|
|
self.act_tarot_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
|
|
end
|
|
onTimer()
|
|
else
|
|
if self.act_tarot_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_tarot_buff_timer_id)
|
|
self.act_tarot_buff_timer_id = nil
|
|
end
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Tarot)
|
|
end
|
|
end
|
|
---------------------------------------塔罗牌结束 ---------------------------------------
|
|
|
|
---------------------------------------阶段兑换商城信息 ---------------------------------------
|
|
function OperateActivityModel:GetStageExchangeInfo( sub_type )
|
|
return self.stage_exchange_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetStageExchangeInfo( value,one_data )
|
|
if (not value) and one_data then
|
|
--修改单条信息
|
|
local base_info = self:GetStageExchangeInfo(one_data.sub_type)
|
|
if base_info then
|
|
for k,v in pairs(base_info) do
|
|
if v.phase == one_data.phase then
|
|
for kk,vv in pairs(v.goods_list) do
|
|
if vv.grade_id == one_data.grade_id then
|
|
vv.exchange_num = one_data.exchange_num
|
|
-------------------------
|
|
if one_data.phase == 4 and vv.limit_num == 999 then
|
|
--无限制的那些要特殊处理
|
|
vv.exchange_num = 0
|
|
end
|
|
-------------------------
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return
|
|
end
|
|
-------------------------
|
|
for k,v in pairs(self.stage_exchange_info) do
|
|
if v.phase == 4 then
|
|
for kk,vv in pairs(v.goods_list) do
|
|
if vv.limit_num == 999 then
|
|
--无限制的那些要特殊处理
|
|
vv.exchange_num = 0
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-------------------------
|
|
local function sort_call( a,b )
|
|
return a.phase < b.phase
|
|
end
|
|
table.sort( value.goods_phase, sort_call )
|
|
self.stage_exchange_info[value.sub_type] = value.goods_phase
|
|
end
|
|
--获取阶段商城当前解锁期
|
|
function OperateActivityModel:GetStageExchangeUnlockPhase( sub_type )
|
|
local base_info = self:GetStageExchangeInfo(sub_type)
|
|
if not base_info then return 0 end
|
|
local unlock_phase = 0
|
|
for i,v in ipairs(base_info) do
|
|
unlock_phase = v.phase
|
|
for a,b in pairs(v.goods_list) do
|
|
if b.exchange_num < b.limit_num then
|
|
return unlock_phase
|
|
end
|
|
end
|
|
end
|
|
return unlock_phase
|
|
end
|
|
function OperateActivityModel:GetStageExchangeCostId( sub_type )
|
|
self.cost_id_stage_exchange = self.cost_id_stage_exchange or {}
|
|
if not self.cost_id_stage_exchange[sub_type] then
|
|
local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.STAGE_EXCHANGE, sub_type)
|
|
local list_condition = stringtotable(act_info.condition)
|
|
for k,v in pairs(list_condition) do
|
|
if v[1] == "cost_type" then
|
|
self.cost_id_stage_exchange[sub_type] = tonumber(v[2])
|
|
break
|
|
end
|
|
end
|
|
end
|
|
return self.cost_id_stage_exchange[sub_type]
|
|
end
|
|
---------------------------------------阶段兑换商城信息 ---------------------------------------
|
|
|
|
|
|
---------------------------------------冒险征途 start---------------------------------------
|
|
--进度值信息
|
|
function OperateActivityModel:GetAdventureNumInfo( sub_type )
|
|
return self.adventure_num_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetAdventureNumInfo( value )
|
|
self.adventure_num_info[value.sub_type] = value
|
|
self:AdventureTaskFix(value.sub_type)
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Adventure,nil,value.sub_type)
|
|
end
|
|
--任务信息
|
|
function OperateActivityModel:GetAdventureTaskInfo( sub_type )
|
|
return self.adventure_task_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetAdventureTaskInfo( value )
|
|
self.adventure_task_info[value.sub_type] = value.mod_list
|
|
self:AdventureTaskFix(value.sub_type)
|
|
self:SetAdventureRandomPool(value.sub_type,value.reward_list or {})
|
|
end
|
|
--随机奖池
|
|
function OperateActivityModel:GetAdventureRandomPool( sub_type )
|
|
return self.adventure_random_pool[sub_type]
|
|
end
|
|
function OperateActivityModel:SetAdventureRandomPool( sub_type,value )
|
|
self.adventure_random_pool[sub_type] = value
|
|
end
|
|
--给任务信息添加进度信息
|
|
function OperateActivityModel:AdventureTaskFix( sub_type )
|
|
local data_1 = self:GetAdventureNumInfo(sub_type)
|
|
local data_2 = self:GetAdventureTaskInfo(sub_type)
|
|
if data_1 and data_2 then
|
|
for k,v in pairs(data_2) do
|
|
for kk,vv in pairs(data_1.task_list) do
|
|
if (v.mod_id == vv.mod_id) and (v.sub_id == vv.sub_id) then
|
|
v.times = vv.times
|
|
break
|
|
end
|
|
end
|
|
v.times = v.times or 0
|
|
end
|
|
end
|
|
end
|
|
function OperateActivityModel:GetAdventureCostIcon( sub_type )
|
|
local act_info = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.ADVENTURE, 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] == "act_icon_pic" then
|
|
return v[2]
|
|
end
|
|
end
|
|
end
|
|
return 1
|
|
end
|
|
---------------------------------------冒险征途 end---------------------------------------
|
|
|
|
---------------------------------------活跃拼图 start---------------------------------------
|
|
-- 缓存活跃拼图协议信息 33153
|
|
function OperateActivityModel:SetJigsawEventData(vo)
|
|
if not vo then return end
|
|
self.jigsaw_event_list[vo.sub_type] = self.jigsaw_event_list[vo.sub_type] or {}
|
|
self.jigsaw_event_list[vo.sub_type].grades = {}
|
|
-- 按键值存储已领取阶段
|
|
for k, v in ipairs(vo.grades) do
|
|
self.jigsaw_event_list[vo.sub_type].grades[v.grade] = true
|
|
end
|
|
self.jigsaw_event_list[vo.sub_type].tasks = {}
|
|
local key = ""
|
|
for k, v in ipairs(vo.tasks) do
|
|
key = v.task_row .. "@" .. v.task_colu
|
|
self.jigsaw_event_list[vo.sub_type].tasks[key] = v
|
|
end
|
|
end
|
|
function OperateActivityModel:GetJigsawEventData(sub_type)
|
|
return self.jigsaw_event_list[sub_type] or nil
|
|
end
|
|
-- 获取活跃拼图奖励领取情况 已领取会返回true
|
|
function OperateActivityModel:GetJigsawGradeFlag(sub_type, grade)
|
|
if sub_type and grade and self.jigsaw_event_list[sub_type] then
|
|
return self.jigsaw_event_list[sub_type].grades[grade]
|
|
end
|
|
return false
|
|
end
|
|
-- 获取活跃拼图任务协议数据
|
|
function OperateActivityModel:GetJigsawTaskEventData(sub_type, task_row, task_colu)
|
|
if sub_type then
|
|
if task_row and task_colu then
|
|
return self.jigsaw_event_list[sub_type]
|
|
and self.jigsaw_event_list[sub_type].tasks
|
|
and self.jigsaw_event_list[sub_type].tasks[task_row .. "@" .. task_colu] or nil
|
|
else
|
|
return self.jigsaw_event_list[sub_type] and self.jigsaw_event_list[sub_type].tasks or nil
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
-- 返回表1:根据活跃拼图的奖励配置,筛选出带有奖励的任务列表 格式为 [任务行@任务列] = true
|
|
-- 返回表2:根据活动的condition_list,拼接形成键值后用gade作为值成表方便查询grade
|
|
function OperateActivityModel:GetJigsawAwardTaskListAndGradeList(reward_cfg)
|
|
local tb1, tb2 = {}, {}
|
|
local key = ""
|
|
if reward_cfg then
|
|
for k, v in ipairs(reward_cfg.reward_list) do
|
|
for k2, v2 in ipairs(v.condition_list) do
|
|
for k3, v3 in ipairs(v2) do
|
|
if k3 == 1 then
|
|
key = v3
|
|
else
|
|
key = key .. "@" .. v3
|
|
end
|
|
end
|
|
-- 根据条件列表组合成键值保存奖励档次
|
|
tb2[key] = v.grade
|
|
-- 如果是任务节点的奖励,则重新创建键值并添加到表1
|
|
if v2[1] == "order" then
|
|
key = v2[2] .. "@" .. v2[3]
|
|
tb1[key] = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return tb1, tb2
|
|
end
|
|
-- 获取活跃拼图任务进度 task_state:0待完成 1可领取 2已领取(有部分任务有奖励,要做是否存在奖励分类处理,对于没有奖励的任务,前端新增状态3)
|
|
function OperateActivityModel:GetJigsawTaskState(sub_type, award_task_list, task_row, task_colu)
|
|
local state = 0
|
|
if sub_type and award_task_list and task_row and task_colu then
|
|
-- 是否是有奖励的任务
|
|
local has_reward = award_task_list[task_row.."@"..task_colu] or false
|
|
-- 获取任务状态
|
|
local event_data = self:GetJigsawTaskEventData(sub_type, task_row, task_colu)
|
|
state = event_data and event_data.task_state or 0
|
|
-- 完成没有奖励的任务,特殊处理为3
|
|
if not has_reward and state == 1 then
|
|
state = 3
|
|
end
|
|
end
|
|
return state
|
|
end
|
|
|
|
-- 拼图活动领取更新缓存 33154
|
|
function OperateActivityModel:UpdateJigsawGradeData(vo)
|
|
if vo and self.jigsaw_event_list[vo.sub_type] and self.jigsaw_event_list[vo.sub_type].grades then
|
|
self.jigsaw_event_list[vo.sub_type].grades[vo.grade] = true
|
|
end
|
|
end
|
|
|
|
-- 获取活跃拼图任务配置
|
|
function OperateActivityModel:GetJigsawTaskCfgData(condition_list)
|
|
if not condition_list then return end
|
|
local tb = {}
|
|
local suit_id, bg_res = nil, "bg_1" -- 背景图有默认资源
|
|
-- 获取任务套的id
|
|
for k, v in ipairs(condition_list) do
|
|
if v[1] == "suit" then
|
|
suit_id = tonumber(v[2])
|
|
end
|
|
if string.find(v[1], "bg_") then
|
|
bg_res = v[1]
|
|
end
|
|
end
|
|
-- 根据任务套id获取任务内容
|
|
if suit_id then
|
|
for k, v in pairs(Config.Actslicetask) do
|
|
if v.suit == suit_id then
|
|
tb[#tb+1] = v
|
|
end
|
|
end
|
|
-- 排序任务
|
|
local sort_func = function ( a, b )
|
|
if a.row == b.row then
|
|
return a.colu < b.colu
|
|
else
|
|
return a.row < b.row
|
|
end
|
|
end
|
|
table.sort(tb, sort_func)
|
|
end
|
|
return tb, suit_id, bg_res
|
|
end
|
|
|
|
-- 活跃拼图红点
|
|
function OperateActivityModel:GetJigsawRed(sub_type, reward_cfg)
|
|
local bool = false
|
|
if sub_type and reward_cfg then
|
|
self.jigsaw_red_cache[sub_type] = {}
|
|
-- 行,列的完成任务数
|
|
local row_task_state_tb, col_task_state_tb = {}, {}
|
|
-- 先检测任务可完成的红点
|
|
local award_task_list, grade_list = self:GetJigsawAwardTaskListAndGradeList(reward_cfg)
|
|
local key, state = "", 0
|
|
local tasks = self:GetJigsawTaskEventData(sub_type) -- 任务协议状态
|
|
local total_task_num = TableSize(tasks)
|
|
local task_finished_num = 0
|
|
if tasks then
|
|
for k, v in pairs(tasks) do
|
|
state = self:GetJigsawTaskState(sub_type, award_task_list, v.task_row, v.task_colu)
|
|
key = v.task_row .. "@" .. v.task_colu
|
|
-- 根据行列记录任务完成数
|
|
row_task_state_tb[v.task_row] = row_task_state_tb[v.task_row] or 0
|
|
row_task_state_tb[v.task_row] = state >= 2 and row_task_state_tb[v.task_row] + 1 or row_task_state_tb[v.task_row]
|
|
col_task_state_tb[v.task_colu] = col_task_state_tb[v.task_colu] or 0
|
|
col_task_state_tb[v.task_colu] = state >= 2 and col_task_state_tb[v.task_colu] + 1 or col_task_state_tb[v.task_colu]
|
|
|
|
-- 累加完成个数
|
|
task_finished_num = state >= 2 and task_finished_num + 1 or task_finished_num
|
|
|
|
bool = state == 1 or bool
|
|
end
|
|
end
|
|
|
|
-- 再检测横行竖列的红点
|
|
local key_list = {}
|
|
for k, v in pairs(grade_list) do
|
|
if not self:GetJigsawGradeFlag(sub_type, v) then -- 没有已领取记录
|
|
key_list = Split(k, "@")
|
|
if key_list[1] == "row" and row_task_state_tb[tonumber(key_list[2])] then -- 检测横行的红点
|
|
bool = row_task_state_tb[tonumber(key_list[2])] >= 3 or bool
|
|
elseif key_list[1] == "column" and col_task_state_tb[tonumber(key_list[2])] then -- 检测竖列的红点
|
|
bool = col_task_state_tb[tonumber(key_list[2])] >= 3 or bool
|
|
elseif key_list[1] == "count" then -- 检测任务是否全部完成
|
|
-- 缓存红点
|
|
self.jigsaw_red_cache[sub_type][key_list[1]] = task_finished_num >= total_task_num and total_task_num > 0
|
|
bool = self.jigsaw_red_cache[sub_type][key_list[1]] or bool
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return bool
|
|
end
|
|
function OperateActivityModel:GetJigsawRedCache(sub_type, red_type)
|
|
if sub_type then
|
|
if red_type then
|
|
return self.jigsaw_red_cache[sub_type] and self.jigsaw_red_cache[sub_type][red_type] or false
|
|
else
|
|
return self.jigsaw_red_cache[sub_type]
|
|
end
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
---------------------------------------活跃拼图 end---------------------------------------
|
|
---------------------------------------黑白棋 start---------------------------------------
|
|
--总奖励列表
|
|
function OperateActivityModel:GetReversiInfo( sub_type )
|
|
return self.reversi_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetReversiInfo( value )
|
|
self.reversi_info[value.sub_type] = value
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi, nil, value.sub_type)
|
|
end
|
|
|
|
--当前奖池状态
|
|
function OperateActivityModel:GetReversiCurInfo( sub_type )
|
|
return self.reversi_cur_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetReversiCurInfo( value )
|
|
self.reversi_cur_info[value.sub_type] = value.reward_list
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.Reversi, nil, value.sub_type)
|
|
end
|
|
--当前奖池奖励列表
|
|
function OperateActivityModel:GetReversiCurPoolInfo( sub_type )
|
|
return self.reversi_cur_pool_info[sub_type]
|
|
end
|
|
function OperateActivityModel:SetReversiCurPoolInfo( value )
|
|
value.cost_tb = stringtotable(value.cost)[1]
|
|
value.other_cost_tb = stringtotable(value.other_cost)[1]
|
|
self.reversi_cur_pool_info[value.sub_type] = value
|
|
end
|
|
---------------------------------------黑白棋 end---------------------------------------
|
|
|
|
---------------------------------------三日作战 start---------------------------------------
|
|
function OperateActivityModel:InitThreeFightTaskCFG( )--初始化三日作战任务表配置
|
|
self.three_fight_task_cfg = {}
|
|
local data = DeepCopy(Config.Daysplantask)
|
|
for k,v in pairs(data) do
|
|
if not self.three_fight_task_cfg[v.task_type] then
|
|
self.three_fight_task_cfg[v.task_type] = {}
|
|
end
|
|
v.reward = stringtotable(v.reward)
|
|
v.link = stringtotable(v.link)
|
|
v.desc = Trim(v.desc)
|
|
self.three_fight_task_cfg[v.task_type][v.task_id] = v
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:GetThreeFightTaskCfg( task_type,task_id )--获得三日作战任务表配置
|
|
if self.three_fight_task_cfg[task_type] then
|
|
return self.three_fight_task_cfg[task_type][task_id]
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:InitThreeFightTaskActCFG( )--初始化三日作战任务活动配置
|
|
self.three_fight_act_task_cfg = {}
|
|
local data = DeepCopy(Config.Daysplantasksuit)
|
|
for k,v in pairs(data) do
|
|
if not self.three_fight_act_task_cfg[v.suit] then
|
|
self.three_fight_act_task_cfg[v.suit] = {}
|
|
end
|
|
if not self.three_fight_act_task_cfg[v.suit][v.open_day] then
|
|
self.three_fight_act_task_cfg[v.suit][v.open_day] = {}
|
|
end
|
|
self.three_fight_act_task_cfg[v.suit][v.open_day][#self.three_fight_act_task_cfg[v.suit][v.open_day] + 1] = v
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:SetThreeFightViewInfoOne( v )--设置三日作战服务端数据
|
|
local new_data = {}
|
|
local cur_times = 0
|
|
local max_times = 0
|
|
for kk,vv in pairs(v.list) do
|
|
new_data[vv.day] = vv
|
|
end
|
|
v.list = new_data
|
|
self.three_fight_view_info[v.sub_type] = v
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ThreeFight,nil,v.sub_type)
|
|
end
|
|
|
|
function OperateActivityModel:CheckThreeFightRedDot( sub_type )--检查三日作战红点
|
|
local show = false
|
|
self.three_fight_red_info = self.three_fight_red_info or {}
|
|
self.three_fight_red_info[sub_type] = {}
|
|
local base_type = CustomActivityModel.CustomActBaseType.THREE_FIGHT
|
|
local 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
|
|
if act_list then
|
|
act_type = act_list.act_type
|
|
local start_day = math.ceil((TimeUtil:getServerTime() - act_list.stime)/60/60/24)--当前活动开始的第几天
|
|
for k,v in pairs(self.three_fight_view_info) do
|
|
if v.sub_type == sub_type then
|
|
for kk,vv in pairs(v.list) do
|
|
for kkk,vvv in pairs(vv.task_list) do
|
|
if vvv.state == 1 and start_day >= vv.day then
|
|
show = true
|
|
self.three_fight_red_info[sub_type][vv.day] = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return show,act_type
|
|
end
|
|
---------------------------------------三日作战 end---------------------------------------
|
|
|
|
---------------------------------------眼疾手快 start---------------------------------------
|
|
--更新眼疾手快基本信息
|
|
function OperateActivityModel:SetAmasingJipSawBaseInfo(vo)
|
|
self.amasing_jipsaw_info = self.amasing_jipsaw_info or {}
|
|
self.amasing_jipsaw_info.base_info = {}
|
|
self.amasing_jipsaw_info.base_info.sub_type = vo.sub_type
|
|
self.amasing_jipsaw_info.base_info.stage = vo.stage
|
|
self.amasing_jipsaw_info.base_info.puzzle_times = vo.puzzle_times
|
|
self:Fire(OperateActivityModel.AMASING_JIPSAW_UPDATE_BASEINFO)
|
|
end
|
|
|
|
--更新眼疾手快游戏拼图数据
|
|
function OperateActivityModel:SetAmasingJipSawGameInfo(vo)
|
|
self.amasing_jipsaw_info = self.amasing_jipsaw_info or {}
|
|
self.amasing_jipsaw_info.pic_info = {}
|
|
self.amasing_jipsaw_info.pic_info.sub_type = vo.sub_type
|
|
self.amasing_jipsaw_info.pic_info.option_type = vo.option_type
|
|
self.amasing_jipsaw_info.pic_info.picture_id = vo.picture_id
|
|
self.amasing_jipsaw_info.pic_info.start_time = vo.start_time
|
|
self.amasing_jipsaw_info.pic_info.end_time = vo.end_time
|
|
self.amasing_jipsaw_info.pic_info.row = 0
|
|
self.amasing_jipsaw_info.pic_info.col = 0
|
|
local card_list = vo.card_list
|
|
if #card_list > 0 then
|
|
table.sort( card_list, function (a, b)
|
|
if a.x ~= b.x then
|
|
return a.x < b.x
|
|
else
|
|
return a.y < b.y
|
|
end
|
|
end )
|
|
|
|
self.amasing_jipsaw_info.pic_info.row = card_list[#card_list].x
|
|
self.amasing_jipsaw_info.pic_info.col = card_list[#card_list].y
|
|
|
|
local t = {}
|
|
for i,v in ipairs(card_list) do
|
|
table.insert(t, v.num)
|
|
end
|
|
card_list = t
|
|
end
|
|
|
|
self.amasing_jipsaw_info.pic_info.card_list = card_list
|
|
self:Fire(OperateActivityModel.AMASING_JIPSAW_UPDATE_GAMEINFO, vo.option_type)
|
|
|
|
--如果是开始游戏,同步一下进度
|
|
if vo.option_type == 2 then
|
|
self:Fire(OperateActivityModel.REQUEST_INFO, 33271, vo.sub_type)
|
|
end
|
|
end
|
|
|
|
--拼图交换
|
|
function OperateActivityModel:SetAmasingJipSawGameExchange(old_idx, new_idx)
|
|
if self.amasing_jipsaw_info.pic_info and self.amasing_jipsaw_info.pic_info.card_list then
|
|
if self.amasing_jipsaw_info.pic_info.card_list[old_idx] and self.amasing_jipsaw_info.pic_info.card_list[new_idx] then
|
|
self.amasing_jipsaw_info.pic_info.card_list[old_idx], self.amasing_jipsaw_info.pic_info.card_list[new_idx] = self.amasing_jipsaw_info.pic_info.card_list[new_idx], self.amasing_jipsaw_info.pic_info.card_list[old_idx]
|
|
end
|
|
end
|
|
end
|
|
|
|
--眼疾手快奖励
|
|
function OperateActivityModel:SetAmasingJipSawReward(vo)
|
|
self.amasing_jipsaw_info = self.amasing_jipsaw_info or {}
|
|
self.amasing_jipsaw_info.base_info = {}
|
|
self.amasing_jipsaw_info.base_info.sub_type = vo.sub_type
|
|
self.amasing_jipsaw_info.base_info.stage = vo.stage
|
|
self.amasing_jipsaw_info.base_info.puzzle_times = vo.puzzle_times
|
|
self.amasing_jipsaw_info.reward_list = vo.reward_list
|
|
end
|
|
|
|
--更新眼疾手快奖励预览信息
|
|
function OperateActivityModel:SetAmasingJipSawShowReward(vo)
|
|
self.amasing_jipsaw_info = self.amasing_jipsaw_info or {}
|
|
self.amasing_jipsaw_info.show_info = {}
|
|
self.amasing_jipsaw_info.show_info.sub_type = vo.sub_type
|
|
local reward_list = {}
|
|
if #vo.reward_list > 0 then
|
|
for i=1,6 do
|
|
local idx = #vo.reward_list - i + 1
|
|
if vo.reward_list[idx] then
|
|
table.insert(reward_list, vo.reward_list[idx])
|
|
end
|
|
end
|
|
end
|
|
|
|
self.amasing_jipsaw_info.show_info.reward_list = reward_list
|
|
self:Fire(OperateActivityModel.AMASING_JIPSAW_UPDATE_BASEINFO)
|
|
end
|
|
|
|
--眼疾手快获取基本数据
|
|
function OperateActivityModel:GetAmasingJipSawBaseInfo()
|
|
return (self.amasing_jipsaw_info and self.amasing_jipsaw_info.base_info) and self.amasing_jipsaw_info.base_info or nil
|
|
end
|
|
|
|
--眼疾手快获取奖励预览数据
|
|
function OperateActivityModel:GetAmasingJipSawShowReward()
|
|
return (self.amasing_jipsaw_info and self.amasing_jipsaw_info.show_info and self.amasing_jipsaw_info.show_info.reward_list) and self.amasing_jipsaw_info.show_info.reward_list or nil
|
|
end
|
|
|
|
--眼疾手快获取拼图数据
|
|
function OperateActivityModel:GetAmasingJipSawGameInfo()
|
|
return (self.amasing_jipsaw_info and self.amasing_jipsaw_info.pic_info) and self.amasing_jipsaw_info.pic_info or nil
|
|
end
|
|
|
|
--眼疾手快游戏开始
|
|
function OperateActivityModel:AmasingJipSawGameStart(vo)
|
|
self:Fire(OperateActivityModel.AMASING_JIPSAW_UPDATE_GAME_START, vo.sub_type, vo.stage)
|
|
end
|
|
---------------------------------------眼疾手快 end---------------------------------------
|
|
|
|
---------------------------------------人参果树 start---------------------------------------
|
|
--人参果树基本信息
|
|
function OperateActivityModel:SetPrayTreeBaseInfo(vo)
|
|
self.pray_tree_info = self.pray_tree_info or {}
|
|
self.pray_tree_info.sub_type = vo.sub_type
|
|
self.pray_tree_info.next_hit = vo.next_hit
|
|
self.pray_tree_info.score = vo.score
|
|
self.pray_tree_info.free_count = vo.free_count
|
|
self:Fire(OperateActivityModel.PRAY_TREE_BASE_INFO)
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.PrayTree, nil, vo.sub_type)
|
|
end
|
|
|
|
--人参果树抽卡
|
|
function OperateActivityModel:SetPrayTreeDrawnfo(vo)
|
|
self:Fire(OperateActivityModel.PRAY_TREE_DRAW, vo)
|
|
end
|
|
|
|
--人参果树领奖
|
|
function OperateActivityModel:SetPrayTreeRewardInfo(vo)
|
|
self:Fire(OperateActivityModel.PRAY_TREE_GET_REWARD)
|
|
end
|
|
|
|
--人参果树领奖
|
|
function OperateActivityModel:GetPrayTreeBaseInfo()
|
|
return self.pray_tree_info
|
|
end
|
|
|
|
--人参果树最大祝福值
|
|
function OperateActivityModel:GetPrayTreeMaxValue()
|
|
local cfg = Config.Customactkv
|
|
return (cfg and cfg["120@blessing_value_max"]) and cfg["120@blessing_value_max"].value_content or 100
|
|
end
|
|
|
|
--人参果树祝福奖励
|
|
function OperateActivityModel:GetPrayTreeLessReward()
|
|
local cfg = Config.Customactkv
|
|
return (cfg and cfg["120@blessing_reward"]) and stringtotable(cfg["120@blessing_reward"].value_content)[1] or false
|
|
end
|
|
|
|
--人参果树最大祝福值
|
|
function OperateActivityModel:GetPrayTreeDrawCost(draw_type)
|
|
local cfg = Config.Customactkv
|
|
--单抽
|
|
if draw_type == 1 then
|
|
if (cfg and cfg["120@cost_one"]) then
|
|
local info = stringtotable(cfg["120@cost_one"].value_content)
|
|
local cost_item_id = info[1][2]
|
|
local cost_info =
|
|
{
|
|
kind = info[1][1],
|
|
goods_id = info[1][2],
|
|
cost_num = info[1][3],
|
|
}
|
|
local price_cfg = Config.Goodsprice
|
|
if price_cfg and price_cfg[cost_item_id] then
|
|
local d = price_cfg[cost_item_id]
|
|
cost_info.price = d.price
|
|
cost_info.price_type = d.price_type
|
|
end
|
|
return cost_info
|
|
end
|
|
else
|
|
--连抽
|
|
if (cfg and cfg["120@cost_ten"]) then
|
|
local info = stringtotable(cfg["120@cost_ten"].value_content)
|
|
local cost_item_id = info[1][2]
|
|
local cost_info =
|
|
{
|
|
kind = info[1][1],
|
|
goods_id = info[1][2],
|
|
cost_num = info[1][3],
|
|
}
|
|
local price_cfg = Config.Goodsprice
|
|
if price_cfg and price_cfg[cost_item_id] then
|
|
local d = price_cfg[cost_item_id]
|
|
cost_info.price = d.price
|
|
cost_info.price_type = d.price_type
|
|
end
|
|
return cost_info
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
--人参果树抽取id
|
|
function OperateActivityModel:GetPrayTreeDrawId()
|
|
local cost_info = self:GetPrayTreeDrawCost(1)
|
|
return cost_info and cost_info.goods_id or 0
|
|
end
|
|
|
|
--人参果树最大祝福值
|
|
function OperateActivityModel:GetPrayTreeRewardList(base_type, sub_type, show_type)
|
|
if not base_type or not sub_type or not show_type then
|
|
return {}
|
|
end
|
|
local key = base_type .. "@" .. sub_type .. "@" .. show_type
|
|
if not self.pray_tree_reward_list[key] then
|
|
local rewards = CustomActivityModel.getInstance():getOneActRewardList(base_type, sub_type)
|
|
local t = self.pray_tree_reward_list
|
|
if rewards and rewards.reward_list then
|
|
local l_key
|
|
for i,v in ipairs(rewards.reward_list) do
|
|
l_key = base_type .. "@" .. sub_type .. "@" .. v.condition_list[1][2]
|
|
t[l_key] = t[l_key] or {}
|
|
local item = {[1] = v.reward_info[1].goods_kind,[2] = v.reward_info[1].goods_id, [3] = v.reward_info[1].goods_count}
|
|
table.insert(t[l_key], item)
|
|
end
|
|
end
|
|
end
|
|
return self.pray_tree_reward_list[key] or {}
|
|
end
|
|
|
|
function OperateActivityModel:PrayTreeCheckDo(can_do, price, str, ok_func)
|
|
function ok_function( )
|
|
if ok_func then
|
|
ok_func()
|
|
end
|
|
end
|
|
function toggle_function( flag )
|
|
self.pray_tree_info.custom_draw_toggle = flag
|
|
end
|
|
|
|
local show_tips_flag = self.pray_tree_info.custom_draw_toggle or false
|
|
if not can_do and not show_tips_flag then
|
|
price = price or 0
|
|
local asset, source = WordManager:GetCommonMoneyIcon(1)
|
|
local data = {
|
|
gold_ab_res = asset,
|
|
gold_res = source,
|
|
price = price,
|
|
insufficientText = "",
|
|
priceText = str,
|
|
titleText = "提示",
|
|
ok_callback = ok_function,
|
|
toggle_function = toggle_function,
|
|
}
|
|
GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, data)
|
|
else
|
|
ok_func()
|
|
end
|
|
end
|
|
|
|
--人参果树红点
|
|
function OperateActivityModel:PrayTreeGetRedDot()
|
|
local b = false
|
|
if self.pray_tree_info and self.pray_tree_info.free_count then
|
|
local max_value = self:GetPrayTreeMaxValue()
|
|
b = self.pray_tree_info.free_count > 0 or self.pray_tree_info.score >= max_value
|
|
end
|
|
return b
|
|
end
|
|
---------------------------------------人参果树 end---------------------------------------
|
|
|
|
---------------------------------------合成机 start---------------------------------------
|
|
--保存收藏列表 33294
|
|
function OperateActivityModel:SetComposeRobotCollectList(vo)
|
|
self.compose_robot_collect_list[vo.sub_type] = vo.print_list
|
|
local function onSortFunction(v1, v2)
|
|
return v1.id < v2.id
|
|
end
|
|
table.sort(self.compose_robot_collect_list[vo.sub_type], onSortFunction)
|
|
end
|
|
|
|
--获取收藏列表
|
|
function OperateActivityModel:GetComposeRobotCollectList(sub_type)
|
|
if not self.compose_robot_collect_list[sub_type] then return {} end
|
|
return self.compose_robot_collect_list[sub_type]
|
|
end
|
|
|
|
--判断收藏列表中有没有该id的配方
|
|
function OperateActivityModel:IsInComposeRobotCollectList(sub_type, id)
|
|
if not self.compose_robot_collect_list[sub_type] then return false end
|
|
for k,v in pairs(self.compose_robot_collect_list[sub_type]) do
|
|
if v.id == id then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--更新收藏列表 33293
|
|
function OperateActivityModel:UpdateComposeRobotCollectList(vo)
|
|
local is_in_collect_list = self:IsInComposeRobotCollectList(vo.sub_type, vo.id)
|
|
if vo.type == 0 then--取消收藏
|
|
if is_in_collect_list then
|
|
local temp = nil
|
|
for k,v in pairs(self.compose_robot_collect_list[vo.sub_type]) do
|
|
if v.id == vo.id then
|
|
temp = v
|
|
break
|
|
end
|
|
end
|
|
if temp then
|
|
TableRemove(self.compose_robot_collect_list[vo.sub_type],temp)
|
|
end
|
|
end
|
|
elseif vo.type == 1 then--收藏
|
|
if not is_in_collect_list then
|
|
self.compose_robot_collect_list[vo.sub_type] = self.compose_robot_collect_list[vo.sub_type] or {}
|
|
local temp = {
|
|
id = vo.id,
|
|
}
|
|
table.insert(self.compose_robot_collect_list[vo.sub_type], temp)
|
|
local function onSortFunction(v1, v2)
|
|
return v1.id < v2.id
|
|
end
|
|
table.sort(self.compose_robot_collect_list[vo.sub_type], onSortFunction)
|
|
end
|
|
end
|
|
end
|
|
|
|
--保存配方状态信息 33296
|
|
function OperateActivityModel:SetComposeRobotFormulaData(vo)
|
|
self.compose_robot_formula_data[vo.sub_type] = {}
|
|
for i,v in ipairs(vo.print_list) do
|
|
self.compose_robot_formula_data[vo.sub_type][v.id] = v
|
|
end
|
|
end
|
|
|
|
--增量更新配方状态信息列表 33296
|
|
function OperateActivityModel:UpdateComposeRobotFormulaData(vo)
|
|
self.compose_robot_formula_data[vo.sub_type] = self.compose_robot_formula_data[vo.sub_type] or {}
|
|
for i,v in ipairs(vo.print_list) do
|
|
for kk,vv in pairs(self.compose_robot_formula_data[vo.sub_type]) do
|
|
if vv.id == v.id then
|
|
vv.state = v.state
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
--获取配方状态信息列表
|
|
function OperateActivityModel:GetComposeRobotFormulaData(sub_type)
|
|
if not self.compose_robot_formula_data[sub_type] then return {} end
|
|
return self.compose_robot_formula_data[sub_type]
|
|
end
|
|
|
|
--获取某id配方的状态信息
|
|
function OperateActivityModel:GetComposeRobotFormulaStateById(sub_type, id)
|
|
if not self.compose_robot_formula_data[sub_type] or not self.compose_robot_formula_data[sub_type][id] then
|
|
return 0
|
|
end
|
|
return self.compose_robot_formula_data[sub_type][id].state
|
|
end
|
|
|
|
--保存发明家消息列表 33297
|
|
function OperateActivityModel:SetComposeRobotAnnounceData(vo)
|
|
self.compose_robot_announce_data[vo.sub_type] = vo.rold_list
|
|
local function onSortFunction(v1, v2)
|
|
return v1.id < v2.id
|
|
end
|
|
table.sort(self.compose_robot_announce_data[vo.sub_type], onSortFunction)
|
|
end
|
|
|
|
--更新发明家消息列表 33298
|
|
function OperateActivityModel:UpdateComposeRobotAnnounceData(vo)
|
|
self.compose_robot_announce_data[vo.sub_type] = self.compose_robot_announce_data[vo.sub_type] or {}
|
|
local temp_data = {
|
|
role_name = vo.role_name,
|
|
id = vo.id,
|
|
}
|
|
table.insert(self.compose_robot_announce_data[vo.sub_type],temp_data)
|
|
local function onSortFunction(v1, v2)
|
|
return v1.id < v2.id
|
|
end
|
|
table.sort(self.compose_robot_announce_data[vo.sub_type], onSortFunction)
|
|
end
|
|
|
|
--拿到发明家消息列表
|
|
function OperateActivityModel:GetComposeRobotAnnounceData(sub_type)
|
|
if not self.compose_robot_announce_data[sub_type] then return {} end
|
|
return self.compose_robot_announce_data[sub_type]
|
|
end
|
|
|
|
--拿到当前子类型合成机活动的原料套数item_suit
|
|
function OperateActivityModel:GetComposeRobotItemSuit(sub_type)
|
|
local act_data = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT,sub_type)
|
|
local item_suit_id = 0
|
|
if act_data and act_data.condition_list then
|
|
for k,v in pairs(act_data.condition_list) do
|
|
if v[1] == "item_suit" then
|
|
item_suit_id = tonumber(v[2])
|
|
end
|
|
end
|
|
end
|
|
return item_suit_id
|
|
end
|
|
|
|
--初始化合成机原材料配置
|
|
function OperateActivityModel:InitComposeRobotMaterialCfg( )
|
|
for k,v in pairs(Config.Printerdraw) do
|
|
self.compose_robot_material_cfg[v.item_suit] = self.compose_robot_material_cfg[v.item_suit] or {}
|
|
table.insert(self.compose_robot_material_cfg[v.item_suit], v)
|
|
end
|
|
for k,v in pairs(self.compose_robot_material_cfg) do
|
|
for kk,vv in pairs(v) do
|
|
local function onSortFunction(v1, v2)
|
|
return v1.exchange_item < v2.exchange_item
|
|
end
|
|
table.sort(v, onSortFunction)
|
|
end
|
|
end
|
|
end
|
|
|
|
--获取当前子类型合成机活动的原材料配置
|
|
function OperateActivityModel:GetComposeRobotMaterialCfg(sub_type)
|
|
local item_suit = self:GetComposeRobotItemSuit(sub_type)
|
|
if not self.compose_robot_material_cfg[item_suit] then return {} end
|
|
return self.compose_robot_material_cfg[item_suit]
|
|
end
|
|
|
|
--初始化合成机配方配置
|
|
function OperateActivityModel:InitComposeRobotFormulaCfg( )
|
|
for k,v in pairs(Config.Printerdrawlist) do
|
|
self.compose_robot_formula_cfg[v.item_suit] = self.compose_robot_formula_cfg[v.item_suit] or {}
|
|
-- self.compose_robot_formula_cfg[v.item_suit][v.id] = v
|
|
table.insert(self.compose_robot_formula_cfg[v.item_suit],v)
|
|
end
|
|
end
|
|
|
|
--根据配方id获取配置
|
|
function OperateActivityModel:GetComposeRobotFormulaCfgById(sub_type,id)
|
|
local item_suit = self:GetComposeRobotItemSuit(sub_type)
|
|
if not self.compose_robot_formula_cfg[item_suit] then return nil end
|
|
for k,v in pairs(self.compose_robot_formula_cfg[item_suit]) do
|
|
if v.id == id then
|
|
return v
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
|
|
--获取当前的配方配置列表
|
|
function OperateActivityModel:GetComposeRobotFormulaListCfg(sub_type)
|
|
local item_suit = self:GetComposeRobotItemSuit(sub_type)
|
|
if not self.compose_robot_formula_cfg[item_suit] then return {} end
|
|
return self.compose_robot_formula_cfg[item_suit]
|
|
end
|
|
|
|
--传入原材料id列表,判断是否合法配方并返回配置
|
|
function OperateActivityModel:JudgeCanMaterialCompose(sub_type, material_id_list)
|
|
if #material_id_list ~= 3 then return nil end
|
|
local id_list = DeepCopy(material_id_list)
|
|
local item_suit = self:GetComposeRobotItemSuit(sub_type)
|
|
if not self.compose_robot_formula_cfg[item_suit] then return nil end
|
|
--先把id_list排序一下
|
|
local function onSortFunction(v1, v2)
|
|
return v1 < v2
|
|
end
|
|
table.sort(id_list, onSortFunction)
|
|
for k,v in pairs(self.compose_robot_formula_cfg[item_suit]) do
|
|
local need_material_list = DeepCopy(stringtotable(v.exchange))
|
|
local function onSortFunction(v1, v2)
|
|
return v1 < v2
|
|
end
|
|
table.sort(need_material_list, onSortFunction)
|
|
if need_material_list[1] == id_list[1] and need_material_list[2] == id_list[2] and need_material_list[3] == id_list[3] then
|
|
return v
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
|
|
--拿到配方所需的材料列表
|
|
function OperateActivityModel:GetComposeRobotMaterialList(sub_type, formula_id)
|
|
local formula_cfg = self:GetComposeRobotFormulaCfgById(sub_type, formula_id)
|
|
if not formula_cfg then return {} end
|
|
return stringtotable(formula_cfg.exchange)
|
|
end
|
|
|
|
--初始化奖池配置
|
|
function OperateActivityModel:InitComposeRobotPoolCfg( )
|
|
for k,v in pairs(Config.Printerdrawpool) do
|
|
self.compose_robot_pool_cfg[v.pool] = self.compose_robot_pool_cfg[v.pool] or {}
|
|
table.insert(self.compose_robot_pool_cfg[v.pool], stringtotable(v.goods)[1])
|
|
|
|
self.compose_robot_normal_pool_cfg[v.pool_type] = self.compose_robot_normal_pool_cfg[v.pool_type] or {}
|
|
if v.is_show == 1 then
|
|
table.insert(self.compose_robot_normal_pool_cfg[v.pool_type], stringtotable(v.goods)[1])
|
|
end
|
|
end
|
|
end
|
|
|
|
--获取普通奖励
|
|
function OperateActivityModel:GetComposeRobotNormalReward(sub_type)
|
|
local item_suit = self:GetComposeRobotItemSuit(sub_type)
|
|
if not self.compose_robot_normal_pool_cfg[item_suit] then return {} end
|
|
return self.compose_robot_normal_pool_cfg[item_suit]
|
|
end
|
|
|
|
--根据奖池id获取奖池列表
|
|
function OperateActivityModel:GetComposeRobotRewardList(pool_id)
|
|
if not self.compose_robot_pool_cfg[pool_id] then return {} end
|
|
return self.compose_robot_pool_cfg[pool_id]
|
|
end
|
|
|
|
--材料数量更新
|
|
function OperateActivityModel:OnMaterialGoodsNumUpdate( )
|
|
self:Fire(OperateActivityModel.UPDATE_COMPOSE_ROBOT_MATERIAL_GOODS_NUM)
|
|
local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.COMPOSE_ROBOT)
|
|
for k,v in pairs(sub_type_list) do
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.ComposeRobot,nil,v.sub_type)
|
|
end
|
|
end
|
|
|
|
--获取当前的选中材料列表
|
|
function OperateActivityModel:GetNowUseComposeMaterial(sub_type)
|
|
if not self.compose_robot_now_use_material_list[sub_type] then
|
|
self.compose_robot_now_use_material_list[sub_type] = {
|
|
[1] = 0,
|
|
[2] = 0,
|
|
[3] = 0,
|
|
}
|
|
end
|
|
return self.compose_robot_now_use_material_list[sub_type]
|
|
end
|
|
|
|
--加入材料到选中列表
|
|
function OperateActivityModel:AddComposeMaterial(sub_type, goods_id)
|
|
if not self.compose_robot_now_use_material_list[sub_type] then
|
|
self.compose_robot_now_use_material_list[sub_type] = {
|
|
[1] = 0,
|
|
[2] = 0,
|
|
[3] = 0,
|
|
}
|
|
end
|
|
local add_index = 0
|
|
for i,v in ipairs(self.compose_robot_now_use_material_list[sub_type]) do
|
|
if v == 0 then
|
|
self.compose_robot_now_use_material_list[sub_type][i] = goods_id
|
|
add_index = i
|
|
break
|
|
end
|
|
end
|
|
return add_index
|
|
end
|
|
|
|
--取消选中材料
|
|
function OperateActivityModel:MinusComposeMaterial(sub_type, pos_index)
|
|
if self.compose_robot_now_use_material_list[sub_type] then
|
|
self.compose_robot_now_use_material_list[sub_type][pos_index] = 0
|
|
end
|
|
end
|
|
|
|
--重置选中列表
|
|
function OperateActivityModel:ResetUseComposeMaterialList(sub_type)
|
|
self.compose_robot_now_use_material_list[sub_type] = {
|
|
[1] = 0,
|
|
[2] = 0,
|
|
[3] = 0,
|
|
}
|
|
end
|
|
|
|
--保存活动开启的红点
|
|
function OperateActivityModel:SetComposeRobotActFirstRed(sub_type)
|
|
self.compose_robot_act_first_red[sub_type] = true
|
|
end
|
|
|
|
--记录是否打开过界面的标识
|
|
function OperateActivityModel:SetComposeRobotViewOpenState(sub_type)
|
|
self.compose_robot_have_open_view[sub_type] = true
|
|
end
|
|
|
|
function OperateActivityModel:CheckComposeRobotActFirstRedDot(sub_type)
|
|
if not self.compose_robot_have_open_view[sub_type] and self.compose_robot_act_first_red[sub_type] and not self.is_in_compose_view[sub_type]then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function OperateActivityModel:CheckComposeRobotCanComposeRed(sub_type)
|
|
self.compose_robot_red_info[sub_type] = false
|
|
if self.is_in_compose_view[sub_type] then
|
|
return false
|
|
end
|
|
local formula_list = DeepCopy(self:GetComposeRobotFormulaListCfg(sub_type))
|
|
for i,v in ipairs(formula_list) do
|
|
v.formula_state =self:GetComposeRobotFormulaStateById(sub_type,v.id)
|
|
local material_list = self:GetComposeRobotMaterialList(sub_type,v.id)
|
|
local main_need_material_list = {}
|
|
for ii,vv in ipairs(material_list) do
|
|
local goods_num = GoodsModel:getInstance():GetTypeGoodsNum(vv)
|
|
if not main_need_material_list[vv] then
|
|
main_need_material_list[vv] = {
|
|
id = vv,
|
|
need_num = 1,
|
|
bag_goods_num = goods_num
|
|
}
|
|
else
|
|
main_need_material_list[vv].need_num = main_need_material_list[vv].need_num + 1
|
|
end
|
|
end
|
|
local max_can_get_num = 99999999
|
|
for m,n in pairs(main_need_material_list) do
|
|
local multi = math.floor(n.bag_goods_num/n.need_num)
|
|
if multi < max_can_get_num then
|
|
max_can_get_num = multi
|
|
end
|
|
end
|
|
if max_can_get_num > 0 then
|
|
self.compose_robot_red_info[sub_type] = true
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--得到合成级红点
|
|
function OperateActivityModel:GetComposeRobotMainRed(sub_type)
|
|
local can_compose_red = self:CheckComposeRobotCanComposeRed(sub_type)
|
|
local first_red = self:CheckComposeRobotActFirstRedDot(sub_type)
|
|
if first_red or can_compose_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
--询问cd状态
|
|
function OperateActivityModel:SetComposeRobotAskCd(vo)
|
|
self.compose_robot_ask_time[vo.sub_type] = vo.time
|
|
end
|
|
|
|
function OperateActivityModel:GetComposeRobotAskCd(sub_type)
|
|
if not self.compose_robot_ask_time[sub_type] then return 0 end
|
|
return self.compose_robot_ask_time[sub_type]
|
|
end
|
|
---------------------------------------合成机 end---------------------------------------
|
|
|
|
|
|
|
|
---------------------------------------自选扭蛋 start---------------------------------------
|
|
--33600 保存自选扭蛋相关数据
|
|
function OperateActivityModel:SetSelectEggServerData(vo)
|
|
self.select_egg_ser_data[vo.sub_type] = {}
|
|
self.select_egg_ser_data[vo.sub_type].sub_type = vo.sub_type
|
|
self.select_egg_ser_data[vo.sub_type].reward_list = {}
|
|
for k,v in pairs(vo.reward_list) do--已抽中的奖励列表
|
|
local rewards_data = stringtotable(v.rewards)
|
|
self.select_egg_ser_data[vo.sub_type].reward_list[v.rare] = rewards_data
|
|
end
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list = {}
|
|
for k,v in pairs(vo.select_reward_list) do--已选择的奖励列表
|
|
local rewards_data = stringtotable(v.rewards)
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list[v.rare] = rewards_data
|
|
end
|
|
self.select_egg_ser_data[vo.sub_type].cfg_reward_list = {}
|
|
for k,v in pairs(vo.cfg_reward_list) do--本期活动的奖池
|
|
local rewards_data = stringtotable(v.cfg_rewards)
|
|
self.select_egg_ser_data[vo.sub_type].cfg_reward_list[v.cfg_rare] = rewards_data
|
|
end
|
|
self.select_egg_ser_data[vo.sub_type].cost_goods_type_id = vo.cost_goods_type_id--下一抽消耗物品类型Id
|
|
self.select_egg_ser_data[vo.sub_type].cost_num = vo.cost_num--下一抽消耗物品数量
|
|
self.select_egg_ser_data[vo.sub_type].left_reset_times = vo.left_reset_times--剩余重置次数
|
|
self.select_egg_ser_data[vo.sub_type].is_ensure = vo.is_ensure--是否确认奖励
|
|
end
|
|
|
|
--33601 选择奖励后更新选中的奖励列表
|
|
function OperateActivityModel:UpdateSelectEggSelectRewardList(vo)
|
|
if not self.select_egg_ser_data[vo.sub_type] then return end
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list = {}
|
|
for k,v in pairs(vo.select_reward_list) do
|
|
local rewards_data = stringtotable(v.rewards)
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list[v.rare] = rewards_data
|
|
end
|
|
end
|
|
|
|
--33603 抽奖后更新相关数据
|
|
function OperateActivityModel:UpdateSelectEggDataAfterDraw(vo)
|
|
if not self.select_egg_ser_data[vo.sub_type] then return end
|
|
self.select_egg_ser_data[vo.sub_type].reward_list = self.select_egg_ser_data[vo.sub_type].reward_list or {}
|
|
self.select_egg_ser_data[vo.sub_type].reward_list[vo.rare] = self.select_egg_ser_data[vo.sub_type].reward_list[vo.rare] or {}
|
|
local rewards_data = stringtotable(vo.rewards)
|
|
table.insert(self.select_egg_ser_data[vo.sub_type].reward_list[vo.rare],rewards_data[1])
|
|
|
|
self.select_egg_ser_data[vo.sub_type].cost_goods_type_id = vo.cost_goods_type_id--下一抽消耗物品类型Id
|
|
self.select_egg_ser_data[vo.sub_type].cost_num = vo.cost_num--下一抽消耗物品数量
|
|
self.select_egg_ser_data[vo.sub_type].is_ensure = vo.is_ensure--是否确认奖励
|
|
end
|
|
|
|
--33604 快速选奖更新相关数据
|
|
function OperateActivityModel:UpdateSelectEggDataAfterQuiclSelect(vo)
|
|
if not self.select_egg_ser_data[vo.sub_type] then return end
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list = {}
|
|
for k,v in pairs(vo.select_reward_list) do--已选择的奖励列表
|
|
local rewards_data = stringtotable(v.rewards)
|
|
self.select_egg_ser_data[vo.sub_type].select_reward_list[v.rare] = rewards_data
|
|
end
|
|
end
|
|
|
|
--33605 刷新确认状态
|
|
function OperateActivityModel:UpdateSelectEggEnsureState(vo)
|
|
if not self.select_egg_ser_data[vo.sub_type] then return end
|
|
self.select_egg_ser_data[vo.sub_type].is_ensure = vo.is_ensure--是否确认奖励
|
|
end
|
|
|
|
--是否已经确认奖池
|
|
function OperateActivityModel:IsSelectEggPoolEnsure(sub_type)
|
|
if not self.select_egg_ser_data[sub_type] then return false end
|
|
return self.select_egg_ser_data[sub_type].is_ensure or false
|
|
end
|
|
|
|
--获取选中的奖励列表
|
|
function OperateActivityModel:GetSelectEggSelectRewardListByRare(sub_type,rare)
|
|
if not self.select_egg_ser_data[sub_type] then return {} end
|
|
if not self.select_egg_ser_data[sub_type].select_reward_list then return {} end
|
|
return self.select_egg_ser_data[sub_type].select_reward_list[rare] or {}
|
|
end
|
|
|
|
--判断物品是否已经在选中列表中
|
|
function OperateActivityModel:IsInSelectEggSelectRewardList(sub_type,reward_id)
|
|
if not self.select_egg_ser_data[sub_type] then return false end
|
|
if not self.select_egg_ser_data[sub_type].select_reward_list then return false end
|
|
|
|
for k,v in pairs(self.select_egg_ser_data[sub_type].select_reward_list) do
|
|
for m,n in pairs(v) do
|
|
if n[1] == reward_id then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--判断物品是否在已抽中列表中
|
|
function OperateActivityModel:IsInSelectEggGetRewardList(sub_type,reward_id)
|
|
if not self.select_egg_ser_data[sub_type] then return false end
|
|
if not self.select_egg_ser_data[sub_type].reward_list then return false end
|
|
|
|
local bool = false
|
|
for k,v in pairs(self.select_egg_ser_data[sub_type].reward_list) do
|
|
for m,n in pairs(v) do
|
|
if n[1] == reward_id then
|
|
bool = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
return bool
|
|
end
|
|
|
|
--快速选择奖励,返回奖励id列表
|
|
function OperateActivityModel:GetQuickSelectRewardList(sub_type,rare)
|
|
if not self.select_egg_ser_data[sub_type] then return {} end
|
|
if not self.select_egg_ser_data[sub_type].cfg_reward_list then return {} end
|
|
if not self.select_egg_ser_data[sub_type].cfg_reward_list[rare] then return {} end
|
|
|
|
local not_select_list = {}
|
|
for k,v in pairs(self.select_egg_ser_data[sub_type].cfg_reward_list[rare]) do
|
|
if not self:IsInSelectEggSelectRewardList(sub_type,v[1]) then
|
|
table.insert(not_select_list,v[1])
|
|
end
|
|
end
|
|
|
|
local select_reward_list = self:GetSelectEggSelectRewardListByRare(sub_type,rare)
|
|
local left_can_select_num = 0
|
|
if rare == 1 then
|
|
left_can_select_num = 1-#select_reward_list
|
|
elseif rare == 2 then
|
|
left_can_select_num = 3-#select_reward_list
|
|
elseif rare == 3 then
|
|
left_can_select_num = 4-#select_reward_list
|
|
end
|
|
|
|
if left_can_select_num == 0 then return {} end
|
|
|
|
local final_list = {}
|
|
for i=1,left_can_select_num do
|
|
local random_index = math.random(1, #not_select_list)
|
|
table.insert(final_list,not_select_list[random_index])
|
|
table.remove(not_select_list,random_index)
|
|
end
|
|
|
|
return final_list
|
|
end
|
|
|
|
--获取现在的中奖列表
|
|
function OperateActivityModel:GetSelectEggAllRewardList(sub_type)
|
|
if not self.select_egg_ser_data[sub_type] then return {} end
|
|
if not self.select_egg_ser_data[sub_type].reward_list then return {} end
|
|
local all_list = {}
|
|
for k,v in pairs(self.select_egg_ser_data[sub_type].reward_list) do
|
|
for m,n in pairs(v) do
|
|
table.insert(all_list,n)
|
|
end
|
|
end
|
|
return all_list
|
|
end
|
|
|
|
--根据稀有度获取奖池列表
|
|
function OperateActivityModel:GetSelectEggPoolRewardListByRare(sub_type,rare)
|
|
if not self.select_egg_ser_data[sub_type] then return {} end
|
|
if not self.select_egg_ser_data[sub_type].cfg_reward_list then return {} end
|
|
return self.select_egg_ser_data[sub_type].cfg_reward_list[rare] or {}
|
|
end
|
|
|
|
--根据稀有度获取抽中的奖励列表
|
|
function OperateActivityModel:GetSelectEggGottenRewardListByRare(sub_type,rare)
|
|
if not self.select_egg_ser_data[sub_type] then return {} end
|
|
if not self.select_egg_ser_data[sub_type].reward_list then return {} end
|
|
return self.select_egg_ser_data[sub_type].reward_list[rare] or {}
|
|
end
|
|
|
|
--获取下次抽奖的消耗信息
|
|
function OperateActivityModel:GetSelectEggNextDrawCostData(sub_type)
|
|
if not self.select_egg_ser_data[sub_type] then return nil,nil end
|
|
return self.select_egg_ser_data[sub_type].cost_goods_type_id,self.select_egg_ser_data[sub_type].cost_num
|
|
end
|
|
|
|
--获取剩余重置次数
|
|
function OperateActivityModel:GetSelectEggLeftResetTimes(sub_type)
|
|
if not self.select_egg_ser_data[sub_type] then return 0 end
|
|
return self.select_egg_ser_data[sub_type].left_reset_times
|
|
end
|
|
|
|
--判断当前扭蛋阶段(开始抽奖了就表示不可以抽了)(判断依据是服务端发回来的reward_list长度)
|
|
--1|选奖阶段 #reward_list==0 不可抽奖 不可重置 只能选奖
|
|
--2|抽奖阶段 #reward_list>0 or ensure == 1 不可选奖 可重置 可抽奖
|
|
--3|抽完阶段 #reward_list==8 不可选奖 可重置 不可抽奖
|
|
--4|奖励选完待确认 #reward_list == 0 and #select_reward == 8 and ensure == 0可选奖 不可重置 不可抽奖
|
|
--5|奖励选完可以开抽 #reward_list == 0 and #select_reward == 8 and ensure == 1不可选奖 可重置 可抽奖
|
|
function OperateActivityModel:GetSelectEggNowPlayState(sub_type)
|
|
local all_reward_list = self:GetSelectEggAllRewardList(sub_type)
|
|
local ensure = self:IsSelectEggPoolEnsure(sub_type)
|
|
if #all_reward_list == 0 then
|
|
local select_reward_list_1 = self:GetSelectEggSelectRewardListByRare(sub_type,1)
|
|
local select_reward_list_2 = self:GetSelectEggSelectRewardListByRare(sub_type,2)
|
|
local select_reward_list_3 = self:GetSelectEggSelectRewardListByRare(sub_type,3)
|
|
if #select_reward_list_1 + #select_reward_list_2 + #select_reward_list_3 == 8 and ensure == 0 then
|
|
return 4
|
|
elseif #select_reward_list_1 + #select_reward_list_2 + #select_reward_list_3 == 8 and ensure == 1 then
|
|
return 5
|
|
else
|
|
return 1
|
|
end
|
|
elseif #all_reward_list > 0 and #all_reward_list < 8 then
|
|
return 2
|
|
elseif #all_reward_list == 8 then
|
|
return 3
|
|
end
|
|
return 0
|
|
end
|
|
|
|
|
|
|
|
--得到自选扭蛋红点
|
|
-- 红点规则:
|
|
-- 1、玩家有足够抽奖道具时红点提示【扭一次】
|
|
-- 2、玩家所有道具抽取完,且存在重置次数,红点提示【重置奖励】
|
|
function OperateActivityModel:GetSelectEggMainRed(sub_type)
|
|
local can_draw_red = self:CheckSelectEggCanFDrawRed(sub_type,true)
|
|
local can_reset_red = self:CheckSelectEggCanResetRed(sub_type,true)
|
|
local can_ensure_red = self:CheckSelectEggCanEnsureRed(sub_type,true)
|
|
local com_act_red = self:CheckSelectEggComActRed(sub_type,true)
|
|
if can_draw_red or can_reset_red or can_ensure_red or com_act_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
--自选扭蛋有道具可抽奖红点
|
|
function OperateActivityModel:CheckSelectEggCanFDrawRed(sub_type,check_new)
|
|
if not check_new then
|
|
if self.select_egg_red_info[sub_type] and self.select_egg_red_info[sub_type].can_draw_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
------------------
|
|
self.select_egg_red_info[sub_type] = self.select_egg_red_info[sub_type] or {}
|
|
local bool = false
|
|
local state = self:GetSelectEggNowPlayState(sub_type)
|
|
if state~=2 and state~=5 then
|
|
bool = false
|
|
else
|
|
--判断当前抽奖所需消耗的道具数量是否足够
|
|
local cost_goods_type_id,cost_need_num = self:GetSelectEggNextDrawCostData(sub_type)
|
|
if cost_goods_type_id and cost_need_num then
|
|
local have_cost_num = GoodsModel:getInstance():GetTypeGoodsNum(cost_goods_type_id)
|
|
if have_cost_num >= cost_need_num then
|
|
bool = true
|
|
end
|
|
end
|
|
end
|
|
self.select_egg_red_info[sub_type].can_draw_red = bool
|
|
return bool
|
|
end
|
|
|
|
--自选扭蛋可重置红点
|
|
function OperateActivityModel:CheckSelectEggCanResetRed(sub_type,check_new)
|
|
if not check_new then
|
|
if self.select_egg_red_info[sub_type] and self.select_egg_red_info[sub_type].can_reset_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
------------------
|
|
self.select_egg_red_info[sub_type] = self.select_egg_red_info[sub_type] or {}
|
|
local bool = false
|
|
--这轮抽完且有重置次数才能给红点
|
|
local state = self:GetSelectEggNowPlayState(sub_type)
|
|
local left_reset_times = self:GetSelectEggLeftResetTimes(sub_type)
|
|
if state == 3 and left_reset_times > 0 then
|
|
bool = true
|
|
end
|
|
|
|
self.select_egg_red_info[sub_type].can_reset_red = bool
|
|
return bool
|
|
end
|
|
|
|
--确认红点
|
|
function OperateActivityModel:CheckSelectEggCanEnsureRed(sub_type,check_new)
|
|
if not check_new then
|
|
if self.select_egg_red_info[sub_type] and self.select_egg_red_info[sub_type].can_ensure_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
------------------
|
|
self.select_egg_red_info[sub_type] = self.select_egg_red_info[sub_type] or {}
|
|
local bool = false
|
|
|
|
local state = self:GetSelectEggNowPlayState(sub_type)
|
|
bool = state == 4
|
|
|
|
self.select_egg_red_info[sub_type].can_ensure_red = bool
|
|
return bool
|
|
end
|
|
|
|
--自选扭蛋通用礼包
|
|
function OperateActivityModel:CheckSelectEggComActRed(sub_type,check_new)
|
|
if not check_new then
|
|
if self.select_egg_red_info[sub_type] and self.select_egg_red_info[sub_type].com_act_red then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
------------------
|
|
self.select_egg_red_info[sub_type] = self.select_egg_red_info[sub_type] or {}
|
|
local bool = false
|
|
|
|
local com_act_red_info = CustomActivityModel:getInstance():GetActComAwardInfo(CustomActivityModel.CustomActBaseType.SELECT_EGG,sub_type)
|
|
if com_act_red_info then
|
|
bool = com_act_red_info.status == 1
|
|
end
|
|
|
|
self.select_egg_red_info[sub_type].com_act_red = bool
|
|
return bool
|
|
end
|
|
|
|
--自选扭蛋消耗道具数量更新 通知刷红点
|
|
function OperateActivityModel:OnSelectEggCostGoodsNumChange( )
|
|
local sub_type_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.SELECT_EGG)
|
|
for k,v in pairs(sub_type_list) do
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.SelectEgg,nil,v.sub_type)
|
|
end
|
|
end
|
|
|
|
---------------------------------------自选扭蛋 end---------------------------------------
|
|
|
|
|
|
|
|
|
|
---------------------------------------材料上交 start------------------------------------
|
|
function OperateActivityModel:SetMaterialSubmitInfo( vo )
|
|
self.material_submit_info[vo.sub_type] = {}
|
|
|
|
local buffs_dot_list = {}--buff点位信息
|
|
local buffs_bid_list = {}--buff id信息
|
|
for i,v in ipairs(vo.buffs) do
|
|
buffs_dot_list[v.dot] = v
|
|
buffs_bid_list[v.bid] = v
|
|
end
|
|
|
|
local role_awards_dot_list = {}
|
|
for i,v in ipairs(vo.role_awards) do
|
|
role_awards_dot_list[v.dot] = v
|
|
end
|
|
|
|
local server_awards_dot_list = {}
|
|
for i,v in ipairs(vo.server_awards) do
|
|
server_awards_dot_list[v.dot] = v
|
|
end
|
|
|
|
self.material_submit_info[vo.sub_type].server_pro = vo.server_pro
|
|
self.material_submit_info[vo.sub_type].role_pro = vo.role_pro
|
|
self.material_submit_info[vo.sub_type].buffs_dot_list = buffs_dot_list
|
|
self.material_submit_info[vo.sub_type].buffs_bid_list = buffs_bid_list
|
|
self.material_submit_info[vo.sub_type].role_awards_dot_list = role_awards_dot_list
|
|
self.material_submit_info[vo.sub_type].server_awards_dot_list = server_awards_dot_list
|
|
end
|
|
|
|
function OperateActivityModel:GetMaterialSubmitInfo( subtype )
|
|
return self.material_submit_info[subtype]
|
|
end
|
|
|
|
--检查材料上交红点
|
|
function OperateActivityModel:CheckMaterialSubmitRedDot( base_type,sub_type )
|
|
local server_info = self:GetMaterialSubmitInfo(sub_type)
|
|
if not server_info then return false end
|
|
local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
|
|
if not act_list then return false end
|
|
local group_num = 0
|
|
local suit_sub_id = nil
|
|
local cost_id = 0
|
|
for k,v in pairs(act_list.condition_list) do--[{role_lv,80},{sub,1},{cost,30},{group,5}]
|
|
if v[1] == "suit" then--全服进度套件ID
|
|
suit_sub_id = tonumber(v[2])
|
|
elseif v[1] == "group" then--材料提交份数
|
|
group_num = tonumber(v[2])
|
|
elseif v[1] == "cost_type" then--材料提交份数
|
|
cost_id = tonumber(v[2])
|
|
end
|
|
end
|
|
local num = GoodsModel:getInstance():GetTypeGoodsNum(cost_id) or 0
|
|
if num >= group_num then
|
|
return true
|
|
end
|
|
|
|
--先计算个人奖励的
|
|
local award_data = CustomActivityModel:getInstance():getOneActRewardList(base_type,sub_type)
|
|
if not award_data or not award_data.reward_list then return false end
|
|
local submit = 0
|
|
for k,v in pairs(award_data.reward_list) do
|
|
submit = 0
|
|
for kk,vv in pairs(v.condition_list) do
|
|
if vv[1] == "submit" then--点数需求
|
|
submit = tonumber(vv[2])
|
|
break
|
|
end
|
|
end
|
|
if server_info.role_pro >= submit and not server_info.role_awards_dot_list[v.grade] then
|
|
return true
|
|
end
|
|
end
|
|
|
|
--计算全服奖励的
|
|
local server_award_cfg = self:GetMaterialSubmitServerCfg(suit_sub_id)
|
|
if server_award_cfg then
|
|
for k,v in ipairs(server_award_cfg) do
|
|
if v.type == 3 and server_info.server_pro >= v.need and not server_info.server_awards_dot_list[v.dot] then
|
|
return true
|
|
elseif server_info.server_awards_dot_list and v.type == 2 then
|
|
if server_info.server_pro >= v.need and not server_info.server_awards_dot_list[v.dot] then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--初始化材料上交全服配置
|
|
function OperateActivityModel:InitMaterialSubmitServerCfg( )
|
|
if not self.material_submit_server_cfg then
|
|
self.material_submit_server_cfg = {}
|
|
local cfg = DeepCopy(Config.Unitebuffawards)
|
|
for k,v in pairs(cfg) do
|
|
if v.type == 2 or v.type == 3 then
|
|
v.awards = stringtotable(v.awards)
|
|
end
|
|
if not self.material_submit_server_cfg[v.suit] then
|
|
self.material_submit_server_cfg[v.suit] = {}
|
|
end
|
|
self.material_submit_server_cfg[v.suit][#self.material_submit_server_cfg[v.suit] + 1] = v
|
|
end
|
|
end
|
|
end
|
|
|
|
--获取材料上交全服配置
|
|
function OperateActivityModel:GetMaterialSubmitServerCfg( suit,dot )
|
|
if not self.material_submit_server_cfg then
|
|
self:InitMaterialSubmitServerCfg()
|
|
end
|
|
if not dot then
|
|
return self.material_submit_server_cfg[suit]
|
|
elseif self.material_submit_server_cfg[suit] and dot then
|
|
for i,v in ipairs(self.material_submit_server_cfg[suit]) do
|
|
if v.dot == dot then
|
|
return v
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function OperateActivityModel:GetMaterialSubmitCostId( sub_type )
|
|
local cost_id = nil
|
|
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, sub_type)
|
|
if not act_list then
|
|
return
|
|
end
|
|
for k,v in pairs(act_list.condition_list) do--[{role_lv,80},{sub,1},{cost,30},{group,5}]
|
|
if v[1] == "cost_type" then--提交消耗材料
|
|
cost_id = tonumber(v[2])
|
|
break
|
|
end
|
|
end
|
|
return cost_id
|
|
end
|
|
|
|
--通过类型获得相关BUFF加成
|
|
function OperateActivityModel:GetMaterialBuffInfoByKind( kind )
|
|
if self.material_submit_info then
|
|
local curTime = TimeUtil:getServerTime()
|
|
local buff_list = {}
|
|
for k,v in pairs(self.material_submit_info) do
|
|
for kk,vv in pairs(v.buffs_bid_list) do
|
|
if Config.Unitebuff[kk] and Config.Unitebuff[kk].kind == kind and vv.stime < curTime and curTime < vv.etime then--激活
|
|
buff_list[#buff_list + 1] = vv
|
|
end
|
|
end
|
|
end
|
|
|
|
local len = #buff_list
|
|
if len > 0 and len == 1 then
|
|
return Config.Unitebuff[buff_list[1].bid],DeepCopy(buff_list[1]),buff_list[1].dot
|
|
elseif len >= 2 then
|
|
local cur_data = nil
|
|
for k,v in ipairs(buff_list) do
|
|
if not cur_data then
|
|
cur_data = v
|
|
else
|
|
local cur_data_cfg = Config.Unitebuff[cur_data.bid]
|
|
local next_cfg = Config.Unitebuff[v.bid]
|
|
cur_data = cur_data_cfg.data > next_cfg.data and cur_data or v
|
|
end
|
|
end
|
|
if cur_data then
|
|
return Config.Unitebuff[cur_data.bid],DeepCopy(cur_data),cur_data.dot
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
--设置集字红点提示cookie
|
|
function OperateActivityModel:SetJiZiRedDotTipCookie( sub_type,grade,no_show_red )
|
|
local list = self:GetJiZiRedDotTipCookie() or {}
|
|
list[sub_type] = list[sub_type] or {}
|
|
list[sub_type][grade] = no_show_red
|
|
CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.OP_JI_ZI_RED_DOT_TIP,list)
|
|
CookieWrapper.Instance:WriteAll()
|
|
KfActivityModel:getInstance():IsNeedRed(KfActivityModel.TabID.CollectZi,nil,sub_type)
|
|
end
|
|
|
|
--获得集字红点提示cookie
|
|
function OperateActivityModel:GetJiZiRedDotTipCookie( )
|
|
local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.OP_JI_ZI_RED_DOT_TIP) or {}
|
|
return list
|
|
end
|
|
|
|
--获得Boss掉落活动展示奖励
|
|
function OperateActivityModel:GetBossActDropAward( sub_type )
|
|
--如果有BOSS掉落活动 这里要添加展示奖励
|
|
local award_list = {}
|
|
local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.BOSS_DROP)
|
|
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.BOSS_DROP, sub_type)
|
|
if act_list then
|
|
local drop_type = nil
|
|
local drop_goods_id = nil
|
|
for i,v in ipairs(act_list.condition_list) do
|
|
if v[1] and v[2] then
|
|
if v[1] == "drop_type" then
|
|
drop_type = tonumber(v[2])
|
|
elseif v[1] == "drop_goods" then
|
|
drop_goods_id = tonumber(v[2])
|
|
end
|
|
end
|
|
end
|
|
if drop_type and not (drop_type >= 101 and not drop_goods_id) then
|
|
local drop_time_limit_cfg = OperateActivityModel:getInstance():GetBossDropTimeLimitCfg(drop_type)
|
|
if not drop_time_limit_cfg then return end
|
|
local item_list = DeepCopy(drop_time_limit_cfg)
|
|
if not item_list or TableSize(item_list) == 0 then
|
|
return
|
|
end
|
|
local new_list = {}
|
|
for i,v in pairs(item_list) do
|
|
new_list[#new_list + 1] = v
|
|
end
|
|
local sort_func = function ( a, b )
|
|
return a.drop_way < b.drop_way
|
|
end
|
|
table.sort(new_list, sort_func)
|
|
item_list = new_list
|
|
|
|
if drop_type < 101 then
|
|
for i,v in ipairs(item_list) do
|
|
for ii,vv in ipairs(v.award) do
|
|
if vv[2] then
|
|
award_list[#award_list + 1] = vv[2]
|
|
end
|
|
end
|
|
break
|
|
end
|
|
else
|
|
award_list = {{0,drop_goods_id,1}}
|
|
end
|
|
end--没有展示奖励立即退出
|
|
end
|
|
return award_list
|
|
end
|