源战役客户端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1413 lines
40 KiB

StrengthModel = StrengthModel or BaseClass(BaseModel)
StrengthModel.Strengthen = {
IconNoticeList = {
"quiz",
"guildfire",
"angel",
},
}
StrengthModel.UPDATE_VIEW_AFTER_CLICK = "StrengthModel.UPDATE_VIEW_AFTER_CLICK" --在点击前往途径后刷新数据
function StrengthModel:__init()
StrengthModel.Instance = self
self.fight_model = Config.Improvefightnum
self.grade = nil
self.cache_flag = {}
self.module_open_dic = {}
self.state_flag = StateFlag.New()
self.strength_flag_1 = 0
self.strength_flag_2 = 0
self.strength_flag_3 = 0
self.strength_flag_4 = 0
end
function StrengthModel:getInstance()
if StrengthModel.Instance == nil then
StrengthModel.New()
end
return StrengthModel.Instance
end
function StrengthModel:ResetInfo()
self.state_flag:initValue()
self.module_open_dic = {}
end
--获取变强列表
function StrengthModel:GetStrengthList( )
local tb = {}
local cache_flag, func = false
local temp_cache_update_name = {}
for k,v in pairs(Config.ConfigStrength.Func) do
local type_cfg = v
for k2,v2 in pairs(type_cfg) do
--每个函数只执行一遍
local has_updated = temp_cache_update_name[v2.check]
if not has_updated then
temp_cache_update_name[v2.check] = true
local win_id = v2.winId
local sub_id = v2.subId
local special_open_flag = true
--星级套装 要变化下
if win_id == 152 and sub_id == 999 then
sub_id = 1
elseif win_id == 146 and sub_id >= 91 then
-- 珍宝 特殊处理
sub_id = sub_id - 90 -- 判断子系统是否开启
special_open_flag = GetModuleIsOpen(146, 9) -- 判断珍宝外观是否开启
elseif win_id == 149 and sub_id == 99 then
sub_id = 0
end
local key = win_id .. "@".. sub_id
if self.module_open_dic[key] or (GetModuleIsOpen(win_id, sub_id, true) and special_open_flag) then
self.module_open_dic[key] = true
--先判断缓存标识
-- cache_flag = self:GetCacheFlag(v2.check)
-- if cache_flag == true then
-- table.insert(tb, v2)
-- elseif cache_flag == nil then
func = self[v2.check]
if func and func(self) then
table.insert(tb, v2)
end
--end
end
end
end
end
--排序
-- local arg = {"sort_id","winId"}
-- local condition = {Array.LOWER, Array.LOWER}
-- SortTools.MoreKeysSorter(tb, arg, condition)
return tb
end
--设置各个功能函数缓存标识
function StrengthModel:SetCacheFlag(key, value)
local value = value or false
self.cache_flag[key] = value
end
function StrengthModel:GetCacheFlag(key)
return self.cache_flag[key]
end
--是否能变强
function StrengthModel:CanStrength( cur_type )
local cur_type = cur_type or Config.ConfigStrength.ChangeType.All
local can_strength = false
local func, cache_flag
local temp_cache_update_name = {}
if cur_type == Config.ConfigStrength.ChangeType.All then
self.state_flag:initValue()
for k,v in pairs(Config.ConfigStrength.Func) do
local type_cfg = v
can_strength = false
for k2,v2 in pairs(type_cfg) do
--[[func = self[v2.check]
if func and func(self) then
can_strength = true
break
end--]]
--每个函数只执行一遍
local has_updated = temp_cache_update_name[v2.check]
if not has_updated then
temp_cache_update_name[v2.check] = true
func = self[v2.check]
if func and func(self) then
can_strength = true
break
end
end
end
if can_strength then--显示
self.state_flag:addState(Config.ConfigStrength.State_Type[k])
else--隐藏
self.state_flag:delState(Config.ConfigStrength.State_Type[k])
end
end
else
local type_cfg = Config.ConfigStrength.Func[cur_type]
if type_cfg then
for k,v in pairs(type_cfg) do
cache_flag = self:GetCacheFlag(v.check)
if cache_flag == true then
can_strength = true
break
end
end
end
end
if cur_type ~= Config.ConfigStrength.ChangeType.All then
if can_strength then--显示
self.state_flag:addState(Config.ConfigStrength.State_Type[cur_type])
else--隐藏
self.state_flag:delState(Config.ConfigStrength.State_Type[cur_type])
end
end
if self.state_flag then
return self.state_flag:isInstate()
end
end
--AI娘进阶
function StrengthModel:can_jarvis_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_stren", val)
return val
end
--AI娘提升
function StrengthModel:can_jarvis_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_up", val)
return val
end
--AI娘换装
function StrengthModel:can_jarvis_cloth_change( )
local val = FosterModel:GetInstance():CanDressNewEquipWithType(false, FosterConst.ModuleId.FJarvis) or FosterModel:GetInstance():CanDressUpEquipWithType(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_cloth_change", val)
return val
end
--AI娘升装
function StrengthModel:can_jarvis_cloth_up( )
local val = FosterModel:GetInstance():CanUpEquipWithType(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_cloth_up", val)
return val
end
--AI娘技能
function StrengthModel:can_jarvis_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_skill_up", val)
return val
end
--AI娘皮肤
function StrengthModel:can_jarvis_skin_up_or_active( )
local val = FosterModel:GetInstance():CanSkinActOrUp(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_skin_up_or_active", val)
return val
end
--AI娘珍宝
function StrengthModel:can_jarvis_shape_up_or_active( )
local val = ShapeModel:GetInstance():CheckRedByType(false, FosterConst.ModuleId.FJarvis)
self:SetCacheFlag("can_jarvis_shape_up_or_active", val)
return val
end
--磁炮进阶
function StrengthModel:can_gun_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FGun)
self:SetCacheFlag("can_gun_stren", val)
return val
end
--磁炮提升
function StrengthModel:can_gun_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FGun)
self:SetCacheFlag("can_gun_up", val)
return val
end
--磁炮技能
function StrengthModel:can_gun_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FGun)
self:SetCacheFlag("can_gun_skill_up", val)
return val
end
--磁炮皮肤
function StrengthModel:can_gun_skin_up_or_active( )
local val = FosterModel:GetInstance():CanSkinActOrUp(false, FosterConst.ModuleId.FGun)
self:SetCacheFlag("can_gun_skin_up_or_active", val)
return val
end
--星翼进阶
function StrengthModel:can_cloud_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FCloud)
self:SetCacheFlag("can_cloud_stren", val)
return val
end
--星翼提升
function StrengthModel:can_cloud_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FCloud)
self:SetCacheFlag("can_cloud_up", val)
return val
end
--星翼技能
function StrengthModel:can_cloud_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FCloud)
self:SetCacheFlag("can_cloud_skill_up", val)
return val
end
--星翼皮肤
function StrengthModel:can_cloud_skin_up_or_active( )
local val = FosterModel:GetInstance():CanSkinActOrUp(false, FosterConst.ModuleId.FCloud)
self:SetCacheFlag("can_cloud_skin_up_or_active", val)
return val
end
--幻甲进阶
function StrengthModel:can_armour_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FArmour)
self:SetCacheFlag("can_armour_stren", val)
return val
end
--幻甲提升
function StrengthModel:can_armour_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FArmour)
self:SetCacheFlag("can_armour_up", val)
return val
end
--幻甲技能
function StrengthModel:can_armour_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FArmour)
self:SetCacheFlag("can_armour_skill_up", val)
return val
end
--幻甲皮肤
function StrengthModel:can_armour_up_or_active( )
local val = FosterModel:GetInstance():CanSkinActOrUp(false, FosterConst.ModuleId.FArmour)
self:SetCacheFlag("can_armour_up_or_active", val)
return val
end
--座驾进阶
function StrengthModel:can_horse_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_armour_up", val)
return val
end
--座驾提升
function StrengthModel:can_horse_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_horse_up", val)
return val
end
--座驾换装
function StrengthModel:can_horse_cloth_change( )
local val = FosterModel:GetInstance():CanDressNewEquipWithType(false, FosterConst.ModuleId.FHorse) or FosterModel:GetInstance():CanDressUpEquipWithType(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_horse_cloth_change", val)
return val
end
--座驾升装
function StrengthModel:can_horse_cloth_up( )
local val = FosterModel:GetInstance():CanUpEquipWithType(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_horse_cloth_up", val)
return val
end
--座驾技能
function StrengthModel:can_horse_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_horse_skill_up", val)
return val
end
--座驾珍宝
function StrengthModel:can_horse_shape_up_or_active( )
local val = ShapeModel:GetInstance():CheckRedByType(false, FosterConst.ModuleId.FHorse)
self:SetCacheFlag("can_horse_shape_up_or_active", val)
return val
end
--炫翼进阶
function StrengthModel:can_wing_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FWing)
self:SetCacheFlag("can_wing_stren", val)
return val
end
--炫翼提升
function StrengthModel:can_wing_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FWing)
self:SetCacheFlag("can_wing_up", val)
return val
end
--炫翼技能
function StrengthModel:can_wing_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FWing)
self:SetCacheFlag("can_wing_skill_up", val)
return val
end
--炫翼珍宝
function StrengthModel:can_wing_shape_up_or_active( )
local val = ShapeModel:GetInstance():CheckRedByType(false, FosterConst.ModuleId.FWing)
self:SetCacheFlag("can_wing_shape_up_or_active", val)
return val
end
--宝具进阶
function StrengthModel:can_pearl_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FPearl)
self:SetCacheFlag("can_pearl_stren", val)
return val
end
--宝具提升
function StrengthModel:can_pearl_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FPearl)
self:SetCacheFlag("can_pearl_up", val)
return val
end
--宝具技能
function StrengthModel:can_pearl_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FPearl)
self:SetCacheFlag("can_pearl_skill_up", val)
return val
end
--宝具珍宝
function StrengthModel:can_pearl_shape_up_or_active( )
local val = ShapeModel:GetInstance():CheckRedByType(false, FosterConst.ModuleId.FPearl)
self:SetCacheFlag("can_pearl_shape_up_or_active", val)
return val
end
--武器进阶
function StrengthModel:can_weapon_stren( )
local val = FosterModel:GetInstance():CanUpgrade(false, FosterConst.ModuleId.FWeapon)
self:SetCacheFlag("can_weapon_stren", val)
return val
end
--武器提升
function StrengthModel:can_weapon_up( )
local val = FosterModel:GetInstance():CanKernel(false, FosterConst.ModuleId.FWeapon)
self:SetCacheFlag("can_weapon_up", val)
return val
end
--武器技能
function StrengthModel:can_weapon_skill_up( )
local val = FosterModel:GetInstance():CanSkillUpgradeByType(false, FosterConst.ModuleId.FWeapon)
self:SetCacheFlag("can_weapon_skill_up", val)
return val
end
--武器珍宝
function StrengthModel:can_weapon_shape_up_or_active( )
local val = ShapeModel:GetInstance():CheckRedByType(false, FosterConst.ModuleId.FWeapon)
self:SetCacheFlag("can_weapon_shape_up_or_active", val)
return val
end
--职业技能
function StrengthModel:can_careerskill_up( )
local val = SkillUIModel:getInstance():CheckSkillRedDot(false, Config.ConfigSkillUI.TabEnum.CareerSkill)
self:SetCacheFlag("can_careerskill_up", val)
return val
end
--被动技能
function StrengthModel:can_passiveskill_up( )
local val = SkillUIModel:getInstance():CheckSkillRedDot(false, Config.ConfigSkillUI.TabEnum.PassiveSkill)
self:SetCacheFlag("can_passiveskill_up", val)
return val
end
--特殊技能
function StrengthModel:can_specialskill_up( )
local val = SkillUIModel:getInstance():CheckSkillRedDot(false, Config.ConfigSkillUI.TabEnum.SpecialSkill)
self:SetCacheFlag("can_specialskill_up", val)
return val
end
--装备精炼
function StrengthModel:can_equip_stren( )
local val = EquipModel:getInstance():GetEquipRedDotByType(EquipModel.MainTab.Strengthen)
self:SetCacheFlag("can_equip_stren", val)
return val
end
--装备升星
function StrengthModel:can_equip_up( )
local val = EquipModel:getInstance():CheckEvolutionRedDot()
self:SetCacheFlag("can_equip_up", val)
return val
end
--装备升品
function StrengthModel:can_equip_red_up( )
local val = EquipModel:getInstance():CheckRedEquipRedDot()
self:SetCacheFlag("can_equip_red_up", val)
return val
end
--星级套装
function StrengthModel:can_equip_star( )
local val = EquipModel:getInstance():CheckEvolutionStrengthStarRedDot()
self:SetCacheFlag("can_equip_star", val)
return val
end
--宝石镶嵌
function StrengthModel:can_stone_put( )
local val = EquipModel:getInstance():GetEquipRedDotByType(EquipModel.MainTab.Gemstone)
self:SetCacheFlag("can_stone_put", val)
return val
end
--宝石升级
function StrengthModel:can_stone_up( )
local val = ComposeModel:getInstance():GetComposeRedDotByType(ComposeModel.MainTab.Gemstone)
self:SetCacheFlag("can_stone_up", val)
return val
end
-- 幻光激活
function StrengthModel:can_light_active()
local val = LightModel:getInstance():GetLightAllActive()
self:SetCacheFlag("can_light_active", val)
return val
end
-- 幻光升级
function StrengthModel:can_light_up()
local val = LightModel:getInstance():GetLightAllUpGrade()
self:SetCacheFlag("can_light_up", val)
return val
end
--信物升级
function StrengthModel:can_ship_up( )
local mate_model = MateModel:GetInstance()
local val = mate_model:GetShipRedDot()
-- if val then
-- --判断是否有伙伴
-- local basic_data = mate_model:GetBasicInfo( )
-- if not (basic_data and TableSize(basic_data) > 0) then
-- val = false
-- end
-- end
self:SetCacheFlag("can_ship_up", val)
return val
end
--守护合成
function StrengthModel:can_guard_compose( )
local val = ComposeModel:getInstance():GetComposeRedDotByType(ComposeModel.MainTab.Guard)
self:SetCacheFlag("can_guard_compose", val)
return val
end
--饰品合成
function StrengthModel:can_ornaments_compose( )
local val = ComposeModel:getInstance():GetComposeRedDotByType(ComposeModel.MainTab.Ornaments)
self:SetCacheFlag("can_ornaments_compose", val)
return val
end
--橙装合成
function StrengthModel:can_orange_equip_compose( )
local val = ComposeModel:getInstance():GetComposeRedDotByType(ComposeModel.MainTab.Equip)
self:SetCacheFlag("can_orange_equip_compose", val)
return val
end
--宠物升级
function StrengthModel:can_pet_up( )
local val = PetModel:getInstance():GetPetRedDotByType(PetConst.RED_DOT_TYPE.Feed)
self:SetCacheFlag("can_pet_up", val)
return val
end
--宠物升星
function StrengthModel:can_pet_starup( )
local val = PetModel:getInstance():GetPetRedDotByType(PetConst.RED_DOT_TYPE.Evolve)
self:SetCacheFlag("can_pet_starup", val)
return val
end
--宠物宝石
function StrengthModel:can_pet_stone( )
local val = PetModel:getInstance():GetPetRedDotByType(PetConst.RED_DOT_TYPE.Diamond)
self:SetCacheFlag("can_pet_stone", val)
return val
end
--宝宝成长
function StrengthModel:can_baby_up( )
local val = ChildModel:GetInstance():IsRedDotChildTrain()
self:SetCacheFlag("can_baby_up", val)
return val
end
--宝宝技能
function StrengthModel:can_babyskill_up( )
local val = ChildModel:GetInstance():IsRedDotChildSkill()
self:SetCacheFlag("can_babyskill_up", val)
return val
end
--战魂阵型
function StrengthModel:can_warsoul_suit( )
local val = WarSoulModel.getInstance():GetWarSoulRedDotByType(WarSoulModel.MainTab.Suit)
self:SetCacheFlag("can_warsoul_suit", val)
return val
end
--战魂强化
function StrengthModel:can_warsoul_bag( )
local val = WarSoulModel.getInstance():GetWarSoulRedDotByType(WarSoulModel.MainTab.Strength)
self:SetCacheFlag("can_warsoul_bag", val)
return val
end
--战魂升星
function StrengthModel:can_warsoul_svolution( )
local val = WarSoulModel.getInstance():GetWarSoulRedDotByType(WarSoulModel.MainTab.Evolution)
self:SetCacheFlag("can_warsoul_svolution", val)
return val
end
--魂力激活
function StrengthModel:can_soul_power_up( )
local val = SoulPowerModel.getInstance():GetSoulPowerCanGoFinalLv()
self:SetCacheFlag("can_soul_power_up", val)
return val
end
--魂力突破
function StrengthModel:can_soul_break( )
local val = SoulPowerModel.getInstance():GetSoulPOwerCanUpGrade()
self:SetCacheFlag("can_soul_break", val)
return val
end
--放置冒险
function StrengthModel:exp_can_get( )
local exp_model = ExpDunModel:getInstance()
local val = exp_model:GetExpRedByRedType(ExpDunModel.Red_Type.HangUp)
self:SetCacheFlag("exp_can_get", val)
return val
end
--经验加速
function StrengthModel:exp_speed_can_get( )
local exp_model = ExpDunModel:getInstance()
local val = exp_model:GetExpRedByRedType(ExpDunModel.Red_Type.QuickHangUp)
self:SetCacheFlag("exp_speed_can_get", val)
return val
end
--时装激活
function StrengthModel:can_fashion_active( )
local val = FashionModel:getInstance():GetFashionCanActive()
self:SetCacheFlag("can_fashion_active", val)
return val
end
--时装升星
function StrengthModel:can_fashion_up( )
local val = FashionModel:getInstance():GetFashionCanUp()
self:SetCacheFlag("can_fashion_up", val)
return val
end
--装备吞噬
function StrengthModel:can_equip_eat( )
local val = BagModel:getInstance():GetCanSwallowStrength()
self:SetCacheFlag("can_equip_eat", val)
return val
end
-----以下老项目代码----------
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
-- -- --是否能变强
-- -- function StrengthModel:CanStrength( )
-- -- -- local tb = {}
-- -- -- for k,v in pairs(Config.ConfigStrength.Func) do
-- -- -- local vo = OpenFun.LinkWin[v.winId.."@"..v.subId]
-- -- -- if vo and RoleManager.Instance.mainRoleInfo.level >= vo.openLv then
-- -- -- local func = self[v.check]
-- -- -- if func and func() then
-- -- -- table.insert(tb, v)
-- -- -- break
-- -- -- end
-- -- -- end
-- -- -- end
-- -- -- return #tb>0
-- -- -- return false
-- -- print("===", self.strength_flag_1, self.strength_flag_2, self.strength_flag_3, self.strength_flag_4)
-- -- return self.strength_flag_1 > 0 or self.strength_flag_2 > 0 or self.strength_flag_3 > 0 or self.strength_flag_4 > 0
-- -- end
-- ----------------------------------变强主界面----------------------------------
-- -- --技能进阶
-- -- function StrengthModel:Progress_Skill(max_num)
-- -- local cur = 0
-- -- local mySkillList = SkillManager:getInstance().mySkillList
-- -- if mySkillList and TableSize(mySkillList) > 0 then
-- -- for k,v in pairs(mySkillList) do
-- -- -- if k>=10001 and k<=10007 then
-- -- cur = cur + v.level
-- -- -- end
-- -- end
-- -- end
-- -- return (cur/max_num)*100, cur
-- -- end
-- --装备精炼
-- function StrengthModel:Progress_Equip_Stren(max_num)
-- local cur = 0
-- local cur_data = ""
-- -- local equip_info = EquipModel:getInstance():GetStrenDynamic()
-- local stren_info = {}
-- stren_info[1], stren_info[2], stren_info[3], stren_info[4] = BagModel:getInstance():GetAllAddition() --获取全身1装备精炼数 2星级 3宝石数 4圣印强化数
-- cur = stren_info[1] and stren_info[1] or cur
-- cur_data = cur
-- return (cur/max_num)*100, cur_data
-- end
-- --坐骑升星
-- function StrengthModel:Progress_Horse(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = HorseModel:getInstance().horse_data
-- if data and data.stage and data.star then
-- cur = (tonumber(data.stage)-1)*10 + tonumber(data.star)
-- cur_data = data.stage.."阶"..data.star.."星"
-- end
-- return (cur/max_num)*100, cur_data
-- end
-- --宝具升星
-- function StrengthModel:Progress_Treasure(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = NewTalismanModel:getInstance().talisman_upgrade_data
-- if data and data.lv then
-- cur = data.lv
-- end
-- cur_data = cur
-- return (cur/max_num)*100, cur_data
-- end
-- --星灵升星
-- function StrengthModel:Progress_StarSpirit(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = StarSpiritModel:getInstance():GetStarSpiritDataList()
-- local list = {}
-- local high_stage = 0
-- for k,v in pairs(data) do
-- if v and v.stage and v.stage > high_stage then
-- high_stage = v.stage
-- end
-- end
-- if data and #data > 0 then
-- local high_combat = 0
-- for k,v in pairs(data) do
-- if v.stage == high_stage and v.combat_stage and tonumber(v.combat_stage) > high_combat then
-- high_combat = tonumber(v.combat_stage)
-- cur = (tonumber(v.stage) - 1)*3 + tonumber(v.star)
-- cur_data = v.stage.."阶"..v.star.."星"
-- end
-- end
-- end
-- -- if data and #data > 0 then
-- -- for k,v in pairs(data) do
-- -- cur = cur + v.combat_stage
-- -- end
-- -- end
-- return (cur/max_num)*100, cur_data
-- end
-- --6圣灵强化
-- function StrengthModel:Progress_Pyx(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = PyxModel:getInstance():GetSpiritList()
-- local list = {}
-- local high_lv = 0
-- for k,v in pairs(data) do
-- if v and v.lv and v.lv >= high_lv then
-- high_lv = v.lv
-- end
-- end
-- for k,v in pairs(data) do
-- if v.lv == high_lv then
-- table.insert(list, v)
-- end
-- end
-- if list and #list > 0 then
-- local high_combat = 0
-- for k,v in pairs(list) do
-- if v.lv and v.lv >= 1 then
-- local key = v.spirit_id.."@"..v.lv
-- local combat = GetFighting(ErlangParser:GetInstance():Parse(Config.Spiritconfig[key].attr))
-- if combat >= high_combat then
-- high_combat = combat
-- cur = v.lv
-- end
-- end
-- end
-- end
-- cur_data = cur
-- return (cur/max_num)*100, cur_data
-- end
-- --宝石镶嵌
-- function StrengthModel:Progress_Jewel(max_num)
-- local cur = 0
-- local cur_data = ""
-- local stren_info = {}
-- stren_info[1], stren_info[2], stren_info[3], stren_info[4] = BagModel:getInstance():GetAllAddition()
-- cur = stren_info[3] and stren_info[3] or cur
-- cur_data = cur
-- return (cur/max_num)*100, cur_data
-- end
-- -- --翅膀强化
-- -- function StrengthModel:Progress_Wing(max_num)
-- -- local cur = 0
-- -- local data = WingModel:getInstance().wing_vo
-- -- if data and data.combat then
-- -- cur = data.combat
-- -- end
-- -- return (cur/max_num)*100, cur
-- -- end
-- -- --装备合成
-- -- function StrengthModel:Progress_Equip_Compose(max_num)
-- -- local cur = 0
-- -- local data = 1
-- -- return (cur/max_num)*100, cur
-- -- end
-- --11套装合成
-- function StrengthModel:Progress_Equip_Suit(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = GoodsModel:getInstance().wear_equip_list
-- if data then
-- local len = TableSize(data)
-- self.wear_equip_list = {}
-- local function handleEquip()
-- if self.wear_equip_list then
-- for k,v in pairs(self.wear_equip_list) do
-- if v and v.suit_lv and v.suit_slv and v.cell then
-- local pos_2_type_cfg = Config.Equippos2suittype
-- local cfg = Config.Improvesuit
-- if pos_2_type_cfg[v.cell] and pos_2_type_cfg[v.cell].type and cfg[pos_2_type_cfg[v.cell].type.."@"..v.suit_lv.."@"..v.suit_slv.."@"] then
-- cur = cur + cfg[pos_2_type_cfg[v.cell].type.."@"..v.suit_lv.."@"..v.suit_slv.."@"].point
-- end
-- end
-- end
-- end
-- end
-- local function callback(dynamic)
-- if dynamic then
-- self.wear_equip_list[dynamic.cell] = dynamic
-- if TableSize(self.wear_equip_list) == len then
-- handleEquip()
-- end
-- end
-- end
-- for k,v in pairs(data) do
-- if v and v.goods_id then
-- GoodsModel:getInstance():GetDynamic(v.goods_id, callback)
-- end
-- end
-- end
-- return (cur/max_num)*100, cur_data
-- end
-- -- --装备洗练
-- -- function StrengthModel:Progress_Equip_Wash(max_num)
-- -- local cur = 0
-- -- local data = 1
-- -- return (cur/max_num)*100, cur
-- -- end
-- -- if data then
-- -- if data.talent_skills and TableSize(data.talent_skills) > 0 and data.talent_skills.skills and TableSize(data.talent_skills.skills) > 0 then
-- -- for k,v in pairs(data.talent_skills.skills) do
-- -- cur = cur + 1
-- -- end
-- -- end
-- -- end
-- -- return (cur/max_num)*100, cur
-- -- end
-- --神魂升级 暂时还没做
-- -- function StrengthModel:Progress_(max_num)
-- -- -- body
-- -- end
-- --装备替换
-- function StrengthModel:Progress_Equip_repalce(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = 1
-- local equip_cfg = Config.Equipattr
-- local role_equip = GoodsModel:getInstance().wear_equip_list
-- if data and role_equip and equip_cfg then
-- for k,v in pairs(role_equip) do
-- if v and v.type_id and equip_cfg[v.type_id] then
-- cur = cur + tonumber(equip_cfg[v.type_id].base_rating)
-- end
-- end
-- end
-- return (cur/max_num)*100, cur_data
-- end
-- -- 坐骑装备
-- function StrengthModel:Progress_Equip_horse(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data = GoodsModel:getInstance():GetHorseEquipList()
-- if data then
-- for k,v in pairs(data) do
-- if v and v.type_id and HorseModel:getInstance():GetHorseEquipAttrCfg(v.type_id) then
-- cur = cur + tonumber(HorseModel:getInstance():GetHorseEquipAttrCfg(v.type_id).base_rating)
-- end
-- end
-- end
-- return (cur/max_num)*100, cur_data
-- end
-- -- 神格提升
-- function StrengthModel:Progress_God_Hood(max_num)
-- local cur = 0
-- local cur_data = ""
-- local data, cur_cfg, next_cfg = DeityModel:getInstance():GetCurDeityInfo()
-- if data and cur_cfg then
-- cur = tonumber(cur_cfg.id)
-- cur_data = cur_cfg.name..cur_cfg.lv
-- else
-- cur_data = "暂无"
-- end
-- return (cur/max_num)*100, cur_data
-- end
-- --根据标签id获取对应标签下的item信息
-- function StrengthModel:GetItemListByIndex(id)
-- local list = {}
-- local level = RoleManager.Instance.mainRoleInfo.level
-- local config_data = DeepCopy(Config.Improvefighttask)
-- for i,v in pairs(config_data) do
-- if v.page_id == id and v.sort_id ~= 14 and (level >= v.lv_min and level <= v.lv_max) then --现在先排除14 神魂 还没做这个模块
-- -- if level >= v.lv_min and level <= v.lv_max then
-- -- table.insert(list, v)
-- -- end
-- v.sort_huodong_id = 0
-- local data = self:refresh_data(v)
-- if data ~= nil and self:CheckIsOpenByLevel(data) and not self:CheckSpicalIsOpen(data) then
-- data.per, data.cur_num = self:Get_Per(data)
-- self:Add_need_close(data)
-- table.insert(list, data)
-- end
-- end
-- end
-- local _sort = function( a,b )
-- if a.per >=100 and b.per <100 then
-- return false
-- elseif b.per >=100 and a.per <100 then
-- return true
-- else
-- if a.open_flag > b.open_flag then
-- return true
-- elseif a.open_flag == b.open_flag then
-- if a.sort_huodong_id > b.sort_huodong_id then
-- return false
-- elseif a.sort_huodong_id < b.sort_huodong_id then
-- return true
-- end
-- if a.sort_id >= b.sort_id then
-- return false
-- else
-- return true
-- end
-- else
-- return false
-- end
-- end
-- end
-- table.sort(list, _sort)
-- return list
-- end
-- -- 条件字段中有判断等级开启的level的 可以判断是否到达等级而显示
-- function StrengthModel:CheckIsOpenByLevel(data)
-- local is_open = false
-- local str = ErlangParser:GetInstance():Parse(data.condition)[1]
-- str = Trim(str)
-- local list = Split(str,"_")
-- local task_type = list[1]
-- local task_id = list[2]
-- if task_type == "level" then
-- if RoleManager.Instance.mainRoleInfo.level >= tonumber(task_id) then
-- is_open = true
-- end
-- else
-- is_open = true
-- end
-- return is_open
-- end
-- -- 有些是特殊判断是否需要显示的
-- function StrengthModel:CheckSpicalIsOpen(data)
-- local not_show = false
-- if data.page_id == 5 and data.sort_id == 2 then --投资计划 特殊判断显示
-- if InvestModel:getInstance():IsGetAll(InvestModel.type.normal) and InvestModel:getInstance():IsGetAll(InvestModel.type.high) then
-- not_show = true --不显示
-- end
-- end
-- return not_show
-- end
-- function StrengthModel:refresh_data(data)
-- local str = ErlangParser:GetInstance():Parse(data.condition)[1]
-- str = Trim(str)
-- local list = Split(str,"_")
-- local task_type = list[1]
-- local task_id = list[2]
-- if task_type ~= "level" then
-- task_type = str
-- end
-- data.task_type = task_type
-- data.task_id = task_id
-- local cur_level = RoleManager.Instance.mainRoleInfo.level
-- local open_data = {}
-- if task_type == "level" then
-- if cur_level >= tonumber(task_id) then
-- data.open_flag = 1
-- else
-- data.open_flag = 0
-- end
-- else
-- open_data = Config.ConfigStrength.OpenLv[task_type]
-- if not open_data then return end
-- if cur_level >= open_data.openLv then
-- data.open_flag = 1
-- if task_type == "quiz" then
-- local _data = QuizModel:getInstance():GetQuizState()
-- if _data then
-- if _data.stage == 3 or _data.stage == 0 then
-- data.open_flag = 0
-- end
-- else
-- data.open_flag = 0
-- end
-- self:Activity_time_show(data)
-- elseif task_type == "guildfire" then
-- -- if RoleManager.Instance.mainRoleInfo.guild_id == 0 then
-- -- data.open_flag = 0
-- -- data.huodong_des = "未加入社团"
-- -- else
-- -- local _data = GuildModel:getInstance():GetBonfireActInfo()
-- -- if _data then
-- -- if _data.state == 0 then
-- -- data.open_flag = 0
-- -- end
-- -- else
-- -- data.open_flag = 0
-- -- end
-- -- self:Activity_time_show(data)
-- -- end
-- end
-- else
-- data.open_flag = 0
-- data.huodong_des = data.task_nonopen
-- end
-- end
-- return data
-- end
-- function StrengthModel:Get_Per(data)
-- local per = data.per or 0
-- local cur_num = 0
-- local task_type = data.task_type
-- local task_id = data.task_id
-- local max_num = data.max_num
-- local fun = nil
-- if data.page_id == 1 then --只有第一个标签下的信息才有进度条 因为会有很多相同的id值 所以用sort_id替代id值
-- for k,v in pairs(Config.ConfigStrength.GetProgressFunc) do
-- if tonumber(data.sort_id) == tonumber(v.id) then
-- fun = self[v.func]
-- per, cur_num = fun(self, max_num)
-- end
-- end
-- end
-- -- if per <= 1 then
-- -- per = 1
-- -- elseif per >= 100 then
-- -- per = 100
-- -- end
-- -- if data.page_id == 1 then
-- -- if per >= 100 then
-- -- per = 99
-- -- end
-- -- end
-- return per, cur_num
-- end
-- function StrengthModel:Add_need_close(data)
-- -- body
-- end
-- function StrengthModel:Activity_time_show(data)
-- local index = 1
-- local time_table_list = {}
-- local time_table_list_today = {}
-- for k,v in pairs(Config.Improveactivityhall) do
-- local str_id = ErlangParser:GetInstance():Parse(v.str_id)[1]
-- str_id = Trim(str_id)
-- if str_id == data.task_type then
-- time_table_list[index] = DeepCopy(v)
-- index=index+1
-- end
-- end--获取相应的数据列表
-- index = 1
-- local cur_time = TimeUtil:getServerTime()
-- local now_time = os.date("*t",cur_time)
-- local today = now_time.wday-1--当天周几
-- for k,v in pairs(time_table_list) do
-- local day_list = ErlangParser:GetInstance():Parse(v.adate)[1]
-- local is_today = false
-- for x,y in pairs(day_list) do
-- if tonumber(y) == today then
-- is_today = true
-- break
-- end
-- end
-- if is_today then
-- time_table_list_today[index] = v
-- index = index + 1
-- end
-- end
-- local _sort = function(a,b)
-- if a.asort > b.asort then
-- return false
-- else
-- return true
-- end
-- end
-- table.sort( time_table_list, _sort )
-- if TableSize(time_table_list_today) == 0 then
-- data.IsNull = true
-- end
-- local time_inside = false
-- local isover = false
-- local next_time = nil
-- for k,v in pairs(time_table_list_today) do
-- local opentime = ErlangParser:GetInstance():Parse(v.atime)
-- if opentime then
-- if now_time.hour < tonumber(opentime[1][1]) then
-- next_time = opentime[1]
-- elseif now_time.hour == tonumber(opentime[1][1]) and now_time.min < tonumber(opentime[1][2]) then
-- next_time = opentime[1]
-- elseif now_time.hour == tonumber(opentime[1][1]) and now_time.min == tonumber(opentime[1][2]) and now_time.sec <= tonumber(opentime[1][3]) then
-- next_time = opentime[1]
-- end
-- if next_time then
-- break
-- end
-- end
-- end
-- if not next_time then
-- data.per = 100
-- data.huodong_des = "over"
-- else
-- data.sort_huodong_id = tonumber(next_time[1]) * 1000 + tonumber(next_time[2])
-- if tonumber(next_time[1]) == 0 then
-- next_time[1] = "00"
-- end
-- if tonumber(next_time[1]) < 10 then
-- next_time[1] = "0"..tonumber(next_time[1])
-- end
-- if tonumber(next_time[2]) == 0 then
-- next_time[2] = "00"
-- end
-- if tonumber(next_time[2]) < 10 then
-- next_time[2] = "0"..tonumber(next_time[2])
-- end
-- data.per = 5
-- local str = next_time[1]..":"..next_time[2].."开启"
-- data.huodong_des = str
-- end
-- if data.open_flag == 1 then
-- data.sort_huodong_id = 0
-- data.huodong_des = ""
-- data.per = 5
-- end
-- end
-- ------------------------------------------挑战失败推送--------------------------------------
-- --挑战失败界面的"变强"推送 boss挑战失败界面 BossResultView 副本失败 DungeonResultView 世界boss失败 ReliveView
-- function StrengthModel:GetStrengthPush()
-- local list = {}
-- local strong_list = {}
-- local level = RoleManager.Instance.mainRoleInfo.level
-- local config_data = DeepCopy(Config.Improvefighttask)
-- for k,v in pairs(config_data) do
-- if v.page_id == 1 and v.sort_id <= 6 and (level >= v.lv_min and level <= v.lv_max) then
-- if self:IsFuncOpenLevel(v) then
-- local data = self:New_Get_Per(v)
-- if data then
-- table.insert(list, data)
-- end
-- end
-- end
-- end
-- if #list >= 4 then
-- local sort_func = function(a,b) --对变强途径排序 最小值的排在前面
-- if a.per >= b.per then
-- return false
-- else
-- return true
-- end
-- end
-- table.sort( list, sort_func )
-- for k,v in pairs(list) do --拿出最前面的四个最小值
-- if k <= 4 then
-- local strong_way = {winId = v.tagplace, subId = v.sub_tag, per = v.per}
-- table.insert(strong_list, strong_way)
-- end
-- end
-- else
-- return Config.ConfigBoss.StrongWay
-- end
-- return strong_list
-- end
-- function StrengthModel:New_Get_Per(data)
-- local per = data.per or 0
-- local task_type = data.task_type
-- local task_id = data.task_id
-- local max_num = data.max_num
-- local fun = nil
-- if data.page_id == 1 then
-- -- for k,v in pairs(Config.ConfigStrength.StrongWay) do
-- -- if tonumber(data.sort_id) == tonumber(v.id) then
-- -- fun = self[v.func]
-- -- per = fun(self, max_num)
-- -- data.per = per or 0
-- -- end
-- -- end
-- for k,v in pairs(Config.ConfigStrength.GetProgressFunc) do
-- if tonumber(data.sort_id) == tonumber(v.id) then
-- fun = self[v.func]
-- per = fun(self, max_num)
-- data.per = per or 0
-- end
-- end
-- end
-- return data
-- end
-- --是否是模块开启等级
-- function StrengthModel:IsFuncOpenLevel(data)
-- local str = ErlangParser:GetInstance():Parse(data.condition)[1]
-- str = Trim(str)
-- local list = Split(str,"_")
-- local task_type = list[1]
-- local task_id = list[2]
-- if task_type ~= "level" then return false end
-- if RoleManager.Instance.mainRoleInfo.level >= tonumber(task_id) then
-- return true
-- end
-- return false
-- end
-- function StrengthModel:SetStrengthFlag(type,value)
-- local t1 = math.floor(type / 20)
-- local t2 = type % 20
-- local flag = (t2 > 0 and t1 + 1 or t1)
-- local bit_num = (t2 == 0 and 20 or t2)
-- if flag == 1 then
-- if value then
-- self.strength_flag_1 = bit.bor(self.strength_flag_1, bit.lshift(1,bit_num))
-- else
-- self.strength_flag_1 = bit.band(self.strength_flag_1, bit.bnot(bit.lshift(1,bit_num)))
-- end
-- -- self:ChangeVar("strength_flag_1", self.strength_flag_1, nil, true)
-- elseif flag == 2 then
-- if value then
-- self.strength_flag_2 = bit.bor(self.strength_flag_2, bit.lshift(1,bit_num))
-- else
-- self.strength_flag_2 = bit.band(self.strength_flag_2, bit.bnot(bit.lshift(1,bit_num)))
-- end
-- -- self:ChangeVar("strength_flag_2", self.strength_flag_2, nil, true)
-- elseif flag == 3 then
-- if value then
-- self.strength_flag_3 = bit.bor(self.strength_flag_3, bit.lshift(1,bit_num))
-- else
-- self.strength_flag_3 = bit.band(self.strength_flag_3, bit.bnot(bit.lshift(1,bit_num)))
-- end
-- -- self:ChangeVar("strength_flag_3", self.strength_flag_3, nil, true)
-- elseif flag == 4 then
-- if value then
-- self.strength_flag_4 = bit.bor(self.strength_flag_4, bit.lshift(1,bit_num))
-- else
-- self.strength_flag_4 = bit.band(self.strength_flag_4, bit.bnot(bit.lshift(1,bit_num)))
-- end
-- end
-- end
--获得死亡复活变强配置
function StrengthModel:GetStrongWayCfg( )
local lv = RoleManager.Instance.mainRoleInfo.level
for k,v in pairs(Config.Rbstronger) do
if lv >= v.lv_min and lv <= v.lv_max then
local result = stringtotable(v.grade)
for kk,vv in pairs(result) do
vv.module_id = vv[1]
vv.sub_id = vv[2]
end
return result
end
end
return nil
end
--是否是其他特殊选项
function StrengthModel:IsOtherOption(module_id, module_sub)
if not module_id or not module_sub then
return false
end
local key = module_id .. "@" .. module_sub
local t =
{
["159@1"] = true,
["451@5"] = true,
["450@2"] = true,
}
return t[key]
end
--获得死亡复活变强配置
function StrengthModel:GetOtherOption( )
local b = false
local option_res = ""
local modue_id = 450
local module_sub = 2
local module_name = ""
local vip = RoleManager.Instance:GetMainRoleVo().vip_flag
local sub_tab_id = false
if not RechargeActivityModel:getInstance():IsFirstRechager() then
b = true
local career = RoleManager.Instance.mainRoleInfo.career
if career == 1 or career == 2 then
option_res = "ui_item_first_rechager_1"
else
option_res = "ui_item_first_rechager_2"
end
modue_id = 159
module_sub = 1
module_name = "首充"
elseif vip < 3 then
b = true
option_res = "ui_item_vip_3"
module_name = "VIP3"
sub_tab_id = 3
elseif vip < 4 then
b = true
option_res = "ui_item_vip_4"
module_name = "VIP4"
sub_tab_id = 4
elseif RoleManager.Instance.mainRoleInfo.sup_vip_type == 0 then
b = true
option_res = "ui_item_surper_vip"
modue_id = 451
module_sub = 5
module_name = "贵族"
elseif vip < 5 then
b = true
option_res = "ui_item_vip_5"
module_name = "VIP5"
sub_tab_id = 5
end
return b, option_res, modue_id, module_sub, module_name,sub_tab_id
end