|
|
- EquipModel = EquipModel or BaseClass(BaseVo, true)
- local EquipModel = EquipModel
- local stringtotable = stringtotable
-
- EquipModel.REQUEST_CCMD_EVENT = "EquipModel.REQUEST_CCMD_EVENT"--请求协议
- EquipModel.OPEN_MAIN_VIEW = "EquipModel.OPEN_MAIN_VIEW"--打开主界面
- EquipModel.CLOSE_MAIN_VIEW = "EquipModel.CLOSE_MAIN_VIEW"--关闭主界面
- EquipModel.UPDATE_DYNAMIC_DETAILS = "EquipModel.UPDATE_DYNAMIC_DETAILS"--更新动态杀怪
- EquipModel.UPDATE_VIEW_RED = "EquipModel.UPDATE_VIEW_RED"--更新红点
- EquipModel.EQUIP_ITEM_BE_CLICK = "EquipModel.EQUIP_ITEM_BE_CLICK"--装备道具点击
- EquipModel.OPEN_STRENGTH_SUIT_VIEW = "EquipModel.OPEN_STRENGTH_SUIT_VIEW"--打开精炼套装界面
- EquipModel.OPEN_STAR_SUIT_VIEW = "EquipModel.OPEN_STAR_SUIT_VIEW"--打开星级套装界面
- EquipModel.OPEN_EQUIP_STAR_TIP_VIEW = "EquipModel.OPEN_EQUIP_STAR_TIP_VIEW"--打开星级套装Tip界面
- EquipModel.INFO_UPDATE = "EquipModel.INFO_UPDATE"--请求协议
- EquipModel.UPDATE_RED_EQUIP_INFO = "EquipModel.UPDATE_RED_EQUIP_INFO"--红装成功刷新
- EquipModel.OPEN_EQUIP_INHERIT_TIP_VIEW = "EquipModel.OPEN_EQUIP_INHERIT_TIP_VIEW"--打开继承选择装备界面
- EquipModel.INHERIT_TIP_CHOOSE_EQUIP = "EquipModel.INHERIT_TIP_CHOOSE_EQUIP"--打继承选中装备
- EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW = "EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW"--升星购买装备展示界面
- EquipModel.EVOLUTION_SUCCUSCE = "EquipModel.EVOLUTION_SUCCUSCE"--升星成功
- EquipModel.OPEN_GEMSTONES_CHOOSE_VIEW = "EquipModel.OPEN_GEMSTONES_CHOOSE_VIEW"--打开宝石选择界面
- EquipModel.OPEN_GEMSTONES_STATE_VIEW = "EquipModel.OPEN_GEMSTONES_STATE_VIEW"--打开宝石操作界面
- EquipModel.OPEN_GEMSTONE_SUIT_VIEW = "EquipModel.OPEN_GEMSTONE_SUIT_VIEW"--打开宝石套装界面
- EquipModel.OPEN_EVOLUSTION_CHOOSE_VIEW = "EquipModel.OPEN_EVOLUSTION_CHOOSE_VIEW"--打开升星装备选择界面
- EquipModel.OPEN_EVOLUSTION_TIP_VIEW = "EquipModel.OPEN_EVOLUSTION_TIP_VIEW"--打开升星装备选择界面
- EquipModel.EVOLUTION_EQUIP_CHOOSE = "EquipModel.EVOLUTION_EQUIP_CHOOSE"--升星装备选择更新
- EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST = "EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST"--升星装备市场购买刷新
- EquipModel.OPEN_DRACONIC_CHOOSE_VIEW = "EquipModel.OPEN_DRACONIC_CHOOSE_VIEW"
- EquipModel.OPEN_TOOL_MAIN_VIEW = "EquipModel.OPEN_TOOL_MAIN_VIEW"--打开装备工坊主界面
- EquipModel.OPEN_DRACONIC_ATTR_SHOW_VIEW = "EquipModel.OPEN_DRACONIC_ATTR_SHOW_VIEW"--打开刻印属性展示界面
- EquipModel.CHANGE_MAIN_BG_RES = "EquipModel.CHANGE_MAIN_BG_RES"--改变背景图
- EquipModel.OPEN_EQUIP_INHERIT_WEAR_TIP_VIEW = "EquipModel.OPEN_EQUIP_INHERIT_WEAR_TIP_VIEW"--打开装备继承预览界面
- EquipModel.UPDATE_EQUIP_MAX_SERIES = "EquipModel.UPDATE_EQUIP_MAX_SERIES"--刷新装备装备最大套装数
- EquipModel.OPEN_GEMSTONE_AUTO_VIEW = "EquipModel.OPEN_GEMSTONE_AUTO_VIEW"--宝石一键镶嵌表现界面
- EquipModel.OPEN_EVOLUTION_SCUCCESS_VIEW = "OPEN_EVOLUTION_SCUCCESS_VIEW"--打开升星成功界面
- EquipModel.PLAY_GEMSTONE_EFFECT = "PLAY_GEMSTONE_EFFECT"--播放宝石界面特效
- EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW = "EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW"--装备精炼升星基础提示界面
- EquipModel.PLAY_GEMSTONE_AUTO_EFFECT = "EquipModel.PLAY_GEMSTONE_AUTO_EFFECT"--播放宝石自动镶嵌特效
- EquipModel.CLOSE_EVOLUTION_SCUCCESS_VIEW = "EquipModel.CLOSE_EVOLUTION_SCUCCESS_VIEW"--关闭升星成功界面
- EquipModel.CLOSE_EVOLUSTION_TIP_VIEW = "EquipModel.CLOSE_EVOLUSTION_TIP_VIEW"--关闭升星二次确认界面
- EquipModel.UPDATE_EQUIP_TOOL_TIPS_EXP_LV = "EquipModel.UPDATE_EQUIP_TOOL_TIPS_EXP_LV"--更新守护饰品tip的经验值和等级(可成长装备)
- EquipModel.OPEN_EVOLUSTION_ATTR_FIND_VIEW = "EquipModel.OPEN_EVOLUSTION_ATTR_FIND_VIEW"--打开升星属性查找界面
- EquipModel.UPDATE_EQUIP_POWER = "EquipModel.UPDATE_EQUIP_POWER"--更新装备战力
- EquipModel.UPDATE_STAR_SUIT_EFFECT = "EquipModel.UPDATE_STAR_SUIT_EFFECT"--更新星级套装
-
-
- --页签
- EquipModel.MainTab = {
- Strengthen = 1,--精炼
- Evolution = 2,--升星
- Inherit = 3,--继承
- UpQuality = 4,--升品
- RedEquip = 5,--红装
- Draconic = 6,--刻印
- Gemstone = 7,--宝石
- }
-
- EquipModel.EquipPosIndex = {--装备位置索引
- 1,6,2,7,3,8,4,9,5,10
- }
-
- EquipModel.EquipType = {
- Weapon = 1,--武器
- Head = 2,--头盔
- Body = 3,--身甲
- Shoulder = 4,--披风
- Hand = 5,--手甲
- Leg = 6,--护腿
- Shoes = 7,--鞋子
- Necklace = 8,--项链
- LeftRing = 9,--戒指
- RightRing = 10,--耳饰
- Guard = 11,--守护
- Fetter = 12,--羁绊
- }
-
- --防御
- EquipModel.DefEquipType = {
- [2] = true,--头盔
- [3] = true,--身甲
- [4] = true,--披风
- [6] = true,--护腿
- [7] = true,--鞋子
- }
-
- --饰品
- EquipModel.NecklaceEquipType = {
- [5] = true,--手甲
- [8] = true,--项链
- [9] = true,--戒指
- [10] = true,--耳饰
- }
-
- --装备局部百分比属性列表
- EquipModel.STypeAttr = {
- [221] = 1,--武器攻击
- [223] = 2,--防具生命
- [224] = 4,--防具防御
- [225] = 1,--饰品攻击
- }
-
- EquipModel.EquipTypeName = {
- "武器",
- "头盔",
- "身甲",
- "披风",
- "手甲",
- "护腿",
- "鞋子",
- "项链",
- "戒指",
- "耳饰",
- "守护",
- }
-
- --合成配置主类型
- EquipModel.ComposeType = {
- EquipUpQuality = 1,--升品
- }
-
- --升星数等于高级属性数减2
- EquipModel.Evolution_Level_offer = 2
-
- --外部提示穿戴等级限制
- EquipModel.TipWearLevelLimit = 96
-
- --宝石最大等级
- EquipModel.GemstoneMaxLevel = 9
-
- EquipModel.EvoAttrColor = {
- "<color=#66abff>高级</color>",
- "<color=#f558ff>超级</color>",
- "<color=#feb940>至尊</color>",
- "<color=#ff203a>绝世</color>",
- }
-
- --装备升品展示的10件装备equip_suit_type , 8不是装备= =。
- --2020/1/7: 又改回来了= =。 这个保留着吧,以防万一
- EquipModel.EmpowerEquipTransId = {
- 1,--武器
- 2,--头盔
- 3,--身甲
- 4,--披风
- 5,--手甲
- 6,--护腿
- 7,--鞋子
- 8,--项链
- 9,--戒指
- 10--耳饰
- }
-
- --装备宝石主类型
- EquipModel.GemsType = {
- Attark = 1,--攻击
- Def = 2,--防御
- Life = 3,--生命
- }
-
- --装备宝石主类型名字
- EquipModel.GemsTypeName = {
- [1] = "红宝石",
- [2] = "蓝宝石",
- [3] = "绿宝石",
- }
-
- --装备套件页签bg宽度
- EquipModel.TabLenth = {
- [1] = 130,
- [2] = 180,
- [3] = 223,
- [4] = 270,
- [5] = 326,
- [6] = 370,
- }
-
- --宝石一键镶嵌展示效果
- EquipModel.StoneAotuShowList = {
- 109002,109003,109004,109012,109013,109014,109022,109023,109024,109025,109005,
- }
-
- --装备升品等级对应名字
- EquipModel.ReqEquipLvName = {
- [1] = "红色",
- [2] = "粉色",
- [3] = "彩色",
- }
-
- --装备升品等级对应名字颜色循环列表
- EquipModel.ColorList = {
- [1] = "#ff3939",--红
- [2] = "#ffc038",--黄
- [3] = "#46f33d",--灰
- [4] = "#40eef9",--绿
- [5] = "#4e47e7",--蓝
- [6] = "#cd47ff",
- }
-
-
- function EquipModel:__init()
- EquipModel.Instance = self
- self:Reset()
- end
-
- function EquipModel:Reset()
- self.goods_model = GoodsModel:getInstance()
- self.equip_sum_stars = 0--装备总星级
- self.equip_activie_stars = 0--装备激活星级
- self.equip_sum_power = 0--装备总战力
- self.equip_force_strength = false--是否正在一键精炼
- self.gems_lv_list = {}--装备激活宝石等级列表
- self.gems_suit_red_list = {}--装备激活宝石套装红点列表
- self.equip_pos_info = {}--装备位置列表信息15200
- self.can_strength_info = {}--穿戴装备精炼列表
- self.can_up_quality_info = {}--能否升品信息
- self.red_dot_info = {}--红点列表
- self.equip_red_equip_pos_list = {} -- 15200升品寻宝pos_list
- self.red_dot_redEquip_info = {}--红装红点信息
- self.gemstone_info_list = {}--15213宝石镶嵌信息
- self.equip_gemsstone_red_list = {}
- self.gem_next_level_list = {}--宝石下一阶段
- self.gems_can_tip = false--宝石能否提示tips
- self.redEquip_server_info = {}
- self.equip_sum_power = 0
- self.no_show_faker_evo = false--默认展示弱红点一次
-
- self.draconic_red_info = {}--刻印装备位置红点
-
- self.cur_max_series = 1 --当前已经开启的最大套代数
- self.series_to_turn_cfg = {} --最大套装代数 转 转生数配置
- self.turn_to_series_cfg = {} --转生数 转 最大套装代数配置
-
- self.equipment_cfg = {}--装备基础配置初始化
- self.equipment_suit_cfg = {}--装备套装配置初始化
- self.equipment_gems_suit_cfg = {}--装备宝石套件配置
- self.equipment_draconic_cfg = {}--装备刻印属性(暂不知道什么时候需要)
- self.red_equip_cfg_list = {}--红装配置
- self.suit_attr_active_list = {}--装备更新新套装属性激活
- self.suit_attr_active_red_series_list = {}--装备更新新套装属性激活Red
- self.suit_attr_red_bool = false
- self.need_equip_duibi = false--默认不需要装备对比
- self:InitEquipCfg()
- end
-
- function EquipModel:getInstance()
- if EquipModel.Instance == nil then
- EquipModel.Instance = EquipModel.New()
- end
- return EquipModel.Instance
- end
-
- --初始化需要的配置
- function EquipModel:InitEquipCfg( )
- --装备属性评分库
- self.equipment_attr_rating_cfg = {}
- local equipment_attr_rating_cfg_list = Config.Equipattrrating
- for k,v in pairs(equipment_attr_rating_cfg_list) do
- if not self.equipment_attr_rating_cfg[v.attr_id] then
- self.equipment_attr_rating_cfg[v.attr_id] = {}
- end
- self.equipment_attr_rating_cfg[v.attr_id][v.power_section] = v
- end
-
- --装备宝石配置
- self.equipment_gems_cfg = {}
- self.equipment_gems_series_cfg = {}
- self.equipment_gems_lv_cfg = {}--专门用于宝石越级升级的红点(这个宝石表操作逻辑很多直接初始化最好数量也不多)
- local equipment_gems_cfg = DeepCopy(Config.Equipmentgems)
- for k,v in pairs(equipment_gems_cfg) do
- v.attr = stringtotable(v.attr)
- self.equipment_gems_cfg[v.goods_id] = v
- if not self.equipment_gems_series_cfg[v.type] then
- self.equipment_gems_series_cfg[v.type] = {}
- end
- self.equipment_gems_series_cfg[v.type][v.goods_id] = v
- if not self.equipment_gems_lv_cfg[v.type] then
- self.equipment_gems_lv_cfg[v.type] = {}
- end
- self.equipment_gems_lv_cfg[v.type][v.lv] = v
- end
-
- self.equip_cfg_max_star = 0--装备星级配置最大星级
- for k,v in pairs(Config.Equipmentstartotal) do
- self.equip_cfg_max_star = self.equip_cfg_max_star < v.stars and v.stars or self.equip_cfg_max_star
- end
- end
-
- --初始化装备升星概率表
- function EquipModel:InitEquipEvolutionRatioCfg( )
- --装备升星属性概率
- self.equipment_evolution_ratio_cfg = {}
- local equipment_evolution_ratio_cfg = Config.Equipmentgreatratio
- for k,v in pairs(equipment_evolution_ratio_cfg) do
- if not self.equipment_evolution_ratio_cfg[v.color] then
- self.equipment_evolution_ratio_cfg[v.color] = {}
- end
- if not self.equipment_evolution_ratio_cfg[v.color][v.series] then
- self.equipment_evolution_ratio_cfg[v.color][v.series] = {}
- end
- if not self.equipment_evolution_ratio_cfg[v.color][v.series][v.target_series] then
- self.equipment_evolution_ratio_cfg[v.color][v.series][v.target_series] = {}
- end
- if not self.equipment_evolution_ratio_cfg[v.color][v.series][v.target_series][v.target_lv] then
- self.equipment_evolution_ratio_cfg[v.color][v.series][v.target_series][v.target_lv] = {}
- end
- self.equipment_evolution_ratio_cfg[v.color][v.series][v.target_series][v.target_lv] = v
- end
- end
-
- --刷新主界面装备图标红点
- function EquipModel:CheckMainIconRedDot( )
- local show = false
- for k,v in pairs(self.red_dot_info) do
- if v == true then
- show = v
- break
- end
- end
- GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 152, show)
-
- local tool_show = false
- for k,v in pairs(self.red_dot_info) do
- if k == EquipModel.MainTab.Draconic then--升品和刻印进装备工坊了
- if v == true then
- tool_show = v
- break
- end
- end
- end
- GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 154, tool_show)
- end
-
- --这样写红点 每次调全局的只要调两次
- function EquipModel:IsNeedRedAll( )
- self.red_dot_info[EquipModel.MainTab.Strengthen] = self:CheckStrengthenRedDot()
- self.red_dot_info[EquipModel.MainTab.RedEquip] = self:CheckRedEquipRedDot()
- self.red_dot_info[EquipModel.MainTab.Evolution] = self:CheckEvolutionRedDot()
- -- self.red_dot_info[EquipModel.MainTab.UpQuality] = self:CheckUpQualityRedDot()
- self.red_dot_info[EquipModel.MainTab.Inherit] = self:CheckInheritDot()
- -- self.red_dot_info[EquipModel.MainTab.Draconic] = self:CheckDraconicDot()
- self.red_dot_info[EquipModel.MainTab.Gemstone] = self:CheckGemstoneDot()
-
- self:CheckMainIconRedDot()
- end
-
- --红点刷新
- function EquipModel:IsNeedRed( tab_type,is_all,not_refresh_view,refresh_gem_suit )
- if not is_all then--全刷新就不判断等级了
- local can_refresh = self:CheckLevel(tab_type)
- if not can_refresh then return end
- end
-
- local bool = false
- if tab_type == EquipModel.MainTab.Strengthen then--精炼
- bool = self:CheckStrengthenRedDot()
- elseif tab_type == EquipModel.MainTab.Evolution then--升星
- bool = self:CheckEvolutionRedDot()
- elseif tab_type == EquipModel.MainTab.Inherit then--继承
- bool = self:CheckInheritDot()
- elseif tab_type == EquipModel.MainTab.UpQuality then--升品
- -- bool = self:CheckUpQualityRedDot()--转移到合成功能了
- ComposeModel:getInstance():IsNeedRed(ComposeModel.MainTab.Guard)--守护
- ComposeModel:getInstance():IsNeedRed(ComposeModel.MainTab.Ornaments)--饰品
- elseif tab_type == EquipModel.MainTab.RedEquip then--红装
- bool = self:CheckRedEquipRedDot()
- elseif tab_type == EquipModel.MainTab.Draconic then--刻印
- -- bool = self:CheckDraconicDot()
- elseif tab_type == EquipModel.MainTab.Gemstone then--宝石
- bool = self:CheckGemstoneDot(refresh_gem_suit)
- ComposeModel:getInstance():IsNeedRed(ComposeModel.MainTab.Gemstone)--宝石
- end
- self.red_dot_info[tab_type] = bool
- if not not_refresh_view then
- self:Fire(EquipModel.UPDATE_VIEW_RED,tab_type,bool)
- end
-
- if not is_all then
- self:CheckMainIconRedDot()
- end
- -- print("huangcong:EquipModel [222]: ",bool,tab_type)
- -- PrintTable(self.red_dot_info)
- end
-
- --检查等级
- function EquipModel:CheckLevel( tab_type )
- local level = RoleManager:getInstance():GetMainRoleVo().level
- if tab_type == EquipModel.MainTab.Strengthen and level >= Config.Modulesub["152@1"].open_lv then--精炼
- return true
- elseif tab_type == EquipModel.MainTab.Evolution and level >= Config.Modulesub["152@2"].open_lv then--升星
- return true
- elseif tab_type == EquipModel.MainTab.Inherit and level >= Config.Modulesub["152@3"].open_lv then--继承
- return true
- elseif tab_type == EquipModel.MainTab.UpQuality and level >= Config.Modulesub["152@4"].open_lv then--升品
- return true
- elseif tab_type == EquipModel.MainTab.RedEquip and level >= Config.Modulesub["154@1"].open_lv then--红装
- return true
- elseif tab_type == EquipModel.MainTab.Draconic and level >= Config.Modulesub["154@2"].open_lv then--刻印
- return true
- elseif tab_type == EquipModel.MainTab.Gemstone and level >= Config.Modulesub["152@7"].open_lv then--宝石
- return true
- end
- return false
- end
-
- --检查精炼红点
- function EquipModel:CheckStrengthenRedDot( )
- local have_red = false
- self:GetEquipCanStrength()--更新精炼数据
- for k,v in pairs(self.can_strength_info) do
- for kk,vv in pairs(v) do
- if vv then
- have_red = vv
- break
- end
- end
- end
- return have_red
- end
-
- --检查红装红点
- function EquipModel:CheckRedEquipRedDot( )
- if not GetModuleIsOpen(154,1) then return false end
- local boolRed = false
- self.red_dot_redEquip_info = {}
- -- 三个升级条件
- -- 升级至红色品质装备的条件是 当前装备已经是橙色装备
- local condition_2 = self:RedEquipCheckAllSeriesLv(3,1)-- 升级至粉色品质装备的条件是 前3代装备全部提升到红色
- local condition_3 = self:RedEquipCheckAllSeriesLv(4,2)-- 升级至彩色品质装备的条件是 前4代装备全部提升到粉色
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list or {}
- local lv = 0
- local info = nil
- for k,v in pairs(wear_equip_suit_list) do
- if not self.red_dot_redEquip_info[k] then
- self.red_dot_redEquip_info[k] = {}
- end
- for kk,vv in pairs(v) do
- lv = 0
- info = self:GetRedEquipInfo(k,kk)
- if info and info.lv then
- lv = info.lv
- end
- local item_cfg = self:GetRedEquipCfg(k,kk,lv + 1)--取的是下一级的配置
- if item_cfg and item_cfg.cost then
- if self.goods_model:GetEnough(item_cfg.cost) == true then--首先消耗材料满足再进入判断
- if item_cfg.condition and item_cfg.condition[1] == "equip_color" then--装备品质色
- if wear_equip_suit_list[k] and wear_equip_suit_list[k][kk] and wear_equip_suit_list[k][kk].color >= 4 then
- self.red_dot_redEquip_info[k][kk] = true
- boolRed = true
- end
- elseif item_cfg.condition and item_cfg.condition[1] == "all_series_lv" then--套件等级条件
- if item_cfg.condition[2] == 3 and condition_2 then--条件二
- self.red_dot_redEquip_info[k][kk] = true
- boolRed = true
- elseif item_cfg.condition[2] == 4 and condition_3 then--条件三
- self.red_dot_redEquip_info[k][kk] = true
- boolRed = true
- end
- end
- end
- end
- end
- end
-
- if not boolRed and GetModuleIsOpen(414) then
- boolRed = EmpowerModel:GetInstance():GetEmpowerRedDotList()[EmpowerConst.EmpowerViewType.EmpowerShop]
- end
- if not boolRed and GetModuleIsOpen(414) then
- local info = EmpowerModel:GetInstance().grid_game_info
- boolRed = info and info.free_count > 0 or false
- end
- -- print("huangcong:EquipModel [start:448] :", self.red_dot_redEquip_info)
- -- PrintTable(self.red_dot_redEquip_info)
- -- print("huangcong:EquipModel [end]")
- return boolRed
- end
-
- function EquipModel:GetRedEquipRedDot()
- return self.red_dot_redEquip_info
- end
- --获得红装红点通过suit和equiptype
- function EquipModel:GetRedEquipRedDotBySuitAndEquipType(suit,equip_type)
- if self.red_dot_redEquip_info[suit] then
- return self.red_dot_redEquip_info[suit][equip_type]
- end
- return false
- end
-
- --补齐列表为显示等级0
- function EquipModel:SetRedEquipPosList(vo)
- local list = vo
- for k1,v1 in pairs(self.EmpowerEquipTransId) do
- local isHave = false
- for k,v in pairs(vo) do
- if v.pos == v1 then
- isHave = true
- end
- end
- if isHave == false then
- local subList = {}
- subList.pos = v1
- subList.power_lv = 0
- table.insert(list, subList)
- end
- end
- self.equip_red_equip_pos_list = list
- end
-
- function EquipModel:GetRedEquipPosList()
- return self.equip_red_equip_pos_list
- end
-
- --装备位置信息
- function EquipModel:SetEquipPosInfoList(list)
- if not list then return end
- self.equip_pos_info = {}
- for i,v in ipairs(list) do
- local carve_list = {}
- for ii,vv in ipairs(v.carve_list) do
- carve_list[vv.goods_id] = vv
- end
- v.carve_list = carve_list
- self.equip_pos_info[v.pos] = v
- end
- end
-
- function EquipModel:GetEquipPosInfoList(pos)
- return self.equip_pos_info[pos]
- end
-
- function EquipModel:IsExistEmpowerPosAndLvReturnCost(series,pos,getLv)
- local cfg = self:GetRedEquipCfg(series,pos,getLv)
- if cfg then
- return true,cfg.cost
- end
- return false
- end
- --获取最高阶的每一件装备
- function EquipModel:GetMaxEquipList( )
- local need_list = {}
- local compare_list = {}
- local maxLen = NewMainRoleModel:getInstance():GetRoleReinMaxTurn()
- for k1,v1 in pairs(self.goods_model.wear_equip_suit_list) do
- for k,v in pairs(v1) do
- if compare_list[v.equip_suit_type] then
- if compare_list[v.equip_suit_type] < v.cell then
- compare_list[v.equip_suit_type] = v.cell
- need_list[v.equip_suit_type] = v
- end
- else
- compare_list[v.equip_suit_type] = v.cell
- need_list[v.equip_suit_type] = v
- end
- end
- end
- return need_list
- end
-
- --检查升品的红点
- function EquipModel:CheckUpQualityRedDot( )
- local have_red = false
- for k,v in pairs(self.can_up_quality_info) do
- for kk,vv in pairs(v) do
- if vv then
- have_red = vv
- break
- end
- end
- end
- return have_red
- end
-
- --检查继承红点
- function EquipModel:CheckInheritDot( )
- local bag_goods_list = self.goods_model.bag_goods_list
- for k,v in pairs(bag_goods_list) do
- local goods_vo = v
- if goods_vo and goods_vo.type == GoodsModel.TYPE.EQUIP and goods_vo.goods_num > 0 then
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- if equip_cfg and equip_cfg.series ~= 99 then
- --当前同等位置穿戴的装备数据
- local cur_wear_data = nil
- local can_inherit = false
- if self.goods_model.wear_equip_suit_list[equip_cfg.series]
- and self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- then
- cur_wear_data = self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- local cur_wear_strength_level = 0--当前装备精炼等级
- local cur_wear_evoblution_level = 0--当前升星等级
- for k,v in pairs(cur_wear_data.other_data) do
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- cur_wear_strength_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipEvoLevel and equip_cfg.equip_type < EquipModel.EquipType.Necklace then
- cur_wear_evoblution_level = tonumber(v.info)
- end
- end
-
- --品质小于当前的装备并且是紫色装备或以上
- --当前穿戴的装备升星和精炼都是0才给红点
- local goods_strength_level = 0
- local goods_evolution_level = 0
- if goods_vo.color > 2 and goods_vo.color < cur_wear_data.color
- and cur_wear_evoblution_level < 3 and cur_wear_strength_level == 0 then
- for k,v in pairs(goods_vo.other_data) do
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- goods_strength_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipEvoLevel and equip_cfg.equip_type < EquipModel.EquipType.Necklace then
- goods_evolution_level = tonumber(v.info)
- end
- end
- --非首饰可以继承升星
- if equip_cfg.equip_type < EquipModel.EquipType.Necklace then
- --当前装备高级属性必须大于1
- if goods_evolution_level > 1 then
- return true
- end
- --当前装备精炼等级必须大于1
- if goods_strength_level > 0 then
- return true
- end
- --首饰只能继承精炼等级
- elseif equip_cfg.equip_type >= EquipModel.EquipType.Necklace and equip_cfg.equip_type <= EquipModel.EquipType.RightRing then
- if goods_strength_level > 0 then
- return true
- end
- end
- end
- end
- end
- end
- end
- return false
- end
-
- --检查升星红点
- function EquipModel:CheckEvolutionRedDot( )
- local have_red = false
- self:GetEquipCanEvolution()--更新升星数据
- local anim_percent = 95
- local life_skill_active = PetModel:getInstance():IsLifeSkillActived(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local life_skill_ratio = PetModel:getInstance():GetPetLifeSkillRatio(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local vip_card_ratio = VipModel.getInstance():VipCardEquipEvolutionRatio(true)
- local add_life_skill_ratio = 0
- if life_skill_active then
- add_life_skill_ratio = life_skill_ratio
- end
- anim_percent = anim_percent - add_life_skill_ratio - vip_card_ratio---目标升星概率需要减去宠物和月卡加成的
- for k,v in pairs(self.can_evolution_info) do
- for kk,vv in pairs(v) do
- local evolution_level = self:GetEquipEvolutionLevel(vv.goods_vo) + 1--当前装备升星等级
- if vv.radio and vv.cost_enoght and (not vv.is_faker or vv.is_faker and not self.no_show_faker_evo) then--强红点/弱红点
- if vv.radio >= anim_percent then
- have_red = true
- break
- elseif self.bag_evoluton_radio_list[k] and self.bag_evoluton_radio_list[k][evolution_level]
- and self.bag_evoluton_radio_list[k][evolution_level]/100 + vv.radio >= anim_percent then
- have_red = true
- break
- end
- end
- end
- end
- if not have_red then
- have_red = self:GetCurHaveStarRedDot()
- end
- return have_red
- end
-
- function EquipModel:CheckEvolutionStrengthStarRedDot( )
- local have_red = self:GetCurHaveStarRedDot()
- return have_red
- end
-
- --得到升星套件标签红点
- function EquipModel:GetEvolutionSuitTabRedInfo( )
- local info = {}
- if self.can_evolution_info then
- local anim_percent = 95
- local life_skill_active = PetModel:getInstance():IsLifeSkillActived(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local life_skill_ratio = PetModel:getInstance():GetPetLifeSkillRatio(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local vip_card_ratio = VipModel.getInstance():VipCardEquipEvolutionRatio(true)
- local add_life_skill_ratio = 0
- if life_skill_active then
- add_life_skill_ratio = life_skill_ratio
- end
- anim_percent = anim_percent - add_life_skill_ratio - vip_card_ratio---目标升星概率需要减去宠物和月卡加成的
- for k,v in pairs(self.can_evolution_info) do
- for kk,vv in pairs(v) do
- local evolution_level = self:GetEquipEvolutionLevel(vv.goods_vo) + 1--当前装备升星等级
- if vv.radio and vv.cost_enoght and (not vv.is_faker or vv.is_faker and not self.no_show_faker_evo) then
- if vv.radio >= anim_percent then
- info[k] = true
- break
- elseif self.bag_evoluton_radio_list[k] and self.bag_evoluton_radio_list[k][evolution_level]
- and self.bag_evoluton_radio_list[k][evolution_level]/100 + vv.radio >= anim_percent then
- info[k] = true
- break
- end
- end
- end
- end
- end
- return info
- end
-
- --检查刻印红点
- function EquipModel:CheckDraconicDot( )
- return false
- end
-
- --[检查宝石红点主界面]
- function EquipModel:CheckGemstoneDot( refresh_gem_suit )
- local show = false
- if not refresh_gem_suit then
- local bag_goods_list = self.goods_model.bag_goods_list
- local server_info = self:GetGemstoneSeriesInfo()--宝石镶嵌信息
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- local equip_gemsstone_red_list = {}--装备宝石红点列表
- --背包中所有装备套件的宝石红点列表
- if server_info and bag_goods_list and wear_equip_suit_list then
- local bag_gem_list = {}
- local wear_gem_list = {}
- for k,v in pairs(bag_goods_list) do
- if v.type == 1 and v.subtype == 23 and v.pos == 2 and v.goods_num >= 1 then--宝石类
- local cfg = Config.Equipmentgems[v.type_id]
- if cfg then
- bag_gem_list[#bag_gem_list + 1] = cfg
- end
- end
- end
-
- if #bag_gem_list > 0 then--背包中有宝石
- --先判断没有宝石装满的情况
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- if kk ~= EquipModel.EquipType.Guard then
- if not equip_gemsstone_red_list[k] then
- equip_gemsstone_red_list[k] = {}
- end
- if not equip_gemsstone_red_list[k][kk] then
- if not server_info[k] or not server_info[k][kk] then--有装备却没有宝石数据直接为true
- equip_gemsstone_red_list[k][kk] = true
- show = true
- elseif TableSize(server_info[k][kk]) < 3 then--有装备却宝石没有装满直接为true
- for i=1,3 do--确定是那种类型的宝石没有
- if not server_info[k][kk][i] and not equip_gemsstone_red_list[k][kk] then
- for kkk,vvv in pairs(bag_gem_list) do
- if vvv.type == i then
- equip_gemsstone_red_list[k][kk] = true
- show = true
- break
- end
- end
- end
- end
- end
- end
- end
- end
- end
-
- if not show then--先给镶嵌红点 再给其他的红点
- --如果宝石装满了返回宝石等级高的
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- if kk ~= EquipModel.EquipType.Guard then
- if not equip_gemsstone_red_list[k][kk] then
- for kkk,vvv in pairs(server_info[k][kk]) do
- for kkkk,vvvv in pairs(bag_gem_list) do
- if vvvv.type == vvv.type and vvvv.lv > vvv.lv then
- equip_gemsstone_red_list[k][kk] = true
- show = true
- break
- end
- end
- if self:CheckGemstoneViewDot(vvv.goods_id) then
- equip_gemsstone_red_list[k][kk] = true
- show = true
- end
- end
- end
- end
- end
- end
- end
- --如果可以升级也需要添加红点
-
- end
- end
- self.equip_gemsstone_red_list = equip_gemsstone_red_list
- end
-
- for k,v in pairs(self.equip_gemsstone_red_list) do
- if show then break end
- for kk,vv in pairs(v) do
- if vv then
- show = true
- break
- end
- end
- end
-
- local suit_show = self:CheckGemstoneSeriesRedDot()
- if not show then--如果还没有红点就检查宝石套装的红点
- show = suit_show
- end
- return show
- end
-
- --检查装备宝石是否有红点
- function EquipModel:CheckGemstoneViewDot( type_id )
- local show = false
- local bag_goods_list = self.goods_model.bag_goods_list
- --背包中所有装备套件的宝石红点列表
- if bag_goods_list and type_id then
- local bag_gem_list = {}
- for k,v in pairs(bag_goods_list) do
- if v.type == 1 and v.subtype == 23 and v.pos == 2 and v.goods_num >= 1 then--宝石类
- local cfg = Config.Equipmentgems[v.type_id]
- if cfg then
- bag_gem_list[#bag_gem_list + 1] = cfg
- end
- end
- end
- if #bag_gem_list > 0 then--背包中有宝石
- --先判断有没有比他高级的宝石
- local cfg = Config.Equipmentgems[type_id]
- if cfg then
- for k,v in pairs(bag_gem_list) do
- if v.type == cfg.type and v.lv > cfg.lv then
- show = true
- break
- end
- end
- else
- print("huangcong:EquipModel [start:778]宝石配置不存在 :", type_id)
- end
- --判断是否能升级
- if not show then
- show = self:CheckGemstoneCanLevel(type_id)
- end
- end
- end
- return show
- end
-
- --检查宝石是否能升级
- function EquipModel:CheckGemstoneCanLevel( type_id )
- if not type_id then return false end
- local show = false
- --寻找接下来能合成宝石的情况从高到低
-
- local num = self.goods_model:GetTypeGoodsNum(type_id)
- local gem_type = Config.Equipmentgems[type_id].type
- local gem_cur_lv = Config.Equipmentgems[type_id].lv
- if gem_cur_lv >= EquipModel.GemstoneMaxLevel then return false end
- --递归方法
- local function findGemstoneCanLevel( gem_cur_lv,need_num )
- if gem_cur_lv <= 1 then return false end
- local show = false
- local need_last_gems_num = need_num
- local last_cfg = self.equipment_gems_lv_cfg[gem_type][gem_cur_lv - 1]
- if last_cfg then
- local last_gems_num = self.goods_model:GetTypeGoodsNum(last_cfg.goods_id)
- if last_gems_num >= need_last_gems_num then
- show = true
- else
- show = findGemstoneCanLevel(gem_cur_lv - 1,(need_num - last_gems_num)*3)
- end
- end
- return show
- end
-
- --先判断同等级的是否数量大于2
- if num >= 2 then
- show = true
- --没有的话去寻找下一个等级的宝石看能不能凑齐2个同等级的
- elseif gem_cur_lv > 1 then
- local offer_num = 2 - num
- local need_last_gems_num = offer_num*3
- local last_cfg = self.equipment_gems_lv_cfg[gem_type][gem_cur_lv - 1]
- if last_cfg then
- local last_gems_num = self.goods_model:GetTypeGoodsNum(last_cfg.goods_id)
- if last_gems_num >= need_last_gems_num then
- show = true
- end
- end
- if not show then
- show = findGemstoneCanLevel(gem_cur_lv,need_last_gems_num)
- end
- end
- return show
- end
-
- --检查宝石是否替换
- function EquipModel:CheckGemstoneCanReplace( type_id )
- local show = false
- local bag_goods_list = self.goods_model.bag_goods_list
- --背包中所有装备套件的宝石红点列表
- if bag_goods_list and type_id then
- local bag_gem_list = {}
- for k,v in pairs(bag_goods_list) do
- if v.type == 1 and v.subtype == 23 and v.pos == 2 and v.goods_num >= 1 then--宝石类
- local cfg = Config.Equipmentgems[v.type_id]
- if cfg then
- bag_gem_list[#bag_gem_list + 1] = cfg
- end
- end
- end
- if #bag_gem_list > 0 then--背包中有宝石
- --先判断有没有比他高级的宝石
- local cfg = Config.Equipmentgems[type_id]
- if cfg then
- for k,v in pairs(bag_gem_list) do
- if v.type == cfg.type and v.lv > cfg.lv then
- show = true
- break
- end
- end
- else
- print("huangcong:EquipModel [start:778]宝石配置不存在 :", type_id)
- end
- end
- end
- return show
- end
-
- --是否是玩家背包中的装备物品
- function EquipModel:IsInEquipList(goods_id)--物品唯一ID
- local is_bag = true
- for k,v in pairs(self.goods_model.wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- if vv.goods_id == goods_id then
- is_bag = false
- break
- end
- end
- end
- return is_bag
- end
-
- --是否是穿戴装备
- function EquipModel:IsWearEquip( goods_id )
- local wear_equip = self.goods_model.wear_equip_dic[goods_id] --传进来的物品id不是已穿戴列表中的
- wear_equip = wear_equip or MateModel:GetInstance():GetIsMateShipByTypeId(goods_id)--羁绊信物默认穿戴中
- return wear_equip and true or false
- end
-
- --判断是否需要显示装备对比tips
- function EquipModel:ShowCompareTips(type_id, goods_id)
- local show = false
- local have_equip_data = nil
- local wear_equip = self.goods_model.wear_equip_dic[goods_id] --传进来的物品id不是已穿戴列表中的
- if wear_equip == nil then
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg and equip_cfg.equip_type ~= EquipModel.EquipType.Guard then
- local equip_series_list = self.goods_model.wear_equip_suit_list[equip_cfg.series] --在已穿戴列表中能找到与传进来的类型相同的装备
- if equip_series_list and equip_series_list[equip_cfg.equip_type] then
- show = true
- have_equip_data = equip_series_list[equip_cfg.equip_type]
- end
- else
- if self.cur_choose_suit ~= nil then
- local equip_series_list = self.goods_model.wear_equip_suit_list[self.cur_choose_suit]
- if equip_series_list and equip_series_list[equip_cfg.equip_type] then
- show = true
- have_equip_data = equip_series_list[equip_cfg.equip_type]
- end
- end
- end
- end
- return show, have_equip_data
- end
-
- function EquipModel:InitEquipmentCfg( )
- if TableSize(self.equipment_cfg) == 0 then
- local equipment_cfg_list = DeepCopy(Config.Equipment)
- for k,v in pairs(equipment_cfg_list) do
- v.career = stringtotable(v.career)
- v.base_attr = stringtotable(v.base_attr)
- v.great_attr_list = stringtotable(v.great_attr_list)
- v.attr_show = stringtotable(v.attr_show)
- v.skill = stringtotable(v.skill)
- v.suit = stringtotable(v.suit)
- v.evolution_offer_ratio = stringtotable(v.evolution_offer_ratio)
- self.equipment_cfg[v.goods_id] = v
- end
- end
- end
-
- --获得装备基本信息配置
- function EquipModel:GetEquipmentCfg( goods_id )
- self:InitEquipmentCfg()
- if self.equipment_cfg[goods_id] then
- return self.equipment_cfg[goods_id]
- else
- local is_mate = MateModel:GetInstance():GetIsMateShipByTypeId( goods_id )
- if is_mate then
- --羁绊信物的数据
- local goods_basic = self.goods_model:GetGoodsBasicByTypeId( goods_id )
- local model_save_temp_mate = self.mate_show_tool_tip_data
- if model_save_temp_mate then
- my_mate_conf = MateModel:GetInstance():GetShipConf(model_save_temp_mate.stage,model_save_temp_mate.star)
- else
- my_mate_conf = MateModel:GetInstance():GetCurShipConf()
- end
- if goods_basic and my_mate_conf then
- local data = {goods_id = goods_id}
- data.base_attr = stringtotable(my_mate_conf.attr)
- data.name = my_mate_conf.name
- data.series = 99
- data.color = goods_basic.color
- data.career = {[1] = 1,[2] = 2,[3] = 3,[4] = 4}
- data.equip_type = 12
- return data
- end
- end
- -- print("没有装备配置哦!", goods_id)
- end
- end
-
- --获得装备套件配置
- function EquipModel:GetEquipmentSuitCfg( series,type )--1装备2首饰
- if TableSize(self.equipment_suit_cfg) == 0 then
- local equipment_suit_cfg_list = DeepCopy(Config.Equipmentsuit)
- for k,v in pairs(equipment_suit_cfg_list) do
- v.stage_attr = stringtotable(v.stage_attr)
- v.attr = stringtotable(v.attr)
- v.suit_equip = stringtotable(v.suit_equip)
- if not self.equipment_suit_cfg[v.series] then
- self.equipment_suit_cfg[v.series] = {}
- end
- if not self.equipment_suit_cfg[v.series][v.type] then
- self.equipment_suit_cfg[v.series][v.type] = {}
- end
- self.equipment_suit_cfg[v.series][v.type][#self.equipment_suit_cfg[v.series][v.type] + 1] = v
- end
- local sort_func = function ( a, b )
- return a.suit_num < b.suit_num
- end
- for series,v in pairs(self.equipment_suit_cfg) do
- for type,vv in pairs(v) do
- table.sort(vv, sort_func)
- end
- for type,vv in pairs(v) do
- local suit_num_max = vv[#vv] and vv[#vv].suit_num
- for k,vvv in ipairs(vv) do
- vvv.suit_num_max = suit_num_max
- end
- end
- end
- end
-
- if self.equipment_suit_cfg[series] and self.equipment_suit_cfg[series][type] then
- return self.equipment_suit_cfg[series][type]
- else
- print("没有该套件信息哦", series,type)
- end
- end
-
- --获得装备高级属性配置
- function EquipModel:GetEquipmentGreatAttrCfg( attr_id )
- local data = Config.Equipmentgreatattr[attr_id]
- if data then
- data = DeepCopy(data)
- data.attr = stringtotable(data.attr)
- return data
- else
- print("没有该高级属性条目哦", attr_id)
- end
- end
-
- --获得装备属性评分power可能是查看他人战力
- function EquipModel:GetEquipAttrRatingCfg( attr_id,attr_value,power )
- if self.equipment_attr_rating_cfg[attr_id] and attr_id and attr_value then
- local fight = power or RoleManager.Instance.mainRoleInfo.fighting
- for k,v in pairs(self.equipment_attr_rating_cfg[attr_id]) do
- if v.min_power <= fight and fight <= v.max_power then
- return attr_value*v.rating
- end
- end
- else
- print('没有该属性的评分哦,不是特殊属性吧!', attr_id,attr_value)
- end
- end
-
- --获得装备精炼属性的配置
- function EquipModel:GetEquipStrengthAttrCfg( type_id,lv )
- if not type_id or not lv then return end
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg then
- local series = equip_cfg.series
- local equip_type = equip_cfg.equip_type
- local key = series.."@"..equip_type.."@"..lv
- if Config.Equipmentstrength[key] then
- local data = DeepCopy(Config.Equipmentstrength[key])
- data.attr = stringtotable(data.attr)
- data.cost = stringtotable(data.cost)
- return data
- end
- else
- print('没有精炼属性的装备哦!', type_id,lv)
- end
- end
-
- --获得装备精炼当前套装最大精炼等级
- function EquipModel:GetEquipStrengSuitMaxLevel( series )
- local max_level = 0
- for k,v in pairs(Config.Equipmentstrengthtotal) do
- if v.series == series then
- max_level = max_level < v.lv and v.lv or max_level
- end
- end
- return max_level
- end
-
- --获得升星属性的配置
- function EquipModel:GetEquipEvolutionCfg( type_id,lv )
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg then
- local series = equip_cfg.series
- local equip_type = equip_cfg.equip_type
- local key = series.."@"..equip_type.."@"..lv
- local cfg = Config.Equipmentgreat[key]
- if cfg then
- cfg = DeepCopy(cfg)
- cfg.attr = stringtotable(cfg.attr)
- cfg.cost = stringtotable(cfg.cost)
- cfg.great_attr = stringtotable(cfg.great_attr)
- cfg.great_attr_list = stringtotable(cfg.great_attr_list)
- return cfg
- end
- else
- -- print('没有配置的装备哦!', type_id,lv)
- end
- end
-
- --获得装备提供升星概率的配置
- function EquipModel:GetEquipEvolutionRatioCfg( type_id,target_series,target_lv )
- if not type_id then return end
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg and equip_cfg.equip_type <= EquipModel.EquipType.Shoes then
- local goods_basic = self.goods_model:GetGoodsBasicByTypeId(type_id)
- if goods_basic and goods_basic.color >= 3 then
- local color = goods_basic.color
- local series = equip_cfg.series
- if target_series and target_lv then
- local key_value = string.format("%s@%s@%s@%s",series,color,target_series,target_lv)
- if Config.Equipmentgreatratio[key_value] then
- return Config.Equipmentgreatratio[key_value]
- else
- print('没有升星属性概率的装备哦!', type_id,target_series,target_lv)
- end
- elseif not target_series then
- if not self.equipment_evolution_ratio_cfg then--没找到初始化一次配置表
- self:InitEquipEvolutionRatioCfg()
- end
- if self.equipment_evolution_ratio_cfg[color][series] and self.equipment_evolution_ratio_cfg[color][series] then
- return self.equipment_evolution_ratio_cfg[color][series]
- else
- print('没有升星属性概率的装备哦!', type_id,target_series,target_lv)
- end
- end
- end
- else--不是装备
- -- print('没有配置的装备哦!', type_id,lv)
- end
- end
-
- --获得装备的所有高级属性Id列表
- function EquipModel:GetEquipZhuoYueAttrIdList( type_id )
- local equip_cfg = self:GetEquipmentCfg(type_id)
- local attr_list = {}
- if equip_cfg then
- if equip_cfg.equip_type >= EquipModel.EquipType.Necklace then--首饰拿这些
- for k,v in ipairs(equip_cfg.great_attr_list) do
- attr_list[#attr_list + 1] = v
- end
- else
- local attr_cfg_list = {}
- for k,v in pairs(Config.Equipmentgreat) do
- if v.series == equip_cfg.series and v.equip_type == equip_cfg.equip_type then
- local data = DeepCopy(v)
- data.attr = stringtotable(data.attr)
- attr_cfg_list[#attr_cfg_list + 1] = data
- end
- end
- local sort_func = function ( a, b )
- return a.up_num < b.up_num
- end
- table.sort(attr_cfg_list, sort_func)
- for k,v in ipairs(attr_cfg_list) do
- attr_list[#attr_list + 1] = v.attr[1]
- end
- end
- end
- return attr_list
- end
-
- --获得升星最大等级
- function EquipModel:GetEvoMaxLevel( type_id )
- local equip_cfg = self:GetEquipmentCfg(type_id)
- local max_star_level = 0
- if equip_cfg then
- if equip_cfg.equip_type >= EquipModel.EquipType.Necklace then--首饰拿这些
- max_star_level = #equip_cfg.great_attr_list
- else
- for k,v in pairs(Config.Equipmentgreat) do
- if v.series == equip_cfg.series and v.equip_type == equip_cfg.equip_type then
- max_star_level = max_star_level + 1
- end
- end
- end
- end
- return max_star_level
- end
-
- --判断是否是特殊装备属性评分
- function EquipModel:GetIsEquipAttrRating( attr_id )
- if self.equipment_attr_rating_cfg[attr_id] and attr_id then
- return true
- end
- return false
- end
-
- --计算装备评分
- --is_bag背包里面要计算精炼等级带来的评分
- function EquipModel:MathEquipScore( goods_vo,goods_id,power )
- local attr_info = {}
- local empower_lv = 0
- local equip_score = 0--评分
- local haved_power = false--是否是已有战力
- local equip_cfg = self:GetEquipmentCfg(goods_id)
-
- if goods_vo and goods_vo.power and goods_vo.power~=nil and goods_vo.power ~= "" then
- power = tonumber(goods_vo.power)
- end
- power = power ~= nil and power > 0 and power or RoleManager.Instance.mainRoleInfo.fighting
-
- -- print("huangcong:EquipModel [start:1254] :", power)
- --基础属性
- if equip_cfg and equip_cfg.base_attr and TableSize(equip_cfg.base_attr) ~= 0 then
- for k,v in pairs(equip_cfg.base_attr) do
- attr_info[#attr_info + 1] = v
- end
- end
- -- print("huangcong:EquipModel [start:243] attr_info:", attr_info)
- -- PrintTable(attr_info)
- -- print("huangcong:EquipModel [end]")
-
- --高级属性
- local zhuoyue_attr = {}
- --精炼等级
- local strengthen_level = 0
- local star_evolution_lv = equip_cfg.color >= 3 and 1 or 0--星级升星属性等级
- if goods_vo then
- haved_power = goods_vo.pos == 1
- for k,v in pairs(goods_vo.other_data or {}) do
- if v.type == GoodsModel.GoodsInfoType.EquipEvoLevel and equip_cfg.equip_type < EquipModel.EquipType.Necklace then--非首饰读特殊属性
- star_evolution_lv = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- strengthen_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipEmpower then--赋能等级
- empower_lv = tonumber(v.info)
- end
- end
-
- if haved_power then
- local server_info = self:GetRedEquipInfo(equip_cfg.series,equip_cfg.equip_type)
- if server_info then
- empower_lv = server_info and server_info.lv or 0
- if goods_vo.empower_lv then
- empower_lv = goods_vo.empower_lv
- end
- end
- end
-
- if empower_lv and empower_lv > 0 then
- local empower_cfg = self:GetRedEquipCfg(equip_cfg.series,equip_cfg.equip_type,empower_lv)--基础属性
- if empower_cfg and empower_cfg.attr then
- for k,v in pairs(empower_cfg.attr) do
- attr_info[#attr_info + 1] = v
- end
- end
- end
-
- --获得精炼属性
- if strengthen_level ~= 0 then
- local strength_level_cfg = self:GetEquipStrengthAttrCfg(goods_id,strengthen_level)
- if strength_level_cfg and strength_level_cfg.attr then
- for k,v in pairs(strength_level_cfg.attr) do
- attr_info[#attr_info + 1] = v
- end
- end
- end
- -- print("huangcong:EquipModel [start:278] attr_info:", attr_info,strengthen_level)
- -- PrintTable(attr_info)
- -- print("huangcong:EquipModel [end]")
-
- local sort_func = function ( a, b )
- if a.type ~= b.type then
- return a.type > b.type
- else
- return a.id > b.id
- end
- end
- table.sort(zhuoyue_attr, sort_func)
- end
-
- if equip_cfg.equip_type >= EquipModel.EquipType.Necklace then--首饰展示预览升星属性
- for k,attr_cfg in pairs(equip_cfg.great_attr_list or {}) do
- zhuoyue_attr[#zhuoyue_attr + 1] = {[1] = attr_cfg}
- end
- else
- local equip_evo_cfg = self:GetEquipEvolutionCfg(equip_cfg.goods_id,star_evolution_lv)
- if equip_evo_cfg and equip_evo_cfg.great_attr_list then
- for i,attr_cfg in ipairs(equip_evo_cfg.great_attr_list) do
- zhuoyue_attr[#zhuoyue_attr + 1] = {[1] = attr_cfg}
- end
- end
- end
-
- if zhuoyue_attr and TableSize(zhuoyue_attr) ~= 0 then
- for k,v in pairs(zhuoyue_attr) do
- attr_info[#attr_info + 1] = v[1]
- end
- end
-
- --获得总属性列表了!
- for k,v in pairs(attr_info) do
- if self:GetIsEquipAttrRating(v[1]) then
- equip_score = equip_score + self:GetEquipAttrRatingCfg(v[1],v[2],power)
- else
- equip_score = equip_score + GetPropOneAddNum(v[1])*v[2]
- end
- end
- return math.floor(equip_score)
- end
-
- --获得装备awarditem具体数据
- function EquipModel:GetBagEquipAwaraItemInfo( goods_vo )
- local attr_info = {}
- local strengthen_level = 0--精炼等级
- local star = 0--卓越星级
- local evolution_level = 0
- local star_color = 1
- if goods_vo then
- --高级属性
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- --精炼等级
- if equip_cfg then
- evolution_level = equip_cfg.color >= 3 and 1 or 0
- for k,v in pairs(goods_vo.other_data or {}) do
- if v.type == GoodsModel.GoodsInfoType.EquipEvoLevel then--高级属性
- evolution_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipmentLv then--精炼等级
- strengthen_level = tonumber(v.info)
- end
- end
- if equip_cfg and equip_cfg.equip_type >= EquipModel.EquipType.Necklace then
- evolution_level = #equip_cfg.great_attr_list
- for k,v in pairs(equip_cfg.great_attr_list) do
- if v[3] then
- star_color = star_color < v[3] and v[3] or star_color
- end
- end
- else
- local equip_evo_cfg = self:GetEquipEvolutionCfg(goods_vo.type_id,evolution_level)
- if equip_evo_cfg and equip_evo_cfg.great_attr_list then
- for k,v in pairs(equip_evo_cfg.great_attr_list) do
- if v[3] then
- star_color = star_color < v[3] and v[3] or star_color
- end
- end
- end
- end
- end
- star = evolution_level
- end
- local data = {}
- data.star_color = star_color
- data.star = star
- data.evolution_level = evolution_level
- data.strengthen_level = strengthen_level
- data.goods_vo = goods_vo
- -- print("huangcong:EquipModel [start:363] data:", data)
- -- PrintTable(data)
- -- print("huangcong:EquipModel [end]")
- return data
- end
-
- --获得当前的套件激活信息
- function EquipModel:GetCurSuitInfo( equip_list,tab_id )
- -- local turn = RoleManager:getInstance():GetMainRoleVo().turn--暂时取消限制
- local cur_wear_equip_list = equip_list or self.goods_model.wear_equip_suit_list
- local suit_info = {}
- for k,v in pairs(cur_wear_equip_list) do
- if not tab_id then
- suit_info[k] = TableSize(v) / 11
- elseif tab_id == EquipModel.MainTab.Evolution then
- local len = 0
- if TableSize(v) > 0 then
- for equip_type,vv in pairs(v) do
- if equip_type < EquipModel.EquipType.Necklace then
- len = len + 1
- end
- end
- suit_info[k] = len / 7
- end
- end
- end
- return suit_info
- end
-
- --获得当前套件装备是否可以精炼
- --只能说装备是真的要遍历很多东西最好把数据保存起来
- function EquipModel:GetEquipCanStrength( )
- --是否能精炼
- local can_strength_info = {}
- --首饰类是否能升品
- local can_up_quality_info = {}
- local necklace_up_info = {}
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- local equip_star_sum = 0
-
- -- print("huangcong:EquipModel [start:1363] :", wear_equip_suit_list)
- -- PrintTable(wear_equip_suit_list)
- -- print("huangcong:EquipModel [end]")
-
- if wear_equip_suit_list then
- --能否精炼列表
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- local strengthen_level = 0--当前装备等级
- for kkk,vvv in pairs(vv.other_data or {}) do
- if vvv.type == GoodsModel.GoodsInfoType.EquipmentLv then
- strengthen_level = tonumber(vvv.info)
- elseif vvv.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- equip_star_sum = tonumber(vvv.info) + equip_star_sum
- end
- end
- local base_cfg = self:GetEquipStrengthAttrCfg(vv.type_id,strengthen_level + 1)
- if base_cfg then
- local cost_list = {}
- for kkk,vvv in ipairs(base_cfg.cost) do
- local num = self.goods_model:GetTypeGoodsNum(vvv[2]) or 0
- cost_list[kkk] = {num,vvv[2],vvv[3]}
- end
- local can_strength = self:CanStrength(cost_list)
- if not can_strength_info[k] then
- can_strength_info[k] = {}
- end
- can_strength_info[k][vv.equip_suit_type] = can_strength
- end
-
- --判断首饰类才能升品--这里是拿已穿戴的
- if vv.equip_suit_type >= EquipModel.EquipType.Necklace then
- local equip_cfg = self:GetEquipmentCfg(vv.type_id)
- if equip_cfg and equip_cfg.equip_type and vv.goods_num > 0 then
- equip_star_sum = #equip_cfg.great_attr_list + equip_star_sum
- end
- local compose_cfg = ComposeModel:getInstance():GetEvolutionComposeCfg(vv.type_id)
- local limit_level = compose_cfg and compose_cfg.open_lv or 0
- local cost_list = RoleManager.Instance.mainRoleInfo.level >= limit_level and compose_cfg and compose_cfg.cost_goods or {}
- if cost_list and #cost_list > 0 then
- local can_up_quality = true
- for kkk,vvv in ipairs(cost_list) do
- local goods_num = self.goods_model:GetTypeGoodsNum(vvv[2]) or 0
- if goods_num < vvv[3] then
- can_up_quality = false
- end
- end
- if not can_up_quality_info[k] then
- can_up_quality_info[k] = {}
- end
- can_up_quality_info[k][vv.equip_suit_type] = {can_up = can_up_quality,type_id = vv.type_id}
-
- --这里是首饰的二次构造红点 因为要显示到具体的哪一个但是不需要知道哪一代
- if not necklace_up_info[vv.type_id] then
- necklace_up_info[vv.type_id] = can_up_quality
- end
- end
- end
- end
- end
- end
-
- --这里再判断一次首饰的红点
- local bag_goods_list = self.goods_model.bag_goods_list
- for k,v in pairs(bag_goods_list) do
- local equip_cfg = self:GetEquipmentCfg(v.type_id)
- if equip_cfg and equip_cfg.equip_type and equip_cfg.equip_type >= EquipModel.EquipType.Necklace and v.goods_num > 0 then
- local compose_cfg = ComposeModel:getInstance():GetEvolutionComposeCfg(v.type_id)
- local limit_level = compose_cfg and compose_cfg.open_lv or 0
- local cost_list = RoleManager.Instance.mainRoleInfo.level >= limit_level and compose_cfg and compose_cfg.cost_goods or {}
- local series = equip_cfg.series
- if cost_list and #cost_list > 0 then
- local can_up_quality = true
- for kkk,vvv in ipairs(cost_list) do
- local goods_num = self:EquipGoodsNumById(vvv[2]) or 0
- if goods_num < vvv[3] then
- can_up_quality = false
- end
- end
-
- --这里是首饰的二次构造红点 因为要显示到具体的哪一个但是不需要知道哪一代
- if not necklace_up_info[v.type_id] then
- necklace_up_info[v.type_id] = can_up_quality
- end
- end
- end
- end
-
- if self.equip_sum_stars ~= 0 and equip_star_sum > self.equip_sum_stars then--星级提升
- local tip_data = {}
- tip_data.id = EquipModel.MainTab.Evolution
- tip_data.star = equip_star_sum
- local strengthtotal_cfg = Config.Equipmentstartotal[equip_star_sum]
- if strengthtotal_cfg then
- strengthtotal_cfg = DeepCopy(strengthtotal_cfg)
- strengthtotal_cfg.stage_attr = stringtotable(strengthtotal_cfg.stage_attr)
- tip_data.attr = strengthtotal_cfg.stage_attr
- end
- print("huangcong:EquipModel [start:1457] :", tip_data)
- PrintTable(tip_data)
- print("huangcong:EquipModel [end]")
- if TableSize(tip_data.attr) <= 0 then
- tip_data.is_skill_select = true
- end
- self:Fire(EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW,tip_data)
- end
-
- self.equip_sum_stars = equip_star_sum
- self.can_strength_info = can_strength_info
- self.can_up_quality_info = can_up_quality_info
- self.necklace_up_info = necklace_up_info--首饰升品信息
- -- print("huangcong:EquipModel [start:1457] :", self.necklace_up_info)
- -- PrintTable(self.necklace_up_info)
- -- print("huangcong:EquipModel [end]")
- -- print("huangcong:EquipModel [start:832] :", self.can_strength_info)
- -- PrintTable(self.can_strength_info)
- -- print("huangcong:EquipModel [end]")
- end
-
- function EquipModel:GetEquipCanStrengthByPos( series,pos )
- -- PrintTable(self.can_strength_info)
- -- print("huangcong:EquipModel [end]")
- if self.can_strength_info[series] then
- return self.can_strength_info[series][pos]
- end
- return false
- end
-
- --获取身上穿戴的装备能升品
- function EquipModel:GetEquipCanUpQualityByPos( series,pos,type_id,cost_list )
- if not self.can_up_quality_info then return false end
- if series ~= 99 then
- if self.can_up_quality_info and self.can_up_quality_info[series] and self.can_up_quality_info[series][pos] then
- return self.can_up_quality_info[series][pos].can_up
- end
- else
- -- for k,v in pairs(self.can_up_quality_info) do
- -- for kk,vv in pairs(v) do
- -- if vv.type_id == type_id then
- -- return vv.can_up
- -- end
- -- end
- -- end
- local bool = self:GetBagEquipCanUpQualityByTypeId(type_id)
- if not bool and cost_list then
- for i,v in ipairs(cost_list) do
- bool = self:GetBagEquipCanUpQualityByTypeId(v[2])
- if bool then
- return true
- end
- end
- end
- end
-
- if not have_red and self.necklace_up_info and self.necklace_up_info[type_id] then
- return true
- end
-
- return false
- end
-
- --获取背包上穿戴的装备能升品
- function EquipModel:GetBagEquipCanUpQualityByTypeId( type_id )
- if not self.necklace_up_info then return false end
- return self.necklace_up_info[type_id] or false
- end
-
- --装备能否精炼顺便计算差多少钱
- function EquipModel:CanStrength( cost_list )
- if not cost_list then return end
- local can_strength = true
- local price = 0
- local offer_cost = {}--返回差多少材料
- for k,v in pairs(cost_list) do
- if v[1] < v[3] then
- can_strength = false
- local goods_price, sell_price, price_type = self.goods_model:GetGoodsPrice(v[2])
- price = (v[3] - v[1])*goods_price + price
- offer_cost[v[2]] = v[3] - v[1]
- end
- end
- return can_strength,price,offer_cost,price_type
- end
-
- --获得当前套件装备是否可以升星
- function EquipModel:GetEquipCanEvolution( )
- --升星红点列表
- local can_evolution_info = {}
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- local cur_suit = EquipModel.getInstance():GetCurrentOpenSuitSeries()
- if wear_equip_suit_list then
- --能否升星列表
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- --首饰类加上守护不做升星
- if vv.equip_suit_type <= EquipModel.EquipType.Shoes and vv.goods_num > 0 then
- local evolution_level = 0--当前装备升星等级
- for kkk,vvv in pairs(vv.other_data or {}) do
- if vvv.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- evolution_level = tonumber(vvv.info) or 0
- break
- end
- end
- evolution_level = evolution_level >= 1 and evolution_level or 1
- local base_cfg = self:GetEquipEvolutionCfg(vv.type_id,evolution_level + 1)
- if base_cfg and vv.color >= 3 then
- local cost_list = {}
- for kkk,vvv in ipairs(base_cfg.cost) do
- local num = self.goods_model:GetTypeGoodsNum(vvv[2]) or 0
- cost_list[kkk] = {num,vvv[2],vvv[3]}
- end
- local cost_enoght,price,offer_cost,price_type = self:CanStrength(cost_list,true)
- local is_enoght = cost_enoght
- local is_faker = false
- if not is_enoght then
- local cost_price_list = {}
- for i,v in ipairs(cost_list) do
- local goods_price, sell_price, price_type = self.goods_model:GetGoodsPrice(v[2])
- cost_price_list[price_type] = cost_price_list[price_type] or 0
- if v[3] - v[1] > 0 then
- cost_price_list[price_type] = goods_price*(v[3] - v[1])
- end
- end
- is_enoght = true
- is_faker = true
- for price_type,v in pairs(cost_price_list) do
- if price_type == 3 and RoleManager.Instance.mainRoleInfo.tong<v then--材料钱满足也行
- is_enoght = false
- is_faker = false
- elseif price_type == 1 and RoleManager.Instance.mainRoleInfo.jin<v then--材料钱满足也行
- is_enoght = false
- is_faker = false
- end
- end
- end
-
- if not can_evolution_info[k] then
- can_evolution_info[k] = {}
- end
- can_evolution_info[k][vv.equip_suit_type] = {radio = base_cfg.ratio/100 or 0,cost_enoght = is_enoght, goods_vo = vv, is_faker = is_faker}
- end
- end
- end
- end
- end
- local bag_goods_list = self.goods_model.bag_goods_list
- --背包中所有装备套件的概率加成列表
- local bag_evoluton_radio_list = {}
- for k,v in pairs(bag_goods_list) do
- if v.type == GoodsModel.TYPE.EQUIP and v.goods_num > 0 and self:SelfCareerIsOk(v.type_id) then
- local equip_cfg = self:GetEquipmentCfg(v.type_id)
- if self:SelfCareerIsOk(v.type_id)--职业相同
- and equip_cfg.series <= cur_suit--代数解锁
- and not self:EquipCanShowGoodsTip(v)--可操作
- then
- local equip_radio_cfg = self:GetEquipEvolutionRatioCfg(v.type_id)
- if equip_radio_cfg then
- for kk,vv in pairs(equip_radio_cfg) do
- for kkk,vvv in pairs(vv) do
- if not bag_evoluton_radio_list[kk] then
- bag_evoluton_radio_list[kk] = {}
- end
- if not bag_evoluton_radio_list[kk][vvv.target_lv] then
- bag_evoluton_radio_list[kk][vvv.target_lv] = 0
- end
- bag_evoluton_radio_list[kk][vvv.target_lv] = vvv.ratio + bag_evoluton_radio_list[kk][vvv.target_lv]
- end
- end
- end
- end
- end
- end
-
- -- print("huangcong:EquipModel [start:413] :", bag_evoluton_radio_list)
- -- PrintTable(bag_evoluton_radio_list)
- -- print("huangcong:EquipModel [end]")
- self.can_evolution_info = can_evolution_info
- self.bag_evoluton_radio_list = bag_evoluton_radio_list
- end
-
- --获得背包装备列表并按照套件排列
- --type_id是否需要当前的装备能升星的列表
- function EquipModel:GetBagEquipList( type_id,goods_vo )
- local bag_goods_list = self.goods_model.bag_goods_list
- local career = RoleManager.Instance.mainRoleInfo.career
- local equip_list = {}
- --升星的装备背包表
- local evolution_equip_list = {}
- local cur_suit = self:GetCurrentOpenSuitSeries()
- for k,v in pairs(bag_goods_list) do
- if v.type == GoodsModel.TYPE.EQUIP and v.goods_num > 0 then
- local equip_cfg = self:GetEquipmentCfg(v.type_id)
- --职业不符合
- local have_career = false
- for i,v in ipairs(equip_cfg.career) do
- if v == career then
- have_career = true
- break
- end
- end
- if equip_cfg and equip_cfg.equip_type <= EquipModel.EquipType.Shoes
- and have_career
- and equip_cfg.series <= cur_suit
- and not self:EquipCanShowGoodsTip(v) then
- local series = equip_cfg.series
- if not equip_list[equip_cfg.series] then
- equip_list[equip_cfg.series] = {}
- end
- equip_list[equip_cfg.series][#equip_list[equip_cfg.series] + 1] = v
- end
- end
- end
-
- -- print("huangcong:EquipModel [start:680] :", equip_list)
- -- PrintTable(equip_list)
- -- print("huangcong:EquipModel [end]")
-
- if type_id and goods_vo then
- local need_evolution_equip_cfg = self:GetEquipmentCfg(type_id)
- if need_evolution_equip_cfg then
- local series = need_evolution_equip_cfg.series
- local target_lv = self:GetEquipEvolutionLevel(goods_vo) + 1--当前装备升星等级
- for k,v in pairs(equip_list) do
- for kk,vv in pairs(v) do
- local equip_cfg = self:GetEquipmentCfg(vv.type_id)
- local equip_radio_cfg = self:GetEquipEvolutionRatioCfg(vv.type_id,series,target_lv)
- if equip_radio_cfg then
- if not evolution_equip_list[k] then
- evolution_equip_list[k] = {}
- end
- vv.evolution_ratio = equip_radio_cfg.ratio/100
- evolution_equip_list[k][#evolution_equip_list[k] + 1] = vv
- end
- end
- end
- end
- end
-
- -- print("huangcong:EquipModel [start:471] :", type_id)
- -- PrintTable(equip_list)
- -- print("huangcong:EquipModel [end]")
- -- print("huangcong:EquipModel [start:561] :", type_id)
- -- PrintTable(evolution_equip_list)
- -- print("huangcong:EquipModel [end]")
- return equip_list,evolution_equip_list
- end
-
- --判断装备是否具备精炼的的品质
- function EquipModel:EquipIsStrength( goods_vo )
- if goods_vo and goods_vo.equip_suit_type and goods_vo.equip_suit_type ~= EquipModel.EquipType.Guard then--守护不做精炼
- return true
- end
- return false
- end
-
- --判断装备是否具备升星的品质
- function EquipModel:EquipIsEvolution( goods_vo )
- if goods_vo and goods_vo.equip_suit_type and goods_vo.equip_suit_type and (goods_vo.equip_suit_type <= EquipModel.EquipType.Shoes) then--首饰类不做升星
- local evolution_level = self:GetEquipEvolutionLevel(goods_vo) + 1--当前装备升星等级
- local base_cfg = self:GetEquipEvolutionCfg(goods_vo.type_id,evolution_level)
- if base_cfg then
- return true
- end
- end
- return false
- end
-
- --判断装备是否具备升品的品质
- function EquipModel:EquipIsUpQuality( goods_vo )
- if goods_vo and goods_vo.equip_suit_type and goods_vo.equip_suit_type >= EquipModel.EquipType.Necklace then--首饰类才能升品
- local compose_cfg = ComposeModel:getInstance():GetEvolutionComposeCfg(goods_vo.type_id)
- local limit_level = compose_cfg and compose_cfg.open_lv or 0
- if compose_cfg and RoleManager.Instance.mainRoleInfo.level >= limit_level then
- return true
- end
- end
- return false
- end
-
- --得到装备升星的升星等级
- function EquipModel:GetEquipEvolutionLevel( goods_vo )
- if goods_vo and goods_vo.equip_suit_type and goods_vo.equip_suit_type <= EquipModel.EquipType.Shoes and goods_vo.color>=3 then--首饰类不做升星
- local evolution_level = 0--当前装备升星等级
- for kkk,vvv in pairs(goods_vo.other_data or {}) do
- if vvv.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- evolution_level = tonumber(vvv.info)
- end
- end
- evolution_level = evolution_level >= 1 and evolution_level or 1
- return evolution_level
- end
- return 0
- end
-
- --判断装备是否能否升星
- function EquipModel:EquipIsCanEvolution( series,pos,goods_vo,no_cost_enoght )
- local level_is_ok = self:CheckLevel(EquipModel.MainTab.Evolution)
- if series and pos and pos <= EquipModel.EquipType.Shoes and level_is_ok then--首饰类不做升星
- if self.can_evolution_info and self.can_evolution_info[series] and self.can_evolution_info[series][pos] and (self.can_evolution_info[series][pos].cost_enoght or no_cost_enoght) then
- local evolution_level = self:GetEquipEvolutionLevel(goods_vo) + 1--当前装备升星等级
- local radio = self.can_evolution_info[series][pos].radio
- if self.bag_evoluton_radio_list[series] and self.bag_evoluton_radio_list[series][evolution_level] then
- radio = radio + self.bag_evoluton_radio_list[series][evolution_level]/100
- end
- local anim_percent = 95
- local life_skill_active = PetModel:getInstance():IsLifeSkillActived(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local life_skill_ratio = PetModel:getInstance():GetPetLifeSkillRatio(PetConst.LifeSkill.EquipEvolutionSuccessRateUp)
- local vip_card_ratio = VipModel.getInstance():VipCardEquipEvolutionRatio(true)
- local add_life_skill_ratio = 0
- if life_skill_active then
- add_life_skill_ratio = life_skill_ratio
- end
- anim_percent = anim_percent - add_life_skill_ratio - vip_card_ratio---目标升星概率需要减去宠物和月卡加成的
-
- local cost_enought = false
- if self.can_evolution_info[series] and self.can_evolution_info[series][pos] then
- cost_enought = self.can_evolution_info[series][pos].cost_enoght and (not self.can_evolution_info[series][pos].is_faker or self.can_evolution_info[series][pos].is_faker and not self.no_show_faker_evo)
- end
- return radio >= anim_percent and cost_enought
- end
- end
- return false
- end
-
- --获得套件装备精炼数据【用于精炼套装界面EquipStrengthenSuitView】
- function EquipModel:GetEquipStrengthInfo( suit_id )
- local strength_info = {}
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- if wear_equip_suit_list and wear_equip_suit_list[suit_id] then
- for k,v in pairs(wear_equip_suit_list[suit_id]) do
- if v.equip_suit_type ~= EquipModel.EquipType.Guard and not strength_info[v.equip_suit_type] then
- local strengthen_level = 0--当前装备等级
- for kkk,vvv in pairs(v.other_data or {}) do
- if vvv.type == GoodsModel.GoodsInfoType.EquipmentLv then
- strengthen_level = tonumber(vvv.info)
- break
- end
- end
- strength_info[v.equip_suit_type] = strengthen_level
- end
- end
- end
- -- print("huangcong:EquipModel [start:413] :", can_strength_info)
- -- PrintTable(can_strength_info)
- -- print("huangcong:EquipModel [end]")
- return strength_info
- end
-
- --得到装备套装的配置
- function EquipModel:GetStrengthTotalCfg( series )
- local streng_total_cfg_list = {}
- streng_total_cfg_list[series] = {}
- for k,v in pairs(Config.Equipmentstrengthtotal) do
- if v.series == series then
- local data = DeepCopy(v)
- data.attr = stringtotable(data.attr)
- streng_total_cfg_list[series][data.lv] = data
- end
- end
- return streng_total_cfg_list[series]
- end
-
- --得到星级套装的配置
- --all是获得所有
- function EquipModel:GetStarTotalCfg( star_lv,all )
- if not all then
- local cfg = Config.Equipmentstartotal[star_lv]
- if cfg then
- cfg = DeepCopy(cfg)
- cfg.stage_attr = stringtotable(cfg.stage_attr)
- cfg.attr = stringtotable(cfg.attr)
- cfg.stage_skill = stringtotable(cfg.stage_skill)
- cfg.skill = stringtotable(cfg.skill)
- end
- return cfg
- elseif all then
- local equipment_startotal_cfg_list = {}
- local equipment_startotal_cfg = DeepCopy(Config.Equipmentstartotal)
- for k,v in pairs(equipment_startotal_cfg) do
- v.stage_attr = stringtotable(v.stage_attr)
- v.attr = stringtotable(v.attr)
- v.stage_skill = stringtotable(v.stage_skill)
- v.skill = stringtotable(v.skill)
- equipment_startotal_cfg_list[v.stars] = v
- end
- return equipment_startotal_cfg_list
- end
- print("没有该星级的套装:", star_lv)
- end
-
- --得到星星还有红点可以激活吗
- function EquipModel:GetCurHaveStarRedDot( )
- if self.equip_activie_stars and self.equip_sum_stars then
- if self.equip_sum_stars > self.equip_activie_stars then
- for k,v in pairsByKeys(Config.Equipmentstartotal) do
- if v.stars > self.equip_activie_stars and v.stars <= self.equip_sum_stars then--配置星级大于激活星级并且小于装备总星级
- return true
- end
- end
- end
- end
- return false
- end
-
- --设置装备激活星级数量
- function EquipModel:SetEquipActiveStarNum( star )
- self.equip_activie_stars = star
- end
-
- --得到升品合成配置
- function EquipModel:GetUpQualityComposeList( cost_list )
- local compose_list = {}
- local compose_req_list = {}
-
- if cost_list and TableSize(cost_list) > 0 then
- local bag_goods_list = self.goods_model.bag_goods_list
- for k,v in pairs(bag_goods_list) do
- for kk,vv in pairs(cost_list) do
- local cur_goods_num = 0
- for kkk,vvv in pairs(compose_list) do--如果消耗物品不足要继续拿下一个堆叠的物品
- if vvv[2] == v.type_id then
- cur_goods_num = vvv[3] + cur_goods_num
- end
- end
- if vv[2] == v.type_id and cur_goods_num < vv[3] then
- if v.goods_num + cur_goods_num >= vv[3] then
- compose_list[#compose_list + 1] = {v.goods_id,v.type_id,vv[3] - cur_goods_num}
- else
- compose_list[#compose_list + 1] = {v.goods_id,v.type_id,v.goods_num}
- end
- end
- end
- end
- end
- -- print("huangcong:EquipModel [start:929] :",compose_list)
- -- PrintTable(compose_list)
- -- print("huangcong:EquipModel [end]")
- return compose_list
- end
-
- --获得装备数量 包括身上穿的
- function EquipModel:EquipGoodsNumById( type_id )
- local goods_num,_,goods_vo_list = self.goods_model:GetTypeGoodsNum(type_id) or 0
- local goods_vo = nil
- goods_vo_list = goods_vo_list or {}
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg then
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- if equip_cfg.series ~= 99 then
- local series = equip_cfg.series
- local pos = equip_cfg.equip_type
- if wear_equip_suit_list[series] and wear_equip_suit_list[series][pos] then
- if wear_equip_suit_list[series][pos].type_id == type_id then
- goods_vo = wear_equip_suit_list[series][pos]
- goods_vo_list[#goods_vo_list + 1] = goods_vo
- end
- end
- else
- for k,v in pairs(wear_equip_suit_list) do
- if not goods_vo then
- for kk,vv in pairs(v) do
- if vv.type_id == type_id then
- goods_vo = vv
- goods_vo_list[#goods_vo_list + 1] = goods_vo
- break
- end
- end
- else
- break
- end
- end
- end
- end
- if goods_vo and goods_vo.goods_num > 0 then
- goods_num = goods_num + 1
- end
- return goods_num,goods_vo_list
- end
-
- --穿戴装备要判断继承
- function EquipModel:WearEquip( goods_vo,is_quick )
- if not goods_vo or not goods_vo.color then return end
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- if not equip_cfg or not equip_cfg.color then return end
- local len,list = NewMainRoleModel:getInstance():GetRoleReinMaxTurn()
- if Config.Equipmentseriesopen[equip_cfg.series] then
- local series_limit_cfg = Config.Equipmentseriesopen[equip_cfg.series]
- if not series_limit_cfg then
- print("huangcong:EquipModel [start:1324] 没有套件限制配置:", equip_cfg.type_id,equip_cfg.series)
- return
- end
- if series_limit_cfg.open_lv > RoleManager.Instance.mainRoleInfo.level then
- Message.show(series_limit_cfg.open_lv.."级开放第"..ChineseNumber(equip_cfg.series).."代装备","fault")
- return
- end
- end
- --当前同等位置穿戴的装备数据
- local cur_wear_data = nil
- local can_inherit = false
- if self.goods_model.wear_equip_suit_list[equip_cfg.series]
- and self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- then
- cur_wear_data = self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- if not cur_wear_data or not cur_wear_data.color then return end
- local cur_goods_strength_level = 0
- for k,v in pairs(goods_vo.other_data) do
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- cur_goods_strength_level = tonumber(v.info)
- break
- end
- end
-
- --品质大于当前的装备
- if equip_cfg.color > 3 and goods_vo.color > cur_wear_data.color then
- for k,v in pairs(cur_wear_data.other_data) do
- if cur_goods_strength_level == 0 then
- if equip_cfg.equip_type < EquipModel.EquipType.Necklace then
- local evolution_level = equip_cfg.color >= 3 and 1 or 0
- if v.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- evolution_level = tonumber(v.info) or 0
- --当前装备高级属性必须大于1
- if evolution_level > 1 then
- can_inherit = true
- break
- end
- elseif v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- local strengthen_level = tonumber(v.info)
- if strengthen_level > 0 then
- can_inherit = true
- break
- end
- end
- --首饰只能继承精炼等级
- elseif equip_cfg.equip_type >= EquipModel.EquipType.Necklace and equip_cfg.equip_type <= EquipModel.EquipType.RightRing then
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- local strengthen_level = tonumber(v.info)
- if strengthen_level > 0 then
- can_inherit = true
- break
- end
- end
- end
- end
- end
- end
- end
-
- local function cancel( ... )
- -- self:Fire(EquipModel.REQUEST_CCMD_EVENT,15205,self.choose_equip_list[1].goods_id
- -- ,self.choose_equip_list[1].pos,self.equip_data.goods_vo.goods_id,self.equip_data.goods_vo.pos)
- end
- local function ok( ... )
- -- if equip_cfg.equip_type == EquipModel.EquipType.Guard then--如果是守护
- -- if self.cur_choose_suit == 99 or not self.cur_choose_suit or is_quick then--如果是守护要特殊处理帮玩家选择守护
- -- local len,list,really_turn = NewMainRoleModel:getInstance():GetRoleReinMaxTurn()
- -- for i=1,really_turn do
- -- if not self.goods_model.wear_equip_suit_list[i]
- -- or not self.goods_model.wear_equip_suit_list[i][EquipModel.EquipType.Guard] then
- -- self:Fire(EquipModel.REQUEST_CCMD_EVENT,15201,i,equip_cfg.equip_type,goods_vo.goods_id)
- -- break
- -- end
- -- end
- -- else
- -- self:Fire(EquipModel.REQUEST_CCMD_EVENT,15201,self.cur_choose_suit, equip_cfg.equip_type, goods_vo.goods_id)
- -- end
- -- else
- self:Fire(EquipModel.REQUEST_CCMD_EVENT,15201,equip_cfg.series,equip_cfg.equip_type,goods_vo.goods_id)
- -- end
- end
- if not cur_wear_data or not can_inherit then
- ok()
- else
- local equip_list_vo = {}
- equip_list_vo[1] = cur_wear_data
- equip_list_vo[2] = goods_vo
- equip_list_vo[3] = ok
- self:Fire(EquipModel.OPEN_EQUIP_INHERIT_WEAR_TIP_VIEW,equip_list_vo)
- -- Alert.show("穿戴当前装备后,将<color=#fa1022>消耗原装备</color>并<color=#fa1022>自动继承</color>原先装备的<color=#fa1022>精炼等级</color>和<color=#fa1022>升星等级</color>,确认穿戴?",Alert.Type.Two,cancel,nil,"继承","取消")
- end
- end
-
- -- [1,3]男性可用
- -- [2,4]女性可用
- -- [1,2]异剑士可用
- -- [3,4]战灵师可用
- -- [1,2,3,4]全职业可用
- function EquipModel:GetCareerDesc( career_data )
- local data = {}
- for i,v in ipairs(career_data) do
- data[v] = true
- end
- if TableSize(data) == 4 then
- return "全职业可用"
- elseif data[1] and data[3] then
- return "鬼猎/暗鸦"
- elseif data[2] and data[4] then
- return "夙星/梦枭"
- elseif data[1] and data[2] then
- return "鬼猎/夙星"
- elseif data[3] and data[4] then
- return "暗鸦/梦枭"
- end
- end
-
- --职业是否OK
- function EquipModel:SelfCareerIsOk( type_id )
- local career = RoleManager.Instance.mainRoleInfo.career
- local equip_cfg = self:GetEquipmentCfg(type_id)
- --职业不符合
- local have_career = false
- if equip_cfg then
- for i,v in ipairs(equip_cfg.career) do
- if v == career then
- have_career = true
- break
- end
- end
- end
- return have_career
- end
-
- --装备能否弹提示(对比传的是真实的物品信息)
- function EquipModel:EquipCanShowGoodsTip( goods_vo )
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- if not equip_cfg then return false end
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- local len,list,really_turn = NewMainRoleModel:getInstance():GetRoleReinMaxTurn()
- local level = RoleManager.Instance.mainRoleInfo.level
- local career = RoleManager.Instance.mainRoleInfo.career
- local series = equip_cfg.series
- local pos = equip_cfg.equip_type
-
- if goods_vo and goods_vo.goods_num <= 0 then
- return false
- end
-
- --职业不符合
- local have_career = false
- for i,v in ipairs(equip_cfg.career) do
- if v == career then
- have_career = true
- break
- end
- end
- if not have_career then
- return false,0
- end
-
- --转生不够无法装备
- if series > EquipModel.getInstance():GetCurrentOpenSuitSeries() then
- return false
- end
-
- --等级不足
- if level < equip_cfg.lv then
- return false
- end
-
- --守护要特殊处理没有装满守护就要弹出
- if equip_cfg.equip_type == EquipModel.EquipType.Guard then
- local cur_wear_num = 0
- local score_list = {}
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- if vv.equip_suit_type == EquipModel.EquipType.Guard then
- cur_wear_num = cur_wear_num + 1
- score_list[k] = self:MathEquipScore(vv,vv.type_id)
- end
- end
- end
- if cur_wear_num < really_turn then
- return true,1
- end
-
- --如果都装满了 就要比拼评分了
- -- local score = self:MathEquipScore(goods_vo,goods_vo.type_id)
- -- for k,v in pairs(score_list) do
- -- if score > v then
- -- return true,1
- -- end
- -- end
- return false--守护就不走下面的逻辑了
- end
-
-
- -- --同位置就比评分
- -- local pos = equip_cfg.equip_type
- -- if wear_equip_suit_list[series] and wear_equip_suit_list[series][pos] then--同位置比评分
- -- local cur_wear_goods_vo = wear_equip_suit_list[series][pos]
- -- local score = self:MathEquipScore(goods_vo,goods_vo.type_id)
- -- local cur_wear_score = self:MathEquipScore(cur_wear_goods_vo,cur_wear_goods_vo.type_id)
- -- if score > cur_wear_score then
- -- return true,1
- -- -- elseif score == cur_wear_score then
- -- -- return false
- -- end
- -- else--否则就装备
- -- return true,1
- -- end
-
- --同位置比品质
- local pos = equip_cfg.equip_type
- if wear_equip_suit_list[series] and wear_equip_suit_list[series][pos] then--同位置比评分
- local cur_wear_goods_vo = wear_equip_suit_list[series][pos]
- local goods_color = goods_vo.color
- local cur_wear_goods_color = cur_wear_goods_vo.color
- if goods_color > cur_wear_goods_color then
- return true,1
- end
- else--否则就装备
- return true,1
- end
- return false,2
- end
-
- --能否展示tips的按钮
- function EquipModel:CanShowTipsBtn( )
- if (BagController.Instance.BagView and BagController.Instance.BagView:HasOpen())
- or (MarketController.Instance.market_view and MarketController.Instance.market_view:HasOpen())
- or CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn() then
- return true
- end
- return false
- end
-
- --检查当前套件所有装备继承红点(因为逻辑很多 所以只在界面里面调用)
- function EquipModel:CheckInheritSeriesDot( series )
- local bag_goods_list = self.goods_model.bag_goods_list
- -- print("huangcong:EquipModel [start:1519] :", bag_goods_list)
- -- PrintTable(bag_goods_list)
- -- print("huangcong:EquipModel [end]")
- local series_list = {}
- for k,v in pairs(bag_goods_list) do
- local goods_vo = v
- if goods_vo and goods_vo.type == GoodsModel.TYPE.EQUIP and goods_vo.goods_num > 0 then
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- if equip_cfg and equip_cfg.series ~= 99 and equip_cfg.series == series and not series_list[equip_cfg.equip_type] then
- --当前同等位置穿戴的装备数据
- local cur_wear_data = nil
- local can_inherit = false
- if self.goods_model.wear_equip_suit_list[equip_cfg.series]
- and self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- then
- cur_wear_data = self.goods_model.wear_equip_suit_list[equip_cfg.series][equip_cfg.equip_type]
- local cur_wear_strength_level = 0--当前装备精炼等级
- local cur_wear_evoblution_level = 0--当前升星等级
- for k,v in pairs(cur_wear_data.other_data) do
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- cur_wear_strength_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- cur_wear_evoblution_level = tonumber(v.info) or 0
- end
- end
-
- --品质小于当前的装备并且是紫色装备或以上
- --当前穿戴的装备升星和精炼都是0才给红点
- local goods_strength_level = 0
- local goods_evolution_level = 0
- if goods_vo.color > 2 and goods_vo.color < cur_wear_data.color
- and cur_wear_evoblution_level < 3 and cur_wear_strength_level == 0 then
- for k,v in pairs(goods_vo.other_data) do
- if v.type == GoodsModel.GoodsInfoType.EquipmentLv then
- goods_strength_level = tonumber(v.info)
- elseif v.type == GoodsModel.GoodsInfoType.EquipEvoLevel then
- goods_evolution_level = tonumber(v.info) or 0
- end
- end
- --非首饰可以继承升星
- if equip_cfg.equip_type < EquipModel.EquipType.Necklace then
- --当前装备高级属性必须大于1
- if goods_evolution_level > 1 then
- series_list[equip_cfg.equip_type] = true
- end
- --当前装备精炼等级必须大于1
- if goods_strength_level > 0 then
- series_list[equip_cfg.equip_type] = true
- end
- --首饰只能继承精炼等级
- elseif equip_cfg.equip_type >= EquipModel.EquipType.Necklace and equip_cfg.equip_type <= EquipModel.EquipType.RightRing then
- if goods_strength_level > 0 then
- series_list[equip_cfg.equip_type] = true
- end
- end
- end
- end
- end
- end
- end
- -- print("huangcong:EquipModel [start:1556] :", series)
- -- PrintTable(series_list)
- -- print("huangcong:EquipModel [end]")
- return series_list
- end
-
-
- --检查守护升品的红点
- function EquipModel:CheckGuardRedDot( )
- --首饰类是否能升品
- if not self.can_up_quality_info then
- self.can_up_quality_info = {}
- end
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list
- local equip_star_sum = 0
- if wear_equip_suit_list then
- --能否精炼列表
- for k,v in pairs(wear_equip_suit_list) do
- for kk,vv in pairs(v) do
- --判断首饰类才能升品
- if vv.equip_suit_type == EquipModel.EquipType.Guard then
- local compose_cfg = ComposeModel:getInstance():GetEvolutionComposeCfg(vv.type_id)
- local limit_level = compose_cfg and compose_cfg.open_lv or 0
- local cost_list = RoleManager.Instance.mainRoleInfo.level >= limit_level and compose_cfg and compose_cfg.cost_goods or {}
- if cost_list and #cost_list > 0 then
- local can_up_quality = true
- for kkk,vvv in ipairs(cost_list) do
- local goods_num = self.goods_model:GetTypeGoodsNum(vvv[2]) or 0
- if goods_num < vvv[3] then
- can_up_quality = false
- end
- end
- if not self.can_up_quality_info[k] then
- self.can_up_quality_info[k] = {}
- end
- self.can_up_quality_info[k][vv.equip_suit_type] = {can_up = can_up_quality,type_id = vv.type_id}
- end
- end
- end
- end
- end
- local have_red = false
- for k,v in pairs(self.can_up_quality_info) do
- for kk,vv in pairs(v) do
- if kk == EquipModel.EquipType.Guard and vv and vv.can_up then
- have_red = vv.can_up
- break
- end
- end
- end
- if not have_red and self.necklace_up_info then
- for k,v in pairs(self.necklace_up_info) do
- local equip_cfg = self:GetEquipmentCfg(k)
- if equip_cfg and equip_cfg.equip_type == EquipModel.EquipType.Guard then
- if v then
- return true
- end
- end
- end
- end
- return have_red
- end
-
- --检查饰品升品的红点
- function EquipModel:CheckOrnamentRedDot( )
- local have_red = false
- for k,v in pairs(self.can_up_quality_info) do
- for kk,vv in pairs(v) do
- if kk ~= EquipModel.EquipType.Guard and vv.can_up then
- have_red = vv.can_up
- break
- end
- end
- end
- if not have_red then
- for k,v in pairs(self.necklace_up_info) do
- local equip_cfg = self:GetEquipmentCfg(k)
- if equip_cfg and equip_cfg.equip_type ~= EquipModel.EquipType.Guard then
- if v then
- return true
- end
- end
- end
- end
- -- print("huangcong:EquipModel [start:2249] :", self.necklace_up_info)
- -- PrintTable(self.necklace_up_info)
- -- print("huangcong:EquipModel [end]")
- return have_red
- end
-
- --获得刻印配置
- function EquipModel:GetDraconicCfg( equip_type,type_id )
- if TableSize(self.equipment_draconic_cfg) == 0 then--装备刻印属性(暂不知道什么时候需要)这里初始化一次即可
- local equipment_draconic_cfg = DeepCopy(Config.Equipmentcarve)
- for k,v in pairs(equipment_draconic_cfg) do
- v.attr = stringtotable(v.attr)
- if not self.equipment_draconic_cfg[v.equip_type] then
- self.equipment_draconic_cfg[v.equip_type] = {}
- end
- self.equipment_draconic_cfg[v.equip_type][v.goods_id] = v
- end
- end
- if equip_type and not type_id then
- return self.equipment_draconic_cfg[equip_type]
- elseif equip_type and type_id then
- return self.equipment_draconic_cfg[equip_type][type_id]
- end
- end
-
- --获得宝石配置通过type_id
- function EquipModel:GetGemsCfgByTypeId( type_id )
- return self.equipment_gems_cfg[type_id]
- end
-
- --获得宝石配置通过series,gems_type
- function EquipModel:GetGemsCfgByGemsType( gems_type )
- return self.equipment_gems_series_cfg[gems_type]
- end
-
- --获得宝石套件配置
- function EquipModel:GetGemsSuitCfg( series,lv )
- if TableSize(self.equipment_gems_suit_cfg) == 0 then--这样写收益最大因为开始就要判断红点而且判断的次数会比较频繁
- local equipment_gems_suit_cfg = DeepCopy(Config.Equipmentgemstotal)
- for k,v in pairs(equipment_gems_suit_cfg) do
- v.attr = stringtotable(v.attr)
- v.total_attr = stringtotable(v.total_attr)
- if not self.equipment_gems_suit_cfg[v.series] then
- self.equipment_gems_suit_cfg[v.series] = {}
- end
- self.equipment_gems_suit_cfg[v.series][v.lv] = v
- end
- end
- if series and lv and self.equipment_gems_suit_cfg[series] then
- return self.equipment_gems_suit_cfg[series][lv]
- elseif series and self.equipment_gems_suit_cfg[series] then
- return self.equipment_gems_suit_cfg[series]
- end
- end
-
- --宝石镶嵌信息
- function EquipModel:SetGemstoneInfo( series_list )
- self.gemstone_info_list = {}
- for i,v in ipairs(series_list) do
- if not self.gemstone_info_list[v.series] then
- self.gemstone_info_list[v.series] = {}
- end
- local gems_list = {}
- for ii,vv in ipairs(v.gems) do
- local cfg = self:GetGemsCfgByTypeId(vv.goods_id)
- if cfg then
- gems_list[cfg.type] = cfg
- end
- end
- self.gemstone_info_list[v.series][v.pos] = gems_list
- end
- end
-
- --宝石镶嵌信息
- function EquipModel:SetGemstoneOneInfo( scmd )
- if not self.gemstone_info_list[scmd.series] then
- self.gemstone_info_list[scmd.series] = {}
- end
- local gems_list = {}
- for ii,vv in ipairs(scmd.gems) do
- local cfg = self:GetGemsCfgByTypeId(vv.goods_id)
- if cfg then
- gems_list[cfg.type] = cfg
- end
- end
- self.gemstone_info_list[scmd.series][scmd.pos] = gems_list
- end
-
- --获得宝石套件属性信息
- function EquipModel:GetGemstoneSeriesInfo( series,pos )
- if series and not pos then
- return self.gemstone_info_list[series]
- elseif series and pos and self.gemstone_info_list[series] then
- return self.gemstone_info_list[series][pos]
- elseif not series and not pos then
- return self.gemstone_info_list
- end
- end
-
- --计算全身装备镶嵌宝石总战力
- function EquipModel:MathGemstonePower( )
- local sum_power = 0
- for k,v in pairs(self.gemstone_info_list) do
- for kk,vv in pairs(v) do
- for kkk,vvv in pairs(vv) do
- if vvv.attr and vvv.attr[1] then--属性
- sum_power = sum_power + GetFighting(vvv.attr,true)
- end
- end
- end
- end
- return sum_power
- end
-
- --计算当前代装备镶嵌宝石总战力
- function EquipModel:MathSeriesGemstonePower( series )
- local sum_power = 0
- local list = self.gemstone_info_list[series]
- if list and TableSize(list) > 0 then
- for kk,vv in pairs(list) do
- for kkk,vvv in pairs(vv) do
- if vvv.attr and vvv.attr[1] then--属性
- sum_power = sum_power + GetFighting(vvv.attr,true)
- end
- end
- end
- end
- return sum_power
- end
-
- --得到当前选择套数装备镶嵌宝石总等级
- function EquipModel:GetGemstoneLvBySeries( series )
- local sum_lv = 0
- if self.gemstone_info_list[series] then
- for k,v in pairs(self.gemstone_info_list[series]) do
- for kk,vv in pairs(v) do
- sum_lv = sum_lv + vv.lv
- end
- end
- end
- return sum_lv
- end
-
- --得到宝石套装信息
- function EquipModel:GetGemstoneSuitInfo( series )
- local gemstone_info = self:GetGemstoneSeriesInfo(series)
- local list = {}
- for i=1,11 do
- if i ~= EquipModel.EquipType.Guard then
- if not gemstone_info or not gemstone_info[i] then
- list[i] = 0
- else
- local lv = 0
- if gemstone_info[i] then
- for kk,vv in pairs(gemstone_info[i]) do
- if Config.Equipmentgems[vv.goods_id] then
- lv = lv + Config.Equipmentgems[vv.goods_id].lv
- end
- end
- end
- list[i] = lv
- end
- end
- end
- return list
- end
-
- --升星装备选择列表
- function EquipModel:SetEvolutionEquipChooseList( choose_list )
- self.evolution_choose_equip_list = choose_list
- end
-
- function EquipModel:GetEvolutionEquipChooseList( )
- return self.evolution_choose_equip_list
- end
-
- --升星商城购买列表
- function EquipModel:SetEvolutionMarketBuy( market_buy )
- self.equip_evolution_market_buy = market_buy
- end
-
- function EquipModel:GetEvolutionMarketBuy( )
- return self.equip_evolution_market_buy
- end
-
- --获得红装消耗配置
- function EquipModel:GetRedEquipCfg( series,pos,lv )
- if not series then
- print("huangcong:EquipModel [start:2383] 套数不存在:")
- return
- end
- if TableSize(self.red_equip_cfg_list) == 0 then--这里初始化一次
- local red_equip_cfg_list = DeepCopy(Config.Equipmentempower)
- for k,v in pairs(red_equip_cfg_list) do--红装
- v.attr = stringtotable(v.attr)
- v.cost = stringtotable(v.cost)
- v.condition = stringtotable(v.condition)
- if not self.red_equip_cfg_list[v.series] then
- self.red_equip_cfg_list[v.series] = {}
- end
- if not self.red_equip_cfg_list[v.series][v.pos] then
- self.red_equip_cfg_list[v.series][v.pos] = {}
- end
- self.red_equip_cfg_list[v.series][v.pos][v.lv] = v
- end
- end
-
- if self.red_equip_cfg_list[series] and self.red_equip_cfg_list[series][pos] then
- if pos and not lv then
- return self.red_equip_cfg_list[series][pos]
- elseif pos and lv then
- return self.red_equip_cfg_list[series][pos][lv]
- end
- end
- end
-
- --获得刻印总属性展览
- function EquipModel:GetDraconicAttrData( )
- local info = self.equip_pos_info
- local attr_cfg = {}
- for k,v in pairs(info) do
- if v.carve_id and v.carve_id ~= 0 then
- local cfg = self:GetDraconicCfg(k,v.carve_id)
- if cfg then
- attr_cfg[#attr_cfg + 1] = cfg.attr
- end
- end
- end
- local attr_list = {}
- for k,v in pairs(attr_cfg) do
- for kk,vv in pairs(v) do
- if not attr_list[vv[1]] then
- attr_list[vv[1]] = {vv[1],vv[2]}
- else
- attr_list[vv[1]] = {vv[1],vv[2] + attr_list[vv[1]][2]}
- end
- end
- end
- -- print("huangcong:EquipModel [start:2204] :", attr_list)
- -- PrintTable(attr_list)
- -- print("huangcong:EquipModel [end]")
- return attr_list
- end
-
- --获取装备红点
- function EquipModel:GetEquipRedDotByType(tab_type)
- if not tab_type then return false end
- return self.red_dot_info[tab_type]
- end
-
- --获取跟随守护的id
- function EquipModel:GetFollowGuardId( )
- local type_id = RoleManager.Instance.mainRoleInfo.evil_type_id
- local evil_id = 0
- if type_id ~= 0 then
- local basic = self.goods_model:GetGoodsBasicByTypeId(type_id)
- evil_id = basic.model_id
- end
- return evil_id
- end
-
- --展示装备获取途径tip
- function EquipModel:ShowEquipGetWayTip( transform,index,equip_suit_id )
- if not transform then return end
- local ui_tf = panelMgr:GetParent("UI").transform
- local pos = ui_tf:InverseTransformPoint(transform.position)
- local w = ScreenWidth
- local h = ScreenHeight
- pos.x = w / 2 + pos.x
- pos.y = h / 2 + pos.y
- local key = index .. "@" .. equip_suit_id .. "@" ..index
- local cfg = Config.Equipmentempty[key]
- if cfg then
- BagModel:getInstance():Fire(BagModel.EQUIP_ITEM_GET_WAY_TIPS, cfg,pos.x,pos.y)
- else
- print(">>>>> unfinfd config Equipmentempty ", index, equip_suit_id )
- end
- end
-
-
- --装备是否可穿
- function EquipModel:IsCanWear(type_id)
- local career = RoleManager.Instance.mainRoleInfo.career
- local equip_cfg = self:GetEquipmentCfg(type_id)
- local have_career = false
- for i,v in ipairs(equip_cfg.career) do
- if v == career then
- have_career = true
- break
- end
- end
- return have_career
- end
-
- --装备是否可穿
- function EquipModel:GetEquipPos(type_id)
- local equip_cfg = self:GetEquipmentCfg(type_id)
- return equip_cfg.equip_type
- end
-
- --当前已经开启的最大套装数
- function EquipModel:GetCurrentOpenSuitSeries()
- local my_turn = RoleManager:getInstance():GetMainRoleVo().turn
- self.cur_max_series = self:GetEquipTurnToSeries(my_turn)
- return self.cur_max_series
- end
-
- --通过代数获取装备转生术
- function EquipModel:GetEquipSeriesToTurn(series)
- local turn = 1
- if not self.series_to_turn_cfg[series] then
- if series == 1 then
- self.series_to_turn_cfg[series] = 0
- else
- local cfg = Config.Transfer
- for k,v in pairs(cfg) do
- if v.equipment_series == series then
- self.series_to_turn_cfg[series] = v.id
- break
- end
- end
- end
- end
- turn = self.series_to_turn_cfg[series]
- return turn
- end
-
- --通过转生数获取装备代数
- function EquipModel:GetEquipTurnToSeries(turn)
- local series = 1
- if not self.turn_to_series_cfg[turn] then
- if turn == 0 then
- self.turn_to_series_cfg[turn] = 1
- else
- local cfg = Config.Transfer
- for k,v in pairs(cfg) do
- if v.id == turn and v.stage == 5 then
- self.turn_to_series_cfg[turn] = v.equipment_series
- break
- end
- end
- end
- end
- series = self.turn_to_series_cfg[turn]
- return series
- end
-
- --当前可以激活的最大套装数
- function EquipModel:GetCanActiveMaxSeries()
- local max = 1
- local level = RoleManager.Instance.mainRoleInfo.level
- local config = Config.Equipmentseriesopen
- for i,v in ipairs(config) do
- if level >= v.open_lv and (v.task_id == 0 or TaskModel:getInstance():IsTaskFinished(v.task_id)) then
- max = v.series
- end
- end
- return max
- end
-
- --对应套是否可以开启
- function EquipModel:CehckTargetSeriesCanOpen(series)
- local str = ""
- local my_turn = RoleManager.Instance.mainRoleInfo.turn
- local need_turn = self:GetEquipSeriesToTurn(series)
- if my_turn < need_turn then
- local cfg = Config.Transfercareer
- local career = RoleManager:getInstance():GetMainRoleVo().career
- local career_str = " "
- for k,v in pairs(cfg) do
- if v.career == career and v.transfer_id == need_turn then
- career_str = " " .. Trim(v.name) .. " "
- break
- end
- end
- str = string.format("完成 %s转职业%s可激活", WordManager:getHanZiNumber(need_turn), career_str)
- end
- return str
- end
-
- --获取最大套装数
- function EquipModel:GetMaxSuitSeries()
- local config = Config.Equipmentseriesopen
- return config and #config or 0
- end
-
- --是否能够被吞噬
- function EquipModel:IsCanSwallow(goods_basic)
- local v = goods_basic
- return v.type == GoodsModel.TYPE.EQUIP and v.subtype ~= 8 and v.subtype ~= 9 and v.subtype ~= 10 and v.subtype ~= 11
- end
-
- --是否能够被吞噬
- function EquipModel:GuardIsCanSetFollow(type_id, goods_id)
- local b = false
- local equip_cfg = self:GetEquipmentCfg(type_id)
- if equip_cfg and equip_cfg.equip_type == EquipModel.EquipType.Guard then
- if type_id ~= RoleManager.Instance.mainRoleInfo.evil_type_id then
- b = true
- end
- end
- return b
- end
-
- --设置装备宝石激活的等级列表
- function EquipModel:SetEquipGemActiveList( scmd )
- self.gems_lv_list = {}
- if scmd.gems_lv_list and #scmd.gems_lv_list > 0 then
- for i,v in pairs(scmd.gems_lv_list) do
- self.gems_lv_list[v.series] = v.gems_lv
- end
- end
- self:IsNeedRed(EquipModel.MainTab.Gemstone,nil,nil,true)
- end
-
- --得到宝石激活等级
- function EquipModel:GetEquipGemActiveLvBySeries( series )
- return self.gems_lv_list[series] or 0
- end
-
- function EquipModel:CheckGemstoneSeriesRedDot( )
- local show = false
- self.gems_suit_red_list = {}
- local len = NewMainRoleModel:getInstance():GetRoleReinMaxTurn()
- local active_gems_num = 0
- local sum_gems_num = 0
- local next_level = 0
- for i=1,len do
- next_level = 0
- active_gems_num = self:GetEquipGemActiveLvBySeries(i)
- sum_gems_num = self:GetGemstoneLvBySeries(i)
- local strengthtotal_cfg = self:GetGemsSuitCfg(i)
- local cur_gems_attr = nil
- for kk,vv in pairsByKeys(strengthtotal_cfg) do
- if vv.lv > active_gems_num then
- next_level = vv.lv
- break
- else
- cur_gems_attr = vv.attr
- end
- end
- self.gems_suit_red_list[i] = next_level ~= 0 and next_level <= sum_gems_num
- if next_level ~= 0 and next_level <= sum_gems_num then
- show = true
- end
-
- if not self.gem_next_level_list[i] then
- self.gem_next_level_list[i] = {}
- end
-
- --判断星级套装是否要玩家主动去激活
- for kk,vv in pairsByKeys(strengthtotal_cfg) do
- if vv.lv <= sum_gems_num and not self.gem_next_level_list[i][vv.lv] then
- self.gem_next_level_list[i][vv.lv] = true
- if self.gems_can_tip then
- local tip_data = {}
- tip_data.id = EquipModel.MainTab.Gemstone
- tip_data.star = vv.lv
- tip_data.attr = vv.attr
- tip_data.equip_suit_id = i
- print("huangcong:EquipModel [start:2736] :", tip_data)
- PrintTable(tip_data)
- print("huangcong:EquipModel [end]")
- self:Fire(EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW,tip_data)
- break
- end
- end
- end
- end
- return show
- end
-
- --获得宝石镶嵌配置信息EquipToolTips宝石专用
- function EquipModel:GetGemstoneEquipToolTipsInfo( gems_info )
- local gems_list = {}
- for ii,vv in ipairs(gems_info) do
- local cfg = self:GetGemsCfgByTypeId(vv[2])
- if cfg then
- gems_list[cfg.type] = cfg
- end
- end
- return gems_list
- end
-
-
- --获得当前装备最大套数
- function EquipModel:GetCurHaveEquipMaxSuit( )
- return self.goods_model.have_equip_max_suit or 1
- end
-
- --背包是否有宝石镶嵌
- function EquipModel:BagHaveGemstoneSet( gems_type )
- if not gems_type then return false end
- if self.equipment_gems_series_cfg[gems_type] then
- for i,v in pairs(self.equipment_gems_series_cfg[gems_type]) do
- local num = self.goods_model:GetTypeGoodsNum(v.goods_id)
- if num > 0 then
- return true
- end
- end
- --如果背包没有宝石则展示对应类型的1级宝石
- for i,v in pairsByKeys(self.equipment_gems_series_cfg[gems_type]) do
- UIToolTipMgr:getInstance():AppendGoodsTips(v.goods_id, nil, nil,nil,nil,nil,nil,true)
- return false
- end
- end
- return false
- end
-
- --设置红装(升品)信息
- function EquipModel:SetRedEquipInfo( series_list )
- self.redEquip_server_info = {}
- for i,v in pairs(series_list) do
- if not self.redEquip_server_info[v.series] then
- self.redEquip_server_info[v.series] = {}
- end
- self.redEquip_server_info[v.series][v.pos] = v
- end
- -- print("huangcong:EquipModel [start:2640] :", self.redEquip_server_info)
- -- PrintTable(self.redEquip_server_info)
- -- print("huangcong:EquipModel [end]")
- end
-
- --获得红装(升品)信息
- function EquipModel:GetRedEquipInfo( series,pos )
- if series and pos and self.redEquip_server_info[series] then
- return self.redEquip_server_info[series][pos]
- elseif series and not pos and self.redEquip_server_info[series] then
- return self.redEquip_server_info[series]
- else
- return self.redEquip_server_info
- end
- end
-
- --检查升品所有套装等级是否满足条件
- function EquipModel:RedEquipCheckAllSeriesLv( series,lv )
- if not series or not lv then return false end
- for i=1,series do
- if self.redEquip_server_info[i] and TableSize(self.redEquip_server_info[i]) >= 7 then
- for k,v in ipairs(self.redEquip_server_info[i]) do
- if v.lv < lv and v.pos <= 7 then
- return false
- end
- end
- else
- return false
- end
- end
- return true
- end
-
- --获得红装商城同一个部位最低升品装备数量
- function EquipModel:GetRedEquipShopCostlimitNum( equip_pos )
- local list = self.goods_model.wear_equip_suit_list
- local limit_cost = nil
- local power_lv = 0--当前升品等级
- local equip_info = nil
- local strength_cfg = nil
- local cost_list = nil
- for equip_suit_id,v in pairs(list) do
- local equip_info = v[equip_pos]
- if equip_info and equip_info.color >= 4 then -- 橙装以上才能升品哟
- local server_info = self:GetRedEquipInfo(equip_suit_id,equip_pos)
- power_lv = 0--当前升品等级
- if server_info then power_lv = server_info and server_info.lv or 0 end
- strength_cfg = self:GetRedEquipCfg(equip_suit_id,equip_pos,power_lv + 1)--基础属性
- if strength_cfg then
- cost_list = strength_cfg.cost
- if not limit_cost then
- limit_cost = cost_list[1][3]
- else
- limit_cost = limit_cost > cost_list[1][3] and cost_list[1][3] or limit_cost
- end
- end
- end
- end
-
- if not limit_cost then--没有这件装备或者没有橙装
- local len,list = EquipModel.getInstance():GetCurrentOpenSuitSeries()
- for i=1,len do
- strength_cfg = self:GetRedEquipCfg(i,equip_pos,1)--基础属性
- if strength_cfg then
- cost_list = strength_cfg.cost
- if not limit_cost then
- limit_cost = cost_list[1][3]
- else
- limit_cost = limit_cost > cost_list[1][3] and cost_list[1][3] or limit_cost
- end
- end
- end
- end
- return limit_cost
- end
-
- --获得商城道具ID装备位置
- function EquipModel:GetShopGoodsIdEquipPos( goods_id )
- if TableSize(self.red_equip_cfg_list) == 0 then--这里初始化一次
- local red_equip_cfg_list = DeepCopy(Config.Equipmentempower)
- for k,v in pairs(red_equip_cfg_list) do--红装
- v.attr = stringtotable(v.attr)
- v.cost = stringtotable(v.cost)
- v.condition = stringtotable(v.condition)
- if not self.red_equip_cfg_list[v.series] then
- self.red_equip_cfg_list[v.series] = {}
- end
- if not self.red_equip_cfg_list[v.series][v.pos] then
- self.red_equip_cfg_list[v.series][v.pos] = {}
- end
- self.red_equip_cfg_list[v.series][v.pos][v.lv] = v
- end
- end
- for k,v in pairs(self.red_equip_cfg_list) do
- for kk,vv in pairs(v) do
- for kkk,vvv in pairs(vv) do
- if vvv.cost and vvv.cost[1] and vvv.cost[1][2] == goods_id then
- return vvv.pos
- end
- end
- end
- end
- end
-
- function EquipModel:GetEquipType( type_id )
- local cfg = Config.Equipment[type_id]
- if cfg then
- return cfg.equip_type
- end
- end
-
- --设置装备升星自动购买cookie
- function EquipModel:SetEquipEvolutionAotuBuyCookie( bool )
- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.EQUIP_AOTU_BUY_SHOP,bool)
- CookieWrapper.Instance:WriteAll()
- end
-
- --获得装备升星自动购买cookie
- function EquipModel:GetEquipEvolutionAotuBuyCookie( )
- local bool = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.EQUIP_AOTU_BUY_SHOP) or false
- return bool
- end
-
- --计算升星属性战力
- function EquipModel:MathGreatAttrFighting( attr_list,bool )
- local new_list = {}
- local fight_num = 0
- for k,v in ipairs(attr_list) do
- local data = {v[1],v[2]}
- new_list[#new_list + 1] = data
- end
- -- print("huangcong:EquipModel [start:2977] :", attr_list)
- -- PrintTable(attr_list)
- -- print("huangcong:EquipModel [end]")
- new_list = self:ChangeEquipSAttr(new_list)
- -- print("huangcong:EquipModel [start:2981] :转化后的终极属性", new_list)
- -- PrintTable(new_list)
- new_list = ComposeAttr(new_list)
- fight_num = GetFighting(new_list,bool or false)
- return fight_num or 0
- end
-
-
- --饰品: 戒指 项链 耳饰 手套
- --防具:头部 身体 披风 裤子 脚
- --武器:武器
- --[转换装备属性]
- -- EquipModel.DefEquipType
- -- EquipModel.NecklaceEquipType
- function EquipModel:ChangeEquipSAttr( attr_list )--221
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list or {}
- local weapon_atk = 0--武器攻击
- local def_hp = 0--防具生命
- local necklace_atk = 0--饰品攻击
- local necklace_def = 0--饰品防御
- local weapon_attr_list = {}--武器属性列表
- local def_attr_list = {}--防具属性列表
- local necklace_attr_list = {}--饰品属性列表
- for series,equip_series_list in pairs(wear_equip_suit_list) do
- for equip_type,goods_vo in pairs(equip_series_list) do
- local equip_cfg = self:GetEquipmentCfg(goods_vo.type_id)
- if equip_cfg and equip_cfg.base_attr then
- if equip_cfg.equip_type == 1 then--武器
- for k,v in ipairs(equip_cfg.base_attr) do
- if not weapon_attr_list[v[1]] then
- weapon_attr_list[v[1]] = 0
- end
- weapon_attr_list[v[1]] = weapon_attr_list[v[1]] + v[2]
- end
- elseif EquipModel.DefEquipType[equip_cfg.equip_type] then--防具
- for k,v in ipairs(equip_cfg.base_attr) do
- if not def_attr_list[v[1]] then
- def_attr_list[v[1]] = 0
- end
- def_attr_list[v[1]] = def_attr_list[v[1]] + v[2]
- end
- elseif EquipModel.NecklaceEquipType[equip_cfg.equip_type] then--饰品
- for k,v in ipairs(equip_cfg.base_attr) do
- if not necklace_attr_list[v[1]] then
- necklace_attr_list[v[1]] = 0
- end
- necklace_attr_list[v[1]] = necklace_attr_list[v[1]] + v[2]
- end
- end
- end
- end
- end
-
- local new_attr_list = {}
- local attr_id = nil
- for k,v in ipairs(attr_list) do
- local attr_id = EquipModel.STypeAttr[v[1]]
- if attr_id then--如果是局部百分比属性
- if v[1] == 221 and weapon_attr_list[attr_id] then--武器攻击
- new_attr_list[#new_attr_list + 1] = {attr_id,round(v[2]/10000*weapon_attr_list[attr_id])}
- elseif (v[1] == 223 or v[1] == 224) and def_attr_list[attr_id] then--防具生命/防具防御
- new_attr_list[#new_attr_list + 1] = {attr_id,round(v[2]/10000*def_attr_list[attr_id])}
- elseif v[1] == 225 and necklace_attr_list[attr_id] then--饰品攻击
- new_attr_list[#new_attr_list + 1] = {attr_id,round(v[2]/10000*necklace_attr_list[attr_id])}
- end
- else
- new_attr_list[#new_attr_list + 1] = v
- end
- end
- -- print("huangcong:EquipModel [start:3044] :", def_attr_list)
- -- PrintTable(def_attr_list)
- -- print("huangcong:EquipModel [end]")
- -- print("huangcong:EquipModel [start:3045] :", attr_list)
- -- PrintTable(attr_list)
- -- print("huangcong:EquipModel [end]")
- -- print("huangcong:EquipModel [start:3047] :", new_attr_list)
- -- PrintTable(new_attr_list)
- -- print("huangcong:EquipModel [end]")
- return new_attr_list
- end
-
- --装备更新新套装属性激活
- function EquipModel:UpdateNewSuitAttrActive( is_init )
- self.suit_attr_active_list = self.suit_attr_active_list or {}
- local red_bool = false
- local wear_equip_suit_list = self.goods_model.wear_equip_suit_list or {}
- for series,v in pairs(wear_equip_suit_list) do
- if not self.suit_attr_active_list[series] then
- self.suit_attr_active_list[series] = {}
- end
- local cur_suit_id_num1,suit_equip_pos_list1 = self.goods_model:GetEquipSuitNum(series,1)--装备套装
- local suit_cfg_list1 = self:GetEquipmentSuitCfg(series,1)
- if suit_cfg_list1 then
- local active_num_list1 = {}--新激活数量
- for k,vv in pairs(suit_cfg_list1) do
- if vv.suit_num <= cur_suit_id_num1 then
- active_num_list1[#active_num_list1 + 1] = {vv.suit_num,false,true}--先默认未激活吧第三个参数是否是已经查看
- end
- end
- if is_init then--初始化或者没有数据的时候
- self.suit_attr_active_list[series][1] = active_num_list1
- elseif not self.suit_attr_active_list[series][1] then--后面新增了
- for k,v in pairs(active_num_list1) do
- v = {v[1],true,false}
- end
- self.suit_attr_active_list[series][1] = active_num_list1
- elseif #self.suit_attr_active_list[series][1] < #active_num_list1 then --开始对比
- local new_list = {}
- for i=1,#active_num_list1 do
- if i <= #self.suit_attr_active_list[series][1] then
- new_list[#new_list + 1] = self.suit_attr_active_list[series][1][i]
- else
- new_list[#new_list + 1] = {active_num_list1[i][1],true,false}
- end
- end
- self.suit_attr_active_list[series][1] = new_list
- end
- end
-
- local cur_suit_id_num2,suit_equip_pos_list2 = self.goods_model:GetEquipSuitNum(series,2)--饰品套装
- local suit_cfg_list2 = self:GetEquipmentSuitCfg(series,2)
- if suit_cfg_list2 then
- local active_num_list2 = {}--新激活数量
- for k,vv in pairs(suit_cfg_list2) do
- if vv.suit_num <= cur_suit_id_num2 then
- active_num_list2[#active_num_list2 + 1] = {vv.suit_num,false,true}--先默认未激活吧第三个参数是否是已经查看
- end
- end
- if is_init then
- self.suit_attr_active_list[series][2] = active_num_list2
- elseif not self.suit_attr_active_list[series][2] then--初始化或者没有数据的时候
- for k,v in pairs(active_num_list2) do
- v = {v[1],true,false}
- end
- self.suit_attr_active_list[series][2] = active_num_list2
- elseif #self.suit_attr_active_list[series][2] < #active_num_list2 then --开始对比
- local new_list = {}
- for i=1,#active_num_list2 do
- if i <= #self.suit_attr_active_list[series][2] then
- new_list[#new_list + 1] = self.suit_attr_active_list[series][2][i]
- else
- new_list[#new_list + 1] = {active_num_list2[i][1],true,false}
- end
- end
- self.suit_attr_active_list[series][2] = new_list
- end
- end
- end
- self.suit_attr_active_red_series_list = {}
- -- print("huangcong:EquipModel [start:3130] :", self.suit_attr_active_list)
- -- PrintTable(self.suit_attr_active_list)
- -- print("huangcong:EquipModel [end]")
- for series,v in pairs(self.suit_attr_active_list) do
- for equip_attr_type,vv in pairs(v) do
- for kkk,vvv in pairs(vv) do
- if vvv[2] then
- self.suit_attr_active_red_series_list[series] = true
- red_bool = true
- end
- end
- end
- end
- self.suit_attr_red_bool = red_bool
- GlobalEventSystem:Fire(EventName.UPDATE_BAG_RED)
- end
-
- --获得当前属性是否是最新属性是否查看过
- function EquipModel:GetNewSuitAttrActiveInfo( series,equip_attr_type,suit_num )
- if self.suit_attr_active_list[series] and self.suit_attr_active_list[series][equip_attr_type] then
- for k,v in pairs(self.suit_attr_active_list[series][equip_attr_type]) do
- if v[1] == suit_num then
- return v[3]
- end
- end
- end
- return true
- end
-
- --获得套装属性红点信息
- function EquipModel:GetSuitAttrRedBool( )
- return self.suit_attr_red_bool
- end
|