2020-08-25 15:46:38 +08:00
|
|
|
|
EquipManager = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local this = EquipManager
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
local equipStarsConfig = ConfigManager.GetConfig(ConfigName.EquipStarsConfig)
|
2020-07-10 18:29:38 +08:00
|
|
|
|
local rewardGroupConfig=ConfigManager.GetConfig(ConfigName.RewardGroup)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
--已装备的
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.equipDatas = {}
|
|
|
|
|
|
2020-07-06 20:35:39 +08:00
|
|
|
|
function this.Initialize()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
--upHeroDid
|
|
|
|
|
function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook)
|
|
|
|
|
if not this.equipDatas then
|
|
|
|
|
this.equipDatas = {}
|
|
|
|
|
end
|
|
|
|
|
id = tonumber(id)
|
|
|
|
|
if this.equipDatas[id] then
|
|
|
|
|
if not this.equipDatas[id].upHeroDidList then
|
|
|
|
|
this.equipDatas[id].upHeroDidList = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if upHeroDid and upHeroDid ~= "0" then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
else
|
|
|
|
|
local equipdata = {}
|
|
|
|
|
equipdata.equipConfig = equipConfig[id]
|
2020-07-07 16:35:57 +08:00
|
|
|
|
equipdata.itemConfig = itemConfig[id]
|
|
|
|
|
equipdata.id = id
|
|
|
|
|
if itemConfig[equipdata.id] then
|
|
|
|
|
equipdata.icon = GetResourcePath(itemConfig[equipdata.id].ResourceID)
|
|
|
|
|
else
|
|
|
|
|
Log(Language[10483] .. equipdata.id)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
equipdata.frame = GetQuantityImageByquality(equipdata.equipConfig.Quality)
|
|
|
|
|
equipdata.quality = equipdata.equipConfig.Quality
|
|
|
|
|
equipdata.position = equipdata.equipConfig.Position
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
equipdata.mainAttribute = this.GetMainProList(equipdata.equipConfig)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
equipdata.backData = equipdata
|
2020-07-13 16:16:56 +08:00
|
|
|
|
equipdata.star = equipStarsConfig[equipdata.equipConfig.Star].Stars
|
2020-07-07 16:35:57 +08:00
|
|
|
|
this.equipDatas[id] = equipdata
|
|
|
|
|
if not this.equipDatas[id].upHeroDidList then
|
|
|
|
|
this.equipDatas[id].upHeroDidList = {}
|
|
|
|
|
end
|
2020-06-30 18:59:44 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
if upHeroDid and upHeroDid ~= "0" and not this.equipDatas[id].upHeroDidList[upHeroDid] then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
isFindHandBook = isFindHandBook or true
|
|
|
|
|
if isFindHandBook then
|
|
|
|
|
PlayerManager.SetEquipHandBookListData(equipdata.id)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
function this.UpdateEquipData(idlist, heroDid)
|
|
|
|
|
for i = 1, #idlist do
|
2020-07-06 20:35:39 +08:00
|
|
|
|
this.InitUpdateEquipData(idlist[i], heroDid, false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-06 20:35:39 +08:00
|
|
|
|
-- --更新装备数据 新加
|
|
|
|
|
-- function this.UpdateEquipData(_equipData, isFindHandBook)
|
|
|
|
|
|
|
|
|
|
-- -- --新获得装备存红点
|
|
|
|
|
-- -- if equipConfig[_equipData.id] then
|
|
|
|
|
-- -- this.InitUpdateEquipData(_equipData.id,isFindHandBook)
|
|
|
|
|
-- -- if equipConfig[_equipData.id].Quality >= 4 then
|
|
|
|
|
-- -- table.insert(this.NewEquipList, _equipData.id)
|
|
|
|
|
-- -- -- 本地保存数据
|
|
|
|
|
-- -- local str = table.concat(this.NewEquipList, "|")
|
|
|
|
|
-- -- PlayerPrefs.SetString("EquipNew" .. PlayerManager.uid, str)
|
|
|
|
|
-- -- end
|
|
|
|
|
-- -- end
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
--获取单个装备数据
|
|
|
|
|
function this.GetSingleEquipData(_equipid)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
_equipid = tonumber(_equipid)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if not this.equipDatas[_equipid] then
|
2020-07-07 16:35:57 +08:00
|
|
|
|
this.InitUpdateEquipData(_equipid, nil, false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
return this.equipDatas[_equipid]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
--通过装备职业和位置获得装备list.包括英雄自己身上装备的
|
2020-07-07 16:35:57 +08:00
|
|
|
|
function this.GetEquipDataByEquipJobAndPos(_pos, _job, _heroDid)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--没装备的
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local equips = BagManager.GetEquipDataByEquipPosition(_job, _pos)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local equipDatas = {}
|
|
|
|
|
local index = 1
|
|
|
|
|
|
|
|
|
|
-- --自己装备
|
|
|
|
|
-- local idlist= HeroManager.GetHeroEquipIdList(_heroDid)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
-- if not idlist then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
-- return equips
|
2020-07-07 16:35:57 +08:00
|
|
|
|
-- end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
-- for __,equip in ipairs(equips) do
|
|
|
|
|
-- local add = true
|
|
|
|
|
-- --如果没装备的包含自己装备的
|
|
|
|
|
-- for i, v in ipairs(idlist) do
|
|
|
|
|
-- if tonumber(equip.id) == tonumber(v) then
|
|
|
|
|
-- add = false
|
|
|
|
|
-- break
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- --如果没装备的不包含自己装备的
|
|
|
|
|
-- if add then
|
|
|
|
|
-- for i, v in ipairs(idlist) do
|
|
|
|
|
-- local equip = this.GetSingleHeroSingleEquipData(tonumber(v),_heroDid)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
-- if equip and (equip.equipConfig.Position == _pos or not _pos or _pos == 0) and (equip.equipConfig.ProfessionLimit == _job or not _job) then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
-- equips[#equips+1] = equip
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return equips
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置装备穿戴的英雄
|
2020-07-06 20:35:39 +08:00
|
|
|
|
function this.SetEquipUpHeroDid(_equipid, _heroDid)
|
|
|
|
|
_equipid = tonumber(_equipid)
|
|
|
|
|
if not this.equipDatas[_equipid] then
|
2020-07-07 16:35:57 +08:00
|
|
|
|
this.InitUpdateEquipData(_equipid, _heroDid, false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-07-07 16:35:57 +08:00
|
|
|
|
if not this.equipDatas[_equipid].upHeroDidList then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
this.equipDatas[_equipid].upHeroDidList = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
this.equipDatas[_equipid].upHeroDidList[_heroDid] = _heroDid
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
--删除装备穿戴的英雄
|
|
|
|
|
function this.DeleteSingleEquip(_equipid, _heroDid)
|
|
|
|
|
_equipid = tonumber(_equipid)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
if
|
|
|
|
|
this.equipDatas[_equipid] and this.equipDatas[_equipid].upHeroDidList and
|
|
|
|
|
this.equipDatas[_equipid].upHeroDidList[_heroDid]
|
|
|
|
|
then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
this.equipDatas[_equipid].upHeroDidList[_heroDid] = nil
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
--获取单个英雄装备数据
|
|
|
|
|
function this.GetSingleHeroSingleEquipData(_equipid, _heroDid)
|
|
|
|
|
_equipid = tonumber(_equipid)
|
2020-12-15 11:03:34 +08:00
|
|
|
|
if this.equipDatas[_equipid] and this.equipDatas[_equipid].upHeroDidList and this.equipDatas[_equipid].upHeroDidList[_heroDid] then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
return this.equipDatas[_equipid]
|
2020-12-15 11:03:34 +08:00
|
|
|
|
elseif HarmonyManager.GetSingleAdditions(HarmonyAddType.AddEquip) > 0 and HarmonyManager.IsInfo(_heroDid) then
|
|
|
|
|
return HarmonyManager.equipDatas[_equipid]--.upHeroDidList[_heroDid]
|
2020-07-06 20:35:39 +08:00
|
|
|
|
else
|
|
|
|
|
return nil
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
-- --工坊 获得装备品品质获得装备list
|
|
|
|
|
-- function this.WorkShopGetEquipDataByEquipQuality(_equipQuality, _rebuildEquipDid)
|
|
|
|
|
-- local equips = {}
|
|
|
|
|
-- for i, v in pairs(EquipManager.equipDatas) do
|
|
|
|
|
-- if v.equipConfig.Quality == _equipQuality then
|
|
|
|
|
-- if v.did ~= _rebuildEquipDid then
|
|
|
|
|
-- if v.upHeroDid == "0" then
|
|
|
|
|
-- table.insert(equips, v)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- return equips
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
-- --工坊 获得可重铸所有装备
|
|
|
|
|
-- function this.GetAllEquipDataIfClear()
|
|
|
|
|
-- local equips = {}
|
|
|
|
|
-- for i, v in pairs(EquipManager.equipDatas) do
|
|
|
|
|
-- if v.equipConfig.IfClear == 1 then
|
|
|
|
|
-- table.insert(equips, v)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- return equips
|
|
|
|
|
-- end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--地图临时背包数据
|
2020-07-06 20:35:39 +08:00
|
|
|
|
this.mapShotTimeItemData = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--地图临时装备数据存储
|
|
|
|
|
function this.InitMapShotTimeEquipBagData(_mapEquip)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
Log(Language[10486] .. _mapEquip.id)
|
|
|
|
|
this.mapShotTimeItemData[#this.mapShotTimeItemData + 1] = _mapEquip
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
--计算战斗力
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
|
|
|
|
function this.CalculateWarForce(equipid, data)
|
|
|
|
|
equipid = tonumber(equipid)
|
|
|
|
|
local curEquip = equipConfig[equipid]
|
|
|
|
|
if curEquip then --正常背包
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local num = this.CalculateEquipWarForce(curEquip)
|
|
|
|
|
return num
|
|
|
|
|
else
|
2020-07-06 20:35:39 +08:00
|
|
|
|
curEquip = data
|
|
|
|
|
if curEquip then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local num = this.CalculateEquipWarForce(curEquip)
|
|
|
|
|
return num
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--根据装备数据计算战斗力
|
|
|
|
|
function this.CalculateEquipWarForce(curEquip)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local addAllProVal = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i, v in ConfigPairs(propertyConfig) do
|
2020-07-06 20:35:39 +08:00
|
|
|
|
addAllProVal[i] = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local mainAttribute = this.GetMainProList(curEquip)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
for index, prop in pairs(mainAttribute) do
|
2020-06-13 11:47:13 +08:00
|
|
|
|
local id = prop.propertyId
|
|
|
|
|
local value = prop.propertyValue
|
|
|
|
|
if addAllProVal[id] then
|
|
|
|
|
addAllProVal[id] = addAllProVal[id] + value
|
|
|
|
|
else
|
|
|
|
|
addAllProVal[id] = value
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local powerEndVal = 0
|
2020-06-28 17:48:49 +08:00
|
|
|
|
for i, v in pairs(addAllProVal) do
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if v > 0 then
|
|
|
|
|
local curProConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig, i)
|
2020-06-28 17:48:49 +08:00
|
|
|
|
if curProConfigData then
|
|
|
|
|
if curProConfigData.Style == 1 then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
powerEndVal = powerEndVal + v * HeroManager.heroPropertyScore[i]
|
2020-06-28 17:48:49 +08:00
|
|
|
|
else
|
2020-07-06 20:35:39 +08:00
|
|
|
|
powerEndVal = powerEndVal + v / 100 * HeroManager.heroPropertyScore[i]
|
2020-06-28 17:48:49 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if curEquip and curEquip.Score > 0 then
|
|
|
|
|
powerEndVal = powerEndVal + curEquip.Score
|
2020-06-28 17:48:49 +08:00
|
|
|
|
end
|
|
|
|
|
return math.floor(powerEndVal)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 判断是否是新装备
|
|
|
|
|
function this.IsNewEquipFrame(equipDId)
|
|
|
|
|
if not this.NewEquipList then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
for _, newEquipId in ipairs(this.NewEquipList) do
|
|
|
|
|
if newEquipId == equipDId then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 设置已经不是新装备了
|
|
|
|
|
function this.SetNotNewEquipAnyMore(equipDId)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if not this.NewEquipList then
|
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local index = nil
|
|
|
|
|
for i, newEquipId in ipairs(this.NewEquipList) do
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if newEquipId == equipDId then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
index = i
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if not index then
|
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
table.remove(this.NewEquipList, index)
|
|
|
|
|
-- 保存数据
|
|
|
|
|
local str = table.concat(this.NewEquipList, "|")
|
2020-07-06 20:35:39 +08:00
|
|
|
|
PlayerPrefs.SetString("EquipNew" .. PlayerManager.uid, str)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--装备合成
|
|
|
|
|
--通过装备位置获得装备list {[绿1]= {},[绿2]= {},}
|
|
|
|
|
function this.GetEquipCompoundDataByEquipPosition1(_position)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
local starEquips = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig, "Position", _position)
|
|
|
|
|
--LogBlue(#starEquips)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
table.sort(
|
|
|
|
|
starEquips,
|
|
|
|
|
function(a, b)
|
|
|
|
|
return a.Star > b.Star
|
|
|
|
|
end
|
|
|
|
|
)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local num = starEquips[1].Star
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--LogBlue(num)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local equips = {}
|
|
|
|
|
for i = 1, num do
|
2020-05-09 13:31:21 +08:00
|
|
|
|
equips[i] = 0
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local equipDatas = BagManager.GetEquipDataByEquipPosition(nil, _position)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--LogBlue(#equipDatas)
|
|
|
|
|
for i, v in ipairs(equipDatas) do
|
|
|
|
|
local equip = this.GetSingleEquipData(v.id)
|
|
|
|
|
--LogBlue(equip.id.." "..equip.equipConfig.Star.." "..v.num)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
if equips[equip.equipConfig.Star] then
|
|
|
|
|
equips[equip.equipConfig.Star] = equips[equip.equipConfig.Star] + v.num
|
|
|
|
|
else
|
|
|
|
|
equips[equip.equipConfig.Star] = v.num
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
return equips
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--得到背包里能合成equipSData的装备
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.GetBagCompoundEquipDatasByequipSData(equipSData)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--LogBlue(equipSData.Id.." "..equipSData.Position.." "..equipSData.Star)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local equips = {}
|
2020-07-07 16:35:57 +08:00
|
|
|
|
local equipDatas = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
2020-07-06 20:35:39 +08:00
|
|
|
|
--LogBlue(#equipDatas)
|
|
|
|
|
for i, v in ipairs(equipDatas) do
|
|
|
|
|
local equipdata = this.GetSingleEquipData(v.id)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
if equipdata.equipConfig.Position == equipSData.Position and equipdata.equipConfig.Star == equipSData.Star - 1 then
|
2020-07-06 20:35:39 +08:00
|
|
|
|
table.insert(equips, v)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
-- for i, v in ipairs(equips) do
|
|
|
|
|
-- LogBlue(v.id)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return equips
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--获取静态表中可合成装备静态信息
|
|
|
|
|
function this.GetAllSEquipsByPosition(_position)
|
|
|
|
|
local starEquips = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig, "Position", _position)
|
2020-07-07 16:35:57 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local equips = {}
|
|
|
|
|
for i = 1, #starEquips do
|
2020-07-06 20:35:39 +08:00
|
|
|
|
if starEquips[i].Star and starEquips[i].Star > 0 and starEquips[i].Star ~= 1 then --最低等级的装备 合成不了
|
|
|
|
|
table.insert(equips, starEquips[i])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
table.sort(
|
|
|
|
|
equips,
|
|
|
|
|
function(a, b)
|
|
|
|
|
if a.Star == b.Star then
|
|
|
|
|
return a.Id < b.Id
|
|
|
|
|
else
|
|
|
|
|
return a.Star < b.Star
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-06 20:35:39 +08:00
|
|
|
|
)
|
|
|
|
|
-- LogBlue(#equips)
|
|
|
|
|
-- for i = 1, #equips do
|
|
|
|
|
-- LogBlue(equips[i].Id.." "..equips[i].Star)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return equips
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-06 20:35:39 +08:00
|
|
|
|
function this.SetEquipStarShow(starGrid, equipId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if equipConfig[equipId] then
|
|
|
|
|
local curequipStarsConfig = equipStarsConfig[equipConfig[equipId].Star]
|
|
|
|
|
if curequipStarsConfig then
|
|
|
|
|
starGrid:SetActive(true)
|
2020-07-24 20:03:06 +08:00
|
|
|
|
SetHeroStars(starGrid, curequipStarsConfig.Stars,1,Vector2.New(32.5,32.5),-15)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-06 20:35:39 +08:00
|
|
|
|
function this.GetMainProList(equipConfig)
|
|
|
|
|
local propList = {}
|
|
|
|
|
for index, prop in ipairs(equipConfig.Property) do
|
|
|
|
|
propList[index] = {}
|
|
|
|
|
propList[index].propertyId = prop[1]
|
|
|
|
|
propList[index].propertyValue = prop[2]
|
|
|
|
|
propList[index].PropertyConfig = propertyConfig[prop[1]]
|
|
|
|
|
end
|
|
|
|
|
return propList
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-10 18:29:38 +08:00
|
|
|
|
function this.GetEquipRewardList(equiplist)
|
|
|
|
|
local rewardlist = {}
|
|
|
|
|
for k,v in ipairs(equiplist) do
|
|
|
|
|
if v.itemConfig.ResolveReward and v.itemConfig.ResolveReward ~="" then
|
|
|
|
|
local rewardGroup =rewardGroupConfig[tonumber(v.itemConfig.ResolveReward)]
|
|
|
|
|
if rewardGroup and rewardGroup.ShowItem and #rewardGroup.ShowItem > 0 then
|
|
|
|
|
for i = 1,#rewardGroup.ShowItem do
|
|
|
|
|
local rewardId = rewardGroup.ShowItem[i][1]
|
|
|
|
|
local rewardNum = rewardGroup.ShowItem[i][2]
|
|
|
|
|
if rewardlist[rewardId] then
|
|
|
|
|
rewardlist[rewardId] = rewardlist[rewardId] + v.num * rewardNum
|
|
|
|
|
else
|
|
|
|
|
rewardlist[rewardId] = v.num * rewardNum
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return rewardlist
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-07 21:45:22 +08:00
|
|
|
|
function this.GetMinEquipStar(equiplist)
|
2021-01-20 13:52:53 +08:00
|
|
|
|
-- body ,equipConfig[equiplist[i]],equipConfig[equiplist[i]].Star
|
2021-01-07 21:45:22 +08:00
|
|
|
|
if #equiplist == 0 then
|
|
|
|
|
-- body
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
local _list = {}
|
2021-01-20 13:52:53 +08:00
|
|
|
|
|
|
|
|
|
--print(#equiplist," 1111 @@@@@@@@@")
|
2021-01-07 21:45:22 +08:00
|
|
|
|
for i = 1, #equiplist do
|
|
|
|
|
-- body
|
2021-01-20 13:52:53 +08:00
|
|
|
|
table.insert(_list,equipConfig[tonumber(equiplist[i])])
|
|
|
|
|
|
|
|
|
|
--print("执行程序s",equiplist[i],equipConfig[ tonumber(equiplist[i])].Name,equipConfig)
|
2021-01-07 21:45:22 +08:00
|
|
|
|
end
|
2021-01-20 13:52:53 +08:00
|
|
|
|
|
|
|
|
|
-- print(#_list," 1.5 @@@@@@@@@")
|
|
|
|
|
-- print(LengthOfTable(_list)," 2222 @@@@@@@@@")
|
2021-01-07 21:45:22 +08:00
|
|
|
|
local _minStar = 999
|
2021-01-20 13:52:53 +08:00
|
|
|
|
|
2021-01-07 21:45:22 +08:00
|
|
|
|
for i = 1, #_list do
|
|
|
|
|
-- body
|
|
|
|
|
if _minStar > _list[i].Star then
|
|
|
|
|
-- body
|
|
|
|
|
_minStar = _list[i].Star
|
2021-01-20 13:52:53 +08:00
|
|
|
|
end
|
|
|
|
|
--print(_list[i].Star," !!!!!!!!!!")
|
2021-01-07 21:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
return _minStar
|
|
|
|
|
end
|
2020-07-10 19:13:29 +08:00
|
|
|
|
return this
|