139 lines
3.5 KiB
Lua
139 lines
3.5 KiB
Lua
|
||
------------------------------------------------
|
||
--作者: dhq
|
||
--日期: 2021-05-6
|
||
--文件: DevilCampData.lua
|
||
--模块: DevilCampData
|
||
--描述: 魔魂系统阵营的数据
|
||
------------------------------------------------
|
||
local FightUtils = require "Logic.Base.FightUtils.FightUtils"
|
||
|
||
local DevilCampData =
|
||
{
|
||
Parent = nil,
|
||
CampId = nil,
|
||
Active = nil,
|
||
CardList = List:New(),
|
||
}
|
||
|
||
--装备的具体数据
|
||
local L_ItemInfo = {
|
||
--装备的配置表Id
|
||
CfgId = 0,
|
||
--装备配置
|
||
EquipCfg = nil,
|
||
--装备的唯一Id
|
||
DBID = 0,
|
||
}
|
||
|
||
--装备信息
|
||
local L_EquipInfo = {
|
||
--部位ID
|
||
Part = 0,
|
||
--装备信息
|
||
ItemInfo = nil,
|
||
}
|
||
|
||
--卡片的数据
|
||
local L_CardData = {
|
||
--魔魂卡id,CardMain配置表
|
||
Id = 0,
|
||
--装备信息
|
||
EquipPartDict = Dictionary:New(),
|
||
Level = 0,
|
||
--强化等阶
|
||
Rank = 0,
|
||
--是否激活
|
||
Active = false,
|
||
--突破等级
|
||
BreakLv = 0,
|
||
--战力
|
||
Power = 0,
|
||
--突破消耗装备列表
|
||
BreakCostIds = nil,
|
||
--激活或者强化消耗的物品列表
|
||
CostItems = nil,
|
||
}
|
||
|
||
function L_CardData:New()
|
||
local _m = Utils.DeepCopy(self)
|
||
return _m
|
||
end
|
||
|
||
function L_CardData:Parse(msg)
|
||
self.Id = msg.id
|
||
self.EquipPartDict:Clear()
|
||
local _equipList = msg.part
|
||
for j = 1, #_equipList do
|
||
local _equ = Utils.DeepCopy(L_EquipInfo)
|
||
--部位ID
|
||
_equ.Part = _equipList[j].id
|
||
if _equipList[j].equip ~= nil then
|
||
--装备的物品
|
||
_equ.ItemInfo = Utils.DeepCopy(L_ItemInfo)
|
||
_equ.ItemInfo.CfgId = _equipList[j].equip.itemModelId
|
||
_equ.ItemInfo.DBID = _equipList[j].equip.itemId
|
||
_equ.ItemInfo.EquipCfg = DataConfig.DataEquip[_equ.ItemInfo.CfgId]
|
||
else
|
||
_equ.ItemInfo = Utils.DeepCopy(L_ItemInfo)
|
||
end
|
||
self.EquipPartDict:Add(_equ.Part, _equ)
|
||
end
|
||
self.Level = msg.level
|
||
self.Active = msg.active
|
||
self.Rank = msg.rank
|
||
self.BreakLv = msg.breakLv
|
||
self.FightPower = msg.fightPoint
|
||
end
|
||
|
||
function L_CardData:RefreshData()
|
||
--强化消耗道具
|
||
self.CostItems = nil
|
||
local _dicKey = self.Id * 10000 + self.Rank * 100 + self.Level
|
||
local _tranCfg = GameCenter.DevilSoulSystem.TrainDict[_dicKey]
|
||
if _tranCfg ~= nil and string.len(_tranCfg.Condition) > 0 then
|
||
self.CostItems = Utils.SplitNumber(_tranCfg.Condition, '_')
|
||
end
|
||
--图片消耗装备
|
||
self.BreakCostIds = nil
|
||
local _breCfg = DataConfig.DataCrossDevilCardBreak[self.Id * 1000 + self.BreakLv + 1]
|
||
if _breCfg ~= nil then
|
||
self.BreakCostIds = Utils.SplitStrByTableS(_breCfg.Condition, {';', '_'})
|
||
end
|
||
end
|
||
|
||
function L_CardData:EquipWear(msg)
|
||
local _equip = self.EquipPartDict[msg.cellId]
|
||
--已穿戴装备id
|
||
_equip.ItemInfo.CfgId = msg.equipModelId
|
||
--已穿戴装备模板id
|
||
_equip.ItemInfo.DBID = msg.equipId
|
||
_equip.ItemInfo.EquipCfg = DataConfig.DataEquip[msg.equipModelId]
|
||
end
|
||
|
||
function DevilCampData:New(cardCamp, parent)
|
||
local _m = Utils.DeepCopy(self)
|
||
_m.Parent = parent
|
||
_m.CardList:Clear()
|
||
_m:RefeshData(cardCamp)
|
||
return _m
|
||
end
|
||
|
||
function DevilCampData:RefeshData(cardCamp)
|
||
--魔魂阵营id
|
||
self.CampId = cardCamp.campId
|
||
--是否激活
|
||
self.Active = cardCamp.active
|
||
--魔魂列表
|
||
local _cardList = cardCamp.card
|
||
if _cardList ~= nil then
|
||
for i = 1, #_cardList do
|
||
local _t = L_CardData:New()
|
||
_t:Parse(_cardList[i])
|
||
_t:RefreshData()
|
||
self.CardList:Add(_t)
|
||
end
|
||
end
|
||
end
|
||
|
||
return DevilCampData |