Files
Main/Assets/GameAssets/Resources/Lua/Logic/SoulEquip/SoulEquipSystem.lua
2025-01-25 04:38:09 +08:00

784 lines
30 KiB
Lua

------------------------------------------------
--作者: 何健
--日期: 2020-12-10
--文件: SoulEquipSystem.lua
--模块: SoulEquipSystem
--描述: 魂甲
------------------------------------------------
local L_ItemBase = CS.Thousandto.Code.Logic.ItemBase
local L_FightUtils = require ("Logic.Base.FightUtils.FightUtils")
local L_RedPointItemCondition = CS.Thousandto.Code.Logic.RedPointItemCondition
local L_RedPointCustomCondition = CS.Thousandto.Code.Logic.RedPointCustomCondition
local SoulEquipSystem = {
--当前淬炼等级
CurStrengthLv = 0,
--当前魂甲ID
CurID = 1,
--当前觉醒等级
CurAwakeLv = 0,
AwakeSkillList = List:New(),
--神印阁等级及经验
LotteryLv = 0,
LotteryExp = 0,
--镶嵌孔位信息
SlotDic = Dictionary:New(),
--穿戴的神印字典
DressPeralDic = Dictionary:New(),
--祈灵消耗元宝二次确认
IsLotteryConfirm = true,
--魂印合成需要的材料列表
PeralSynNeedItemList = List:New(),
--当前穿戴的魂甲ID
CurEquipID = 0,
}
function SoulEquipSystem:Initialize()
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, self.OnItemChange, self)
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.OnItemChange, self)
GameCenter.RegFixEventHandle(LogicLuaEventDefine.EVENT_SOULEQUIPPERAL_BAGCHANGE, self.OnPearlBagChange, self)
end
function SoulEquipSystem:UnInitialize()
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_ITEM_CHANGE_UPDATE, self.OnItemChange, self)
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.OnItemChange, self)
GameCenter.UnRegFixEventHandle(LogicLuaEventDefine.EVENT_SOULEQUIPPERAL_BAGCHANGE, self.OnPearlBagChange, self)
end
function SoulEquipSystem:Update()
if self.PearlBagUpdate then
self:SetInlyRed()
self:SetPeralSynthRed()
self.PearlBagUpdate = false
end
if self.IsCheckSynthPoint then
self:SetPeralSynthRed()
self.IsCheckSynthPoint = false
end
end
--设置当前穿戴的魂甲ID
function SoulEquipSystem:SetCurWearEquipID(id)
if id then
self.CurEquipID = id
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_BREAKLV_UPDATE)
end
end
--获取穿戴神印战力
function SoulEquipSystem:GetDressPeralPowerByPart(part)
if self.DressPeralDic:ContainsKey(part) and self.DressPeralDic[part] then
return self.DressPeralDic[part].Power
end
return 0
end
--获取穿戴神印
function SoulEquipSystem:GetDressPeralByPart(part)
if self.DressPeralDic:ContainsKey(part) and self.DressPeralDic[part] then
return self.DressPeralDic[part]
end
return nil
end
--获取魂印强化配置表ID
function SoulEquipSystem:GetPeralStrCfgID(slot, lv)
return slot * 10000 + lv
end
--获取神印强化属性
function SoulEquipSystem:GetPeralStrengAtt(part)
local _dic = Dictionary:New()
local function _forFunction(k, v)
if v.HoleCfg then
if v.HoleCfg.EquipType == part then
if v.StrengLv > 0 then
local _cfg = DataConfig.DataSoulArmorSignetIntensify[self:GetPeralStrCfgID(k, v.StrengLv)]
if _cfg and _cfg.Value then
local _arr = Utils.SplitStrByTableS(_cfg.Value);
for i = 1, #_arr do
_dic:Add(_arr[i][1], _arr[i][2]);
end
end
end
return true
end
end
end
self.SlotDic:ForeachCanBreak(_forFunction)
return _dic
end
--获取神印套装激活的孔位数
function SoulEquipSystem:GetPeralSuitCount(partList, quality, star)
local _num = 0
if star == nil then
star = 1
end
local function _forFunction(k, v)
if partList:Contains(k) and v.IsOpen and v.PearlInfo and (v.PearlInfo.Quality > quality or (v.PearlInfo.Quality == quality and v.PearlInfo.StarNum >= star)) then
_num = _num + 1
end
end
if partList and quality then
self.SlotDic:ForeachCanBreak(_forFunction)
end
return _num
end
--获取神印套装激活的孔位数
function SoulEquipSystem:HavePearl()
local _num = 0
local function _forFunction(k, v)
if v.IsOpen and v.PearlInfo then
_num = _num + 1
return true
end
end
self.SlotDic:ForeachCanBreak(_forFunction)
return _num > 0
end
function SoulEquipSystem:GetPeralSuitCfg(PearlInfo)
local _cfg = nil
if PearlInfo then
DataConfig.DataSoulArmorSignetSuit:ForeachCanBreak(function(k, v)
local _partList = Utils.SplitNumber(v.Part, '_')
if _partList:Contains(PearlInfo.SlotId) and v.Quality == PearlInfo.Quality then
_cfg = v
return true
end
end)
end
return _cfg
end
--获取所有可分解装备
function SoulEquipSystem:GetAllPeralCanSplit()
local _result = List:New()
local _peralList = self:GetAllSoulPearl()
for i = 1, #_peralList do
local item = _peralList[i]
if item then
if self.DressPeralDic:ContainsKey(item.Part) and self.DressPeralDic[item.Part].Power >= item.Power then
_result:Add(item)
end
end
end
return _result
end
--获取已镶嵌的神印属性(不含强化和套装属性)
function SoulEquipSystem:GetAllPeralAttrDic()
local _dic = Dictionary:New()
local function _forFunction(k, v)
if v.IsOpen and v.PearlInfo then
local attDic = v.PearlInfo:GetBaseAttribute()
attDic:Foreach(function(k, v)
if _dic:ContainsKey(k) then
_dic[k] = _dic[k] + v
else
_dic:Add(k, v)
end
end)
attDic = v.PearlInfo:GetSpecialAttribute()
attDic:Foreach(function(k, v)
if _dic:ContainsKey(k) then
_dic[k] = _dic[k] + v
else
_dic:Add(k, v)
end
end)
end
end
self.SlotDic:ForeachCanBreak(_forFunction)
return _dic
end
--获取所有激活的套装属性
function SoulEquipSystem:GetAllPeralSuitAttrDic()
local _dic = Dictionary:New()
DataConfig.DataSoulArmorSignetSuit:ForeachCanBreak(function(k, v)
local _num = self:GetPeralSuitCount(Utils.SplitNumber(v.Part, '_'), v.Quality, v.Star)
if v.ValueOf2 and v.ValueOf2 ~= "" and _num >= 2 then
local _arr = Utils.SplitStrByTableS(v.ValueOf2);
for i = 1, #_arr do
local _id = tonumber(_arr[i][1])
local _value = tonumber(_arr[i][2])
if _dic:ContainsKey(_id) then
_dic[_id] = _dic[_id] + _value
else
_dic:Add(_id, _value)
end
end
end
if v.ValueOf3 and v.ValueOf3 ~= "" and _num >= 3 then
local _arr = Utils.SplitStrByTableS(v.ValueOf2);
for i = 1, #_arr do
local _id = tonumber(_arr[i][1])
local _value = tonumber(_arr[i][2])
if _dic:ContainsKey(_id) then
_dic[_id] = _dic[_id] + _value
else
_dic:Add(_id, _value)
end
end
end
if v.ValueOf4 and v.ValueOf4 ~= "" and _num >= 4 then
local _arr = Utils.SplitStrByTableS(v.ValueOf2);
for i = 1, #_arr do
local _id = tonumber(_arr[i][1])
local _value = tonumber(_arr[i][2])
if _dic:ContainsKey(_id) then
_dic[_id] = _dic[_id] + _value
else
_dic:Add(_id, _value)
end
end
end
if v.ValueOf6 and v.ValueOf6 ~= "" and _num >= 6 then
local _arr = Utils.SplitStrByTableS(v.ValueOf2);
for i = 1, #_arr do
local _id = tonumber(_arr[i][1])
local _value = tonumber(_arr[i][2])
if _dic:ContainsKey(_id) then
_dic[_id] = _dic[_id] + _value
else
_dic:Add(_id, _value)
end
end
end
end)
return _dic
end
--计算神印总战力,包括基础属性,套装,强化
function SoulEquipSystem:SetPearlFightPower()
self.PearlFight = 0
self.SlotDic:Foreach(function(k, v)
if v.IsOpen and v.PearlInfo then
self.PearlFight = self.PearlFight + v.PearlInfo.Power
if v.StrengLv > 0 then
local _cfg = DataConfig.DataSoulArmorSignetIntensify[self:GetPeralStrCfgID(k, v.StrengLv)]
if _cfg and _cfg.Value then
local _arr = Utils.SplitStrByTableS(_cfg.Value);
local _power = L_FightUtils.GetPropetryPowerByList(_arr)
if _power then
self.PearlFight = self.PearlFight + _power
end
end
end
end
end)
DataConfig.DataSoulArmorSignetSuit:ForeachCanBreak(function(k, v)
local _num = self:GetPeralSuitCount(Utils.SplitNumber(v.Part, '_'), v.Quality, v.Star)
if v.ValueOf2 and v.ValueOf2 ~= "" and _num >= 2 then
local _arr = Utils.SplitStrByTableS(v.ValueOf2);
local _power = L_FightUtils.GetPropetryPowerByList(_arr)
if _power then
self.PearlFight = self.PearlFight + _power
end
end
if v.ValueOf3 and v.ValueOf3 ~= "" and _num >= 3 then
local _arr = Utils.SplitStrByTableS(v.ValueOf3);
local _power = L_FightUtils.GetPropetryPowerByList(_arr)
if _power then
self.PearlFight = self.PearlFight + _power
end
end
if v.ValueOf4 and v.ValueOf4 ~= "" and _num >= 4 then
local _arr = Utils.SplitStrByTableS(v.ValueOf4);
local _power = L_FightUtils.GetPropetryPowerByList(_arr)
if _power then
self.PearlFight = self.PearlFight + _power
end
end
if v.ValueOf6 and v.ValueOf6 ~= "" and _num >= 6 then
local _arr = Utils.SplitStrByTableS(v.ValueOf6);
local _power = L_FightUtils.GetPropetryPowerByList(_arr)
if _power then
self.PearlFight = self.PearlFight + _power
end
end
if _num < 2 then
return true
end
end)
end
--自动穿戴神印
function SoulEquipSystem:AutoWearPearl(info)
if info and info.HoleCfg and info.IsOpen then
local _pearlDic = self:GetHightSoulPearlDic()
if _pearlDic:ContainsKey(info.HoleCfg.EquipType) then
local _msg = ReqMsg.MSG_SoulArmor.ReqWearSoulArmorBall:New()
_msg.slotId = info.SlotId
_msg.ballId = _pearlDic[info.HoleCfg.EquipType].DBID
_msg:Send()
end
end
end
--设置魂甲淬练红点
function SoulEquipSystem:SetStrengthRed()
--清除掉所有条件
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulEquipStrength);
local _cfg = DataConfig.DataSoulArmorLevelUp[self.CurStrengthLv]
local _next = DataConfig.DataSoulArmorLevelUp[self.CurStrengthLv + 1]
if _cfg and _next and _cfg.Consume and _cfg.Consume ~= "" then
local _ar = Utils.SplitStr(_cfg.Consume, ';')
local _conditions = List:New();
for i = 1, #_ar do
local _sin = Utils.SplitNumber(_ar[i], '_')
if _sin[1] and _sin[2] then
_conditions:Add(L_RedPointItemCondition(_sin[1], _sin[2]));
end
end
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulEquipStrength, 0, _conditions);
end
end
--设置魂甲突破红点
function SoulEquipSystem:SetBreachRed()
--清除掉所有条件
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulEquipBreak);
local _cfg = DataConfig.DataSoulArmorBreach[self.CurID]
local _next = DataConfig.DataSoulArmorBreach[self.CurID + 1]
if _cfg and _next and _cfg.Consume and _cfg.Consume ~= "" then
local _ar = Utils.SplitStr(_cfg.Consume, ';')
local _conditions = List:New();
for i = 1, #_ar do
local _sin = Utils.SplitNumber(_ar[i], '_')
if _sin[1] and _sin[2] then
_conditions:Add(L_RedPointItemCondition(_sin[1], _sin[2]));
end
end
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulEquipBreak, 0, _conditions);
end
end
--设置魂甲觉醒红点
function SoulEquipSystem:SetAweakenRed()
--清除掉所有条件
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulEquipAweak);
local _cfg = DataConfig.DataSoulArmorAwaken[self.CurAwakeLv]
local _next = DataConfig.DataSoulArmorAwaken[self.CurAwakeLv + 1]
if _cfg and _next and _cfg.Consume and _cfg.Consume ~= "" then
local _ar = Utils.SplitStr(_cfg.Consume, ';')
local _conditions = List:New();
for i = 1, #_ar do
local _sin = Utils.SplitNumber(_ar[i], '_')
if _sin[1] and _sin[2] then
_conditions:Add(L_RedPointItemCondition(_sin[1], _sin[2]));
end
end
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulEquipAweak, 0, _conditions);
end
--技能升级
for i = 1, #self.AwakeSkillList do
local _skCfg = DataConfig.DataSoulArmorAwakenSkill[self.AwakeSkillList[i]]
if _skCfg and _skCfg.ConsumeSkill and _skCfg.ConsumeSkill ~= "" and _skCfg.NextSkill > 0 then
local _ar = Utils.SplitStr(_skCfg.ConsumeSkill, ';')
local _conditions = List:New();
for ii = 1, #_ar do
local _sin = Utils.SplitNumber(_ar[ii], '_')
if _sin[1] and _sin[2] then
_conditions:Add(L_RedPointItemCondition(_sin[1], _sin[2]));
end
end
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulEquipAweak, self.AwakeSkillList[i], _conditions);
end
end
end
--神印穿戴红点
function SoulEquipSystem:SetInlyRed()
local _pearlDic = nil
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulPearlWear)
local function _forFunction(k, v)
local _red = false
if v.HoleCfg and v.IsOpen then
if _pearlDic == nil then
_pearlDic = self:GetHightSoulPearlDic()
end
if _pearlDic:ContainsKey(v.HoleCfg.EquipType) then
local _power = 0
if v.PearlInfo then
_power = v.PearlInfo.Power
end
if _pearlDic[v.HoleCfg.EquipType].Power > _power then
_red = true
end
end
end
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.SoulPearlWear, k, L_RedPointCustomCondition(_red))
end
self.SlotDic:Foreach(_forFunction)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_INLAY_UPDATE)
end
--神印强化红点
function SoulEquipSystem:SetPeralStrengthRed()
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulPearlStrength)
local function _forFunction(k, v)
if v.HoleCfg and v.IsOpen and v.PearlInfo then
local id = self:GetPeralStrCfgID(k, v.StrengLv)
local _cfg = DataConfig.DataSoulArmorSignetIntensify[id]
local _next = DataConfig.DataSoulArmorSignetIntensify[id + 1]
if _cfg and _next and _cfg.Consume and _cfg.Consume ~= "" then
local _ar = Utils.SplitStr(_cfg.Consume, ';')
local _conditions = List:New();
for i = 1, #_ar do
local _sin = Utils.SplitNumber(_ar[i], '_')
if _sin[1] and _sin[2] then
_conditions:Add(L_RedPointItemCondition(_sin[1], _sin[2]));
end
end
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulPearlStrength, k, _conditions);
end
end
end
self.SlotDic:Foreach(_forFunction)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_INLAY_UPDATE)
end
--神印抽奖红点
function SoulEquipSystem:SetLotteryRed()
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulEquipLottery)
local function _forFunction(k, v)
if v and v.ConsumeItem then
local _conditions = List:New();
_conditions:Add(L_RedPointItemCondition(v.ConsumeItem, 1));
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.SoulEquipLottery, k, _conditions);
end
end
DataConfig.DataSoulArmorSignetLotteryObject:Foreach(_forFunction)
end
--神印穿戴
function SoulEquipSystem:ReqWearSoulArmorBall(PearlInfo)
local function _forFunction(k, v)
if v.HoleCfg then
if v.HoleCfg.EquipType == PearlInfo.Part then
if not v.IsOpen then
GameCenter.MsgPromptSystem:ShowPrompt(DataConfig.DataMessageString.Get("C_UI_SOULEQUIP_HOLECLOSE"))
else
local _msg = ReqMsg.MSG_SoulArmor.ReqWearSoulArmorBall:New()
_msg.slotId = k
_msg.ballId = PearlInfo.DBID
_msg:Send()
end
end
end
end
self.SlotDic:Foreach(_forFunction)
end
--设置魂印合成红点
function SoulEquipSystem:SetPeralSynthRed(allEquipList)
local function _forFunction(k, v)
if v.PearlInfo and v.IsOpen then
local _cfg = DataConfig.DataSoulArmorEquipSynthesis[v.PearlInfo.CfgID]
if _cfg then
if not allEquipList then
allEquipList = self:GetAllSoulPearl()
end
local itemflag = true
if _cfg.JoinItem and _cfg.JoinItem ~= "" then
local itemArr = Utils.SplitNumber(_cfg.JoinItem, '_')
if #itemArr >= 2 then
local itemID = itemArr[1]
local needNum = itemArr[2]
local haveNum = GameCenter.ItemContianerSystem:GetItemCountFromCfgId(itemID)
if haveNum < needNum then
itemflag = false;
if _cfg.ItemPrice and _cfg.ItemPrice ~= "" then
local coinArr = Utils.SplitNumber(_cfg.ItemPrice, '_');
if (#coinArr >= 2) then
local coinID = coinArr[1]
local price = coinArr[2]
local haveCoinNum = GameCenter.ItemContianerSystem:GetEconomyWithType(coinID);
if haveCoinNum >= price * (needNum - haveNum) then
itemflag = true;
end
if not self.PeralSynNeedItemList:Contains(coinID) then
self.PeralSynNeedItemList:Add(coinID)
end
end
end
end
if not self.PeralSynNeedItemList:Contains(itemID) then
self.PeralSynNeedItemList:Add(itemID)
end
end
end
if itemflag then
local _quaList = Utils.SplitNumber(_cfg.Quality, '_')
local _starList = Utils.SplitNumber(_cfg.Diamond, '_')
local _partList = List:New()
local _equipList = List:New()
if _cfg.JoinPart and _cfg.JoinPart ~= "" then
_partList = Utils.SplitNumber(_cfg.JoinPart, '_')
end
if allEquipList then
for i = 1, #allEquipList do
if ((#_partList > 0 and _partList:Contains(allEquipList[i].Part)) or #_partList == 0) and allEquipList[i].Quality == 6 and allEquipList[i].StarNum == 1 and _starList:Contains(allEquipList[i].StarNum) and _quaList:Contains(allEquipList[i].Quality) then
_equipList:Add(allEquipList[i])
end
end
end
local _per = 0
for i = 1, #_equipList do
local _starIndex = 0
local _quaIndex = 0
for j = 1, #_starList do
if _starList[j] == _equipList[i].StarNum then
local _starPerList = Utils.SplitNumber(_cfg.DiamondNumber, '_')
if _starPerList[j] then
_starIndex = _starPerList[j]
break
end
end
end
for j = 1, #_quaList do
if _quaList[j] == _equipList[i].Quality then
local _quaPerList = Utils.SplitNumber(_cfg.QualityNumber, '_')
if _quaPerList[j] then
_quaIndex = _quaPerList[j]
break
end
end
end
_per = _per + _cfg.JoinNumProbability * _quaIndex * _starIndex / 100000000
if _per >= 10000 then
break
end
end
if _per >= 10000 then
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.SoulPearlSynth, k, L_RedPointCustomCondition(true))
end
end
end
end
end
self.PeralSynNeedItemList:Clear()
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.SoulPearlSynth)
self.SlotDic:Foreach(_forFunction)
end
--获取每个部位战力最高的神印
function SoulEquipSystem:GetHightSoulPearlDic()
local _cacheDic = Dictionary:New()
local bpModel = GameCenter.NewItemContianerSystem:GetBackpackModelByType(LuaContainerType.ITEM_LOCATION_PEREAL);
if bpModel then
bpModel.ItemsOfIndex:Foreach(function(k, v)
local equip = v
if (_cacheDic:ContainsKey(equip.Part) and _cacheDic[equip.Part].Power < equip.Power) then
_cacheDic[equip.Part] = equip;
elseif not _cacheDic:ContainsKey(equip.Part) then
_cacheDic:Add(equip.Part, equip);
end
end)
end
return _cacheDic;
end
--查找所有魂印
function SoulEquipSystem:GetAllSoulPearl()
local equipList = GameCenter.NewItemContianerSystem:GetItemListNOGC(LuaContainerType.ITEM_LOCATION_PEREAL)
equipList:Sort(function(a, b)
if (a.Power ~= b.Power) then
return a.Power > b.Power
else
if (a.Quality ~= b.Quality) then
return a.Quality > b.Quality
else
if (a.Part ~= b.Part) then
return a.Part < b.Part
else
return a.CfgID < b.CfgID
end
end
end
end);
return equipList;
end
--查找可以进行合成的魂印
function SoulEquipSystem:GetSoulPearlCanSyn(quaList, starList, partList)
local list = List:New()
local bpModel = GameCenter.NewItemContianerSystem:GetBackpackModelByType(LuaContainerType.ITEM_LOCATION_PEREAL);
if bpModel then
bpModel.ItemsOfIndex:Foreach(function(k, v)
if (v and quaList:Contains(v.Quality) and starList:Contains(v.StarNum)) then
if (partList and #partList > 0) then
if (partList:Contains(v.Part)) then
list:Add(v);
end
else
list:Add(v);
end
end
end)
end
list:Sort(function(x, y)
return x.Power > y.Power
end);
return list;
end
--魂甲等级信息 镶嵌信息等
function SoulEquipSystem:ResSoulArmor(msg)
self.CurStrengthLv = msg.level
self.CurID = msg.qualityLevel
self.CurAwakeLv = msg.skillLevel
self.SlotDic:Clear()
self.AwakeSkillList:Clear()
if msg.slots then
for i = 1, #msg.slots do
local _tmp = {}
_tmp.SlotId = msg.slots[i].slot
if msg.slots[i].level then
_tmp.StrengLv = msg.slots[i].level
else
_tmp.StrengLv = 0
end
_tmp.IsOpen = msg.slots[i].isOpen
_tmp.HoleCfg = DataConfig.DataSoulArmorSignetHole[_tmp.SlotId]
if msg.slots[i].ball then
_tmp.PearlInfo = LuaItemBase.CreateItemBaseByMsg(msg.slots[i].ball)
if _tmp.PearlInfo then
_tmp.PearlInfo.SlotId = _tmp.SlotId
if _tmp.HoleCfg then
if self.DressPeralDic:ContainsKey(_tmp.HoleCfg.EquipType) then
self.DressPeralDic[_tmp.HoleCfg.EquipType] = _tmp.PearlInfo
else
self.DressPeralDic:Add(_tmp.HoleCfg.EquipType, _tmp.PearlInfo)
end
end
end
end
self.SlotDic:Add(_tmp.SlotId, _tmp)
end
end
if msg.skillList then
for i = 1, #msg.skillList do
self.AwakeSkillList:Add(msg.skillList[i])
end
end
self:SetPeralStrengthRed()
self:SetStrengthRed()
self:SetBreachRed()
self:SetAweakenRed()
self:SetLotteryRed()
self:SetPearlFightPower()
self.PearlBagUpdate = true
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_STRENGTHLV_UPDATE)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_BREAKLV_UPDATE)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_AWEAKLV_UPDATE)
end
--孔位信息更新
function SoulEquipSystem:ResUpdateSoulArmorBallSlot(msg)
if msg.slot then
local _tmp = {}
_tmp.SlotId = msg.slot.slot
_tmp.StrengLv = msg.slot.level
_tmp.IsOpen = msg.slot.isOpen
_tmp.HoleCfg = DataConfig.DataSoulArmorSignetHole[_tmp.SlotId]
if msg.slot.ball then
_tmp.PearlInfo = LuaItemBase.CreateItemBaseByMsg(msg.slot.ball)
if _tmp.PearlInfo then
_tmp.PearlInfo.SlotId = _tmp.SlotId
end
end
if _tmp.HoleCfg then
if self.DressPeralDic:ContainsKey(_tmp.HoleCfg.EquipType) then
self.DressPeralDic[_tmp.HoleCfg.EquipType] = _tmp.PearlInfo
else
self.DressPeralDic:Add(_tmp.HoleCfg.EquipType, _tmp.PearlInfo)
end
end
if self.SlotDic:ContainsKey(_tmp.SlotId) then
self.SlotDic[_tmp.SlotId] = _tmp
else
self.SlotDic:Add(_tmp.SlotId, _tmp)
end
end
self.PearlBagUpdate = true
self:SetPeralStrengthRed()
self:SetPearlFightPower()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_HOLEUPDATE, msg.slot.slot)
end
--更新淬炼等级
function SoulEquipSystem:ResUpdateSoulArmorLevel(msg)
self.CurStrengthLv = msg.level
self:SetStrengthRed()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_STRENGTHLV_UPDATE, true)
end
--更新突破等级
function SoulEquipSystem:ResSoulArmorQualityLevel(msg)
self.CurID = msg.qualityLevel
self:SetBreachRed()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_BREAKLV_UPDATE, true)
-- local _cfg = DataConfig.DataSoulArmorBreach[self.CurID]
-- if _cfg then
-- local _ar = Utils.SplitNumber(_cfg.MainTransfom, '_')
-- GameCenter.ModelViewSystem:ShowModel(ShowModelType.SoulEquip, _cfg.Model, _ar[1], _ar[6]/_ar[1], _cfg.Name)
-- end
end
--更新觉醒等级
function SoulEquipSystem:ResUpSoulArmorSkillLevel(msg)
if msg.skillId and not self.AwakeSkillList:Contains(msg.skillId) then
self.AwakeSkillList:Add(msg.skillId)
end
self.CurAwakeLv = msg.skillLevel
self:SetAweakenRed()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_AWEAKLV_UPDATE, true)
end
--神印阁等级经验更新
function SoulEquipSystem:ResSoulArmorLottery(msg)
if msg.exp > self.LotteryExp then
Utils.ShowPromptByEnum("C_SOULEQUIP_LOTTERY_ADDEXP", msg.exp - self.LotteryExp)
end
self.LotteryLv = msg.level
self.LotteryExp = msg.exp
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_LOTTERYLV_UPDATE)
end
--觉醒技能升级返回
function SoulEquipSystem:ResChangeSoulArmorSkill(msg)
if self.AwakeSkillList:Contains(msg.oldId) then
self.AwakeSkillList:Remove(msg.oldId)
end
self.AwakeSkillList:Add(msg.skillId)
self.AwakeSkillList:Sort(function(a, b)
return a < b
end)
self:SetAweakenRed()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULEQUIP_AWAKESKILL_LVUP, msg.skillId)
end
--背包变化监听
function SoulEquipSystem:OnPearlBagChange(obj, sender)
self.PearlBagUpdate = true
end
--物品变更
function SoulEquipSystem:OnItemChange(object, sender)
if #self.PeralSynNeedItemList > 0 and self.PeralSynNeedItemList:Contains(object) then
--判断是否显示红点
self.IsCheckSynthPoint = true
end
end
--魂印合成结果
function SoulEquipSystem:ResSoulArmorMerge(msg)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_SOULPERARL_SYNTHRESULT, msg.result)
end
return SoulEquipSystem