2021-04-20 13:58:00 +08:00
|
|
|
|
HarmonyManager = {}
|
2020-11-27 17:59:25 +08:00
|
|
|
|
local this = HarmonyManager
|
2021-09-14 17:32:06 +08:00
|
|
|
|
|
|
|
|
|
local HongmengUp = ConfigManager.GetConfig(ConfigName.HongmengUp)-- 鸿蒙塔升级数据表
|
2020-12-15 11:03:34 +08:00
|
|
|
|
-- 第一阶段 鸿蒙阵数据
|
2020-11-27 17:59:25 +08:00
|
|
|
|
this.hongmengGuards = {}
|
|
|
|
|
this.hongmengHeroInfos = {}
|
|
|
|
|
this.hongmengTablet = 0
|
|
|
|
|
this.hongmengAdditions = {}
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
this.GuardList = {}
|
|
|
|
|
local SelectId = nil
|
|
|
|
|
|
|
|
|
|
HarmonyManager.GongMingBox = 0;
|
|
|
|
|
HarmonyManager.UnLoadGongMing = 0
|
|
|
|
|
--判断是否鸿蒙共享数据
|
|
|
|
|
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
2020-12-28 14:12:17 +08:00
|
|
|
|
this.tab=ConfigManager.GetConfig(ConfigName.Hongmeng)
|
2020-12-23 17:41:31 +08:00
|
|
|
|
HarmonyManager.TowerStartLimit = 0
|
2020-12-15 11:03:34 +08:00
|
|
|
|
HarmonyManager.equipCount = 0
|
|
|
|
|
this.hongmengGongMingList = {}
|
|
|
|
|
this.ChooseDataList = {}
|
|
|
|
|
|
|
|
|
|
-- 第二阶段 鸿蒙塔 数据
|
2020-12-17 10:41:00 +08:00
|
|
|
|
--330 鸿蒙使者 数据
|
2020-12-15 11:03:34 +08:00
|
|
|
|
|
2020-12-28 14:12:17 +08:00
|
|
|
|
local keys = nil
|
|
|
|
|
|
2021-09-14 17:32:06 +08:00
|
|
|
|
function this.GetHongMengServerData(msg)
|
|
|
|
|
local data2 = ConfigManager.GetConfigData(ConfigName.SpecialConfig,101).Value
|
|
|
|
|
local d = string.split(data2,"#")
|
|
|
|
|
if msg.hongmengTabletMax >= tonumber(d[2]) then
|
|
|
|
|
HarmonyManager:SetHongMengTowerUpLimit(msg.hongmengTabletMax)
|
|
|
|
|
end
|
|
|
|
|
-- LogError("服务器发来的hongmengGuards长度:"..tostring(#msg.hongmengGuards))
|
|
|
|
|
if msg.hongmengGuards then
|
|
|
|
|
-- for i = 1, #msg.hongmengGuards do
|
|
|
|
|
-- if msg.hongmengGuards[i].heroId == "" then
|
|
|
|
|
-- Log("鸿蒙守卫:"..i.."为nil")
|
|
|
|
|
-- else
|
|
|
|
|
-- Log("鸿蒙守卫:"..i..HeroManager.GetSingleHeroData(msg.hongmengGuards[i].heroId).name)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
HarmonyManager.UpdateHongMengDataGuards(msg.hongmengGuards)
|
|
|
|
|
end
|
|
|
|
|
-- LogError("服务器发来的hongmengAdditions长度:"..tostring(#msg.hongmengAdditions))
|
|
|
|
|
if msg.hongmengAdditions then
|
|
|
|
|
for i = 1, #msg.hongmengAdditions do
|
|
|
|
|
-- body
|
|
|
|
|
end
|
|
|
|
|
HarmonyManager.UpdateHongMengDataAdditions(msg.hongmengAdditions)
|
2020-12-17 10:41:00 +08:00
|
|
|
|
end
|
2021-09-14 17:32:06 +08:00
|
|
|
|
if msg.hongmengResonacnes then
|
|
|
|
|
HarmonyManager.UpdateHongMengDataHeroInfos(msg.hongmengResonacnes)
|
|
|
|
|
end
|
|
|
|
|
if GuideManager.IsFirstOpenHarmonyBei then
|
|
|
|
|
GuideManager.IsFirstOpenHarmonyBei = false
|
|
|
|
|
for i = 1, #HarmonyManager.hongmengGuards do
|
|
|
|
|
if HarmonyManager.hongmengGuards[i].heroId ~= "" then
|
|
|
|
|
local _heroData = HeroManager.GetSingleHeroData(HarmonyManager.hongmengGuards[i].heroId)
|
|
|
|
|
HeroManager.UpdateSingleHeroDatas(_heroData.dynamicId, 1, _heroData.star, 0, _heroData.upStarId)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--鸿蒙数据有变化时更新英雄战力数据
|
|
|
|
|
for i = 1, #msg.hongmengGuards do
|
|
|
|
|
if msg.hongmengGuards[i].heroId~="" then
|
|
|
|
|
HeroManager.UpdateSingleHeroWarPower(msg.hongmengGuards[i].heroId)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #msg.hongmengResonacnes do
|
|
|
|
|
if msg.hongmengResonacnes[i].heroId~="" then
|
|
|
|
|
HeroManager.UpdateSingleHeroWarPower(msg.hongmengResonacnes[i].heroId)
|
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2020-12-21 18:19:38 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
|
2021-09-14 17:32:06 +08:00
|
|
|
|
|
2020-12-26 15:07:51 +08:00
|
|
|
|
function this.UpdateHongMengDataGuards(hongmengGuards)
|
2021-01-15 15:44:43 +08:00
|
|
|
|
this.TowerStartLimit = tonumber(string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,101).Value,"#")[2])
|
2020-12-21 18:19:38 +08:00
|
|
|
|
this.hongmengGuards = hongmengGuards
|
2021-01-15 15:44:43 +08:00
|
|
|
|
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("hongmengGuards "..#this.hongmengGuards)
|
2020-12-28 14:12:17 +08:00
|
|
|
|
for i = 1, #this.hongmengGuards do
|
2020-12-30 14:50:38 +08:00
|
|
|
|
if this.hongmengGuards[i].time ~= 0 then
|
|
|
|
|
this.hongmengGuards[i].time = this.hongmengGuards[i].time + GetTimeStamp()
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-28 14:12:17 +08:00
|
|
|
|
end
|
2020-12-29 20:36:37 +08:00
|
|
|
|
if this.hongmengAdditions[1] then
|
|
|
|
|
if this.hongmengAdditions[1].heroTid == 0 then
|
|
|
|
|
this:SetTowerInit()
|
|
|
|
|
elseif this.hongmengAdditions[1].heroTid == -1 then
|
|
|
|
|
else
|
|
|
|
|
this:SetInitList()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-26 15:07:51 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.UpdateHongMengDataHeroInfos(hongmengHeroInfos)
|
|
|
|
|
this.hongmengHeroInfos = hongmengHeroInfos
|
2021-06-26 18:56:58 +08:00
|
|
|
|
-- LogGreen("hongmengHeroInfos "..#this.hongmengHeroInfos)
|
2020-12-28 14:12:17 +08:00
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
2020-12-30 14:50:38 +08:00
|
|
|
|
if this.hongmengHeroInfos[i].time ~= 0 then
|
|
|
|
|
this.hongmengHeroInfos[i].time = this.hongmengHeroInfos[i].time + GetTimeStamp()
|
|
|
|
|
end
|
2021-06-26 18:56:58 +08:00
|
|
|
|
--鸿蒙阵共鸣后直接大于20级 后没有赋值大闹天宫英雄血量 大闹天宫一键上阵报错
|
|
|
|
|
-- LogYellow("this.hongmengHeroInfos[i].heroId "..this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
if not ExpeditionManager.heroInfo[this.hongmengHeroInfos[i].heroId] then
|
|
|
|
|
-- LogRed("this.hongmengHeroInfos[i].heroId "..this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
ExpeditionManager.InitHeroHpValue(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
end
|
2020-12-28 14:12:17 +08:00
|
|
|
|
end
|
2020-12-28 10:44:31 +08:00
|
|
|
|
|
2020-12-29 20:36:37 +08:00
|
|
|
|
if this.hongmengAdditions[1] then
|
|
|
|
|
if this.hongmengAdditions[1].heroTid == 0 then
|
|
|
|
|
this:SetTowerInit()
|
|
|
|
|
elseif this.hongmengAdditions[1].heroTid == -1 then
|
|
|
|
|
else
|
|
|
|
|
this:SetInitList()
|
|
|
|
|
end
|
2020-12-28 10:44:31 +08:00
|
|
|
|
end
|
2020-12-26 15:07:51 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.UpdateHongMengDataAdditions(hongmengAdditions)
|
2020-12-21 18:19:38 +08:00
|
|
|
|
this.hongmengAdditions = hongmengAdditions
|
2021-09-14 17:32:06 +08:00
|
|
|
|
-- for i = 1, #this.hongmengAdditions do
|
2021-07-29 11:13:34 +08:00
|
|
|
|
-- LogGreen("this.hongmengAdditions[i].heroTid:"..this.hongmengAdditions[i].heroTid)
|
|
|
|
|
-- LogGreen("this.hongmengAdditions[i].value:"..this.hongmengAdditions[i].value)
|
|
|
|
|
-- LogGreen("this.hongmengAdditions[i].additionType:"..this.hongmengAdditions[i].additionType)
|
2021-09-14 17:32:06 +08:00
|
|
|
|
-- end
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("hongmengAdditions "..#this.hongmengAdditions)
|
2020-12-29 20:36:37 +08:00
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
2020-12-28 20:02:36 +08:00
|
|
|
|
if this.hongmengAdditions[i].additionType == HarmonyAddType.AddEquip then
|
2020-12-29 20:36:37 +08:00
|
|
|
|
if this.hongmengAdditions[i].value > 0 then
|
|
|
|
|
local curEquipIdList = {}
|
|
|
|
|
local curEquipConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig,"Star",this.hongmengAdditions[i].value)
|
|
|
|
|
for i = 1, #curEquipConfigs do
|
|
|
|
|
table.insert(curEquipIdList,curEquipConfigs[i].Id)
|
|
|
|
|
end
|
|
|
|
|
this.HarmonyUpdateEquipData(curEquipIdList, "")
|
2020-12-28 20:02:36 +08:00
|
|
|
|
end
|
2020-12-24 16:34:12 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-29 20:36:37 +08:00
|
|
|
|
if this.hongmengAdditions[1] then
|
|
|
|
|
if this.hongmengAdditions[1].heroTid == 0 then
|
|
|
|
|
this:SetTowerInit()
|
|
|
|
|
elseif this.hongmengAdditions[1].heroTid == -1 then
|
|
|
|
|
else
|
|
|
|
|
this:SetInitList()
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化共鸣列表数据
|
|
|
|
|
function this:InitGongMingDataList()
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
if data then
|
|
|
|
|
this.hongmengGongMingList[i] = data
|
|
|
|
|
else
|
|
|
|
|
this.hongmengGongMingList[i] = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--鸿蒙塔上限
|
2020-12-28 20:02:36 +08:00
|
|
|
|
|
|
|
|
|
local len = 0
|
|
|
|
|
function this:SetHongMengTowerUpLimit(limit)
|
|
|
|
|
len = limit
|
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:HongMengTowerUpLimit()
|
2020-12-17 10:41:00 +08:00
|
|
|
|
return len
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.IsInfo(did)
|
|
|
|
|
if did ~= "" then
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId and this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-14 17:32:06 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
return false
|
2021-09-14 17:32:06 +08:00
|
|
|
|
end
|
2020-12-18 16:37:56 +08:00
|
|
|
|
--共鸣神将
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this.IsChangeColor(did)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
2020-12-17 10:41:00 +08:00
|
|
|
|
function this.IsGongMing(did)
|
2020-12-15 11:03:34 +08:00
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId then
|
2021-03-04 15:16:23 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[12192])
|
2020-12-15 11:03:34 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-02-20 11:00:40 +08:00
|
|
|
|
--初始化选人列表的长度
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:SetInitList()
|
|
|
|
|
local heroDataList = HeroManager.GetAllHeroDatas(1)
|
|
|
|
|
local list = {}
|
|
|
|
|
local count = 0;
|
|
|
|
|
--LogBlue("this.GuardList长度:"..LengthOfTable(this.GuardList))
|
2021-01-08 17:29:54 +08:00
|
|
|
|
for key, value in pairs(this.hongmengGuards) do
|
2020-12-18 13:39:35 +08:00
|
|
|
|
if value.heroId ~= "" then
|
2021-01-08 17:29:54 +08:00
|
|
|
|
local singleHero = HeroManager.GetSingleHeroData(value.heroId)
|
|
|
|
|
table.insert(list,singleHero)
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
-- LogYellow("是否有数据:"..i)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
table.insert(list,data)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.sort(list,function(a,b)
|
|
|
|
|
return a.dynamicId < b.dynamicId
|
|
|
|
|
end)
|
|
|
|
|
--LogBlue("#list长度:"..#list)
|
|
|
|
|
local newList = {}
|
|
|
|
|
local index = 0
|
|
|
|
|
local flag = true
|
|
|
|
|
local tempTable = {}
|
|
|
|
|
for i = 1, #heroDataList do
|
|
|
|
|
table.insert(tempTable,heroDataList[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = #heroDataList, 1,-1 do
|
|
|
|
|
for k2, v2 in pairs(list) do
|
|
|
|
|
if v2.dynamicId == heroDataList[i].dynamicId then
|
|
|
|
|
--LogPink("第几个:"..i.." k2"..k2)
|
|
|
|
|
table.remove(tempTable,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.ChooseDataList = tempTable
|
|
|
|
|
|
2021-06-04 16:10:17 +08:00
|
|
|
|
-- LogBlue("#this.ChooseDataList长度:"..#this.ChooseDataList)
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
--初始化 鸿蒙塔的数据
|
|
|
|
|
function this:SetTowerInit()
|
|
|
|
|
|
|
|
|
|
local heroDataList = HeroManager.GetAllHeroDatas(1)
|
|
|
|
|
local list = {}
|
|
|
|
|
local count = 0;
|
2020-12-23 17:41:31 +08:00
|
|
|
|
|
2020-12-18 13:39:35 +08:00
|
|
|
|
for key, value in pairs(this.hongmengGuards) do
|
|
|
|
|
if value.heroId ~= "" then
|
2021-01-08 17:29:54 +08:00
|
|
|
|
local singleHero = HeroManager.GetSingleHeroData(value.heroId)
|
|
|
|
|
table.insert(list,singleHero)
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--LogBlue("#this.hongmengHeroInfos"..#this.hongmengHeroInfos)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
--LogYellow("是否有数据:"..i)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
table.insert(list,data)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(list,function(a,b)
|
|
|
|
|
return a.dynamicId < b.dynamicId
|
|
|
|
|
end)
|
|
|
|
|
--LogBlue("#list长度:"..#list)
|
|
|
|
|
local newList = {}
|
|
|
|
|
local index = 0
|
|
|
|
|
local flag = true
|
|
|
|
|
|
|
|
|
|
local tempTable = {}
|
|
|
|
|
for i = 1, #heroDataList do
|
|
|
|
|
table.insert(tempTable,heroDataList[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = #heroDataList, 1,-1 do
|
|
|
|
|
for k2, v2 in pairs(list) do
|
|
|
|
|
if v2.dynamicId == heroDataList[i].dynamicId then
|
|
|
|
|
-- LogPink("第几个:"..i.." k2"..k2)
|
|
|
|
|
table.remove(tempTable,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.ChooseDataList = tempTable
|
2020-12-28 10:44:31 +08:00
|
|
|
|
--LogBlue("#this.ChooseDataList长度:"..#this.ChooseDataList)
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2020-12-17 10:41:00 +08:00
|
|
|
|
--判断鸿蒙 使者/守卫 是否够6位
|
|
|
|
|
function this:IsEnvoyCount()
|
|
|
|
|
-- body
|
|
|
|
|
local count = 1
|
2020-12-15 11:03:34 +08:00
|
|
|
|
for i = 1, #this.hongmengGuards do
|
2020-12-17 10:41:00 +08:00
|
|
|
|
if this.hongmengGuards[i].heroId ~= "" then
|
|
|
|
|
count =count + 1
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-12-17 10:41:00 +08:00
|
|
|
|
end
|
|
|
|
|
return count
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2020-12-17 10:41:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--初始化鸿蒙使者的数据
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--是否是鸿蒙使者
|
|
|
|
|
function this:IsEnvoy(did)
|
2021-01-26 14:47:01 +08:00
|
|
|
|
if this:HongMengTowerUpLimit() == 0 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-09-14 17:32:06 +08:00
|
|
|
|
-- LogError("hongmengGuards长度:"..tostring(#this.hongmengGuards))
|
|
|
|
|
for i = 1, #this.hongmengGuards do
|
|
|
|
|
if this.hongmengGuards[i].heroId == did then
|
|
|
|
|
return true
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2021-09-14 17:32:06 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- 设置、获取鸿蒙守卫的列表
|
|
|
|
|
function this:SetGuardList(list,count)
|
|
|
|
|
for key, value in pairs(list) do
|
|
|
|
|
if key<=count then
|
|
|
|
|
this.GuardList[value.dynamicId] = value
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
function this:GetGuardList()
|
|
|
|
|
return this.GuardList
|
2020-11-27 17:59:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:SetGongMingList(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
table.insert(this.hongmengGongMingList,data)
|
2021-06-28 11:27:50 +08:00
|
|
|
|
-- LogYellow("Id "..Id)
|
|
|
|
|
if not ExpeditionManager.heroInfo[Id] then
|
|
|
|
|
-- LogRed("Id "..Id)
|
|
|
|
|
ExpeditionManager.InitHeroHpValue(Id)
|
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:RemoveGongMingList(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
for key, value in pairs(this.hongmengGongMingList) do
|
|
|
|
|
if value then
|
|
|
|
|
if value==data then
|
|
|
|
|
value = nil
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:GetGongMingListSingle(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
for key, value in pairs(this.hongmengGongMingList) do
|
|
|
|
|
if value.dynamicId==data.dynamicId then
|
|
|
|
|
return value
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this:SetChooseId(id)
|
|
|
|
|
SelectId = id
|
2021-09-14 17:32:06 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
-- 设置、获取卸载的数据
|
|
|
|
|
function this:SetMingListIndexData(index)
|
2021-02-20 16:45:21 +08:00
|
|
|
|
SelectId = this.hongmengHeroInfos[index].heroId
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this:GetUnLoadData()
|
|
|
|
|
return SelectId
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取加成
|
|
|
|
|
function this:GetAdditions()
|
|
|
|
|
|
|
|
|
|
return this.hongmengAdditions
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetSingleAdditions(type)
|
2021-01-08 17:29:54 +08:00
|
|
|
|
if this.hongmengAdditions then
|
2020-12-24 16:16:53 +08:00
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
2021-07-29 11:13:34 +08:00
|
|
|
|
if this.hongmengAdditions[i].additionType == type then
|
|
|
|
|
--LogGreen("this.hongmengAdditions[i].additionType:"..this.hongmengAdditions[i].additionType.." this.hongmengAdditions[i].value :"..this.hongmengAdditions[i].value )
|
2022-02-17 15:13:26 +08:00
|
|
|
|
return this.hongmengAdditions[i].value or 0
|
2020-12-24 16:16:53 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return 0
|
|
|
|
|
end
|
2021-01-18 17:43:11 +08:00
|
|
|
|
function this.GetSingleAdditionsData(type)
|
|
|
|
|
if this.hongmengAdditions then
|
2021-09-14 17:32:06 +08:00
|
|
|
|
-- LogError("Additions长度:"..tostring(#this.hongmengAdditions))
|
2021-01-18 17:43:11 +08:00
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
|
|
|
|
if this.hongmengAdditions[i].additionType == type then
|
|
|
|
|
return this.hongmengAdditions[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-11 21:04:12 +08:00
|
|
|
|
end
|
2021-01-18 17:43:11 +08:00
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this.GetHongMengUpData()
|
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
|
|
|
|
if this.hongmengAdditions[i].additionType == 1 then
|
|
|
|
|
if this.hongmengAdditions[i].value < 330 then
|
|
|
|
|
LogBlue("服务器数据为"..this.hongmengAdditions[i].value)
|
|
|
|
|
return nil
|
|
|
|
|
end
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("服务器数据为"..this.hongmengAdditions[i].value)
|
2021-01-18 17:43:11 +08:00
|
|
|
|
for key, value in ConfigPairs(HongmengUp) do
|
|
|
|
|
if value.HongmengLevel == this.hongmengAdditions[i].value + 1 then
|
|
|
|
|
return ConfigManager.TryGetConfigData(ConfigName.HongmengUp,key)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2021-01-18 17:43:11 +08:00
|
|
|
|
|
2020-12-18 16:31:28 +08:00
|
|
|
|
return nil
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--鸿蒙共享装备临时数据
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local equipStarsConfig = ConfigManager.GetConfig(ConfigName.EquipStarsConfig)
|
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
function this.InitUpdateEquipData(id, upHeroDid)
|
|
|
|
|
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 = {}
|
|
|
|
|
end
|
|
|
|
|
if upHeroDid and upHeroDid ~= "0" then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local equipdata = {}
|
|
|
|
|
equipdata.equipConfig = equipConfig[id]
|
|
|
|
|
equipdata.itemConfig = itemConfig[id]
|
|
|
|
|
equipdata.id = id
|
|
|
|
|
if itemConfig[equipdata.id] then
|
|
|
|
|
equipdata.icon = GetResourcePath(itemConfig[equipdata.id].ResourceID)
|
|
|
|
|
else
|
2021-03-02 15:59:29 +08:00
|
|
|
|
Log("装备表找不到此id " .. equipdata.id)
|
2020-12-15 11:03:34 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
equipdata.frame = GetQuantityImageByquality(equipdata.equipConfig.Quality)
|
|
|
|
|
equipdata.quality = equipdata.equipConfig.Quality
|
|
|
|
|
equipdata.position = equipdata.equipConfig.Position
|
|
|
|
|
equipdata.mainAttribute = this.GetMainProList(equipdata.equipConfig)
|
|
|
|
|
equipdata.backData = equipdata
|
|
|
|
|
equipdata.star = equipStarsConfig[equipdata.equipConfig.Star].Stars
|
2022-01-17 18:22:45 +08:00
|
|
|
|
|
|
|
|
|
-- --摘星阁加持
|
|
|
|
|
equipdata.HomeEquipLv = function()
|
|
|
|
|
local data = HomeLandManager.EquipData[equipdata.position]
|
|
|
|
|
if data and data.configData and data.configPro then
|
|
|
|
|
return {data.configData.Level,data.configPro.Level}
|
|
|
|
|
end
|
|
|
|
|
return {0,0}
|
|
|
|
|
end
|
|
|
|
|
equipdata.homeEquipLv = equipdata.HomeEquipLv()
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
this.equipDatas[id] = equipdata
|
|
|
|
|
if not this.equipDatas[id].upHeroDidList then
|
|
|
|
|
this.equipDatas[id].upHeroDidList = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if upHeroDid and upHeroDid ~= "0" and not this.equipDatas[id].upHeroDidList[upHeroDid] then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.HarmonyUpdateEquipData(idlist, heroDid)
|
|
|
|
|
for i = 1, #idlist do
|
|
|
|
|
this.InitUpdateEquipData(idlist[i], heroDid, false)
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-27 17:59:25 +08:00
|
|
|
|
end
|
2020-12-18 13:39:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--判断神将的装备是否共鸣
|
|
|
|
|
function this:IsShowGongMingEqiup(id)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if id == this.hongmengHeroInfos[i].heroId then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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-12-18 13:39:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this.RefreshOpenBoxPoint()
|
2020-12-18 16:31:28 +08:00
|
|
|
|
local tab = ConfigManager.GetConfig(ConfigName.Hongmeng)
|
2020-12-29 20:36:37 +08:00
|
|
|
|
local keys = GameDataBase.SheetBase.GetKeys(this.tab)
|
2020-12-24 14:43:32 +08:00
|
|
|
|
local Gold = BagManager.GetTotalItemNum(UpViewRechargeType.XuanHuangZhiQi)
|
2021-01-06 19:35:41 +08:00
|
|
|
|
-- local DemonCrystal = BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal) or DemonCrystal > tab[#this.hongmengHeroInfos].MoneyPrice[2]
|
2020-12-18 16:31:28 +08:00
|
|
|
|
if #this.hongmengHeroInfos<=0 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-02-20 21:22:05 +08:00
|
|
|
|
if tab[#this.hongmengHeroInfos + 1] and Gold > tab[#this.hongmengHeroInfos + 1].PropPrice[2] and #this.hongmengHeroInfos < #keys then
|
2020-12-18 13:39:35 +08:00
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.RefreshEnvoyPoint()
|
|
|
|
|
-- body
|
2021-02-20 14:52:04 +08:00
|
|
|
|
|
2021-02-20 11:00:40 +08:00
|
|
|
|
local data = this.GetSingleAdditionsData(HarmonyAddType.AddLv)
|
|
|
|
|
if data then
|
|
|
|
|
if data.heroTid == 0 then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
local sum = this:HongMengTowerUpLimit()
|
2021-02-20 11:00:40 +08:00
|
|
|
|
if data.value <= sum then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
for i = 1, #this.hongmengGuards do
|
2021-02-20 11:00:40 +08:00
|
|
|
|
if data.heroId == "" and data.time == 0 then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
2020-12-29 20:36:37 +08:00
|
|
|
|
end
|
2020-12-24 16:16:53 +08:00
|
|
|
|
end
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.RefreshUpTowerPoint()
|
2021-02-20 14:52:04 +08:00
|
|
|
|
if len == 0 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-02-20 11:00:40 +08:00
|
|
|
|
local data = this.GetSingleAdditionsData(HarmonyAddType.AddLv)
|
|
|
|
|
if data then
|
|
|
|
|
if data.heroTid == 0 then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
local sum = this:HongMengTowerUpLimit()
|
2021-02-20 11:00:40 +08:00
|
|
|
|
if data.value >= sum then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
return false
|
|
|
|
|
else
|
2021-02-20 11:00:40 +08:00
|
|
|
|
local prop = this.GetHongMengUpData()
|
2021-04-21 16:36:12 +08:00
|
|
|
|
-- --LogGreen(data.LevelUp[1][2].." "..data.LevelUp[2][2])
|
2021-01-04 09:57:42 +08:00
|
|
|
|
-- LogYellow(BagManager.GetTotalItemNum(UpViewRechargeType.Gold))
|
2021-02-20 11:00:40 +08:00
|
|
|
|
if prop and BagManager.GetTotalItemNum(UpViewRechargeType.Gold) >= prop.LevelUp[1][2] then
|
|
|
|
|
if BagManager.GetTotalItemNum(UpViewRechargeType.GrowthAmulet) >= prop.LevelUp[2][2] then
|
2021-01-04 09:57:42 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
2020-12-29 20:36:37 +08:00
|
|
|
|
end
|
2021-01-04 09:57:42 +08:00
|
|
|
|
return false
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
2021-01-04 09:57:42 +08:00
|
|
|
|
else
|
2020-12-29 20:36:37 +08:00
|
|
|
|
return false
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-04 09:57:42 +08:00
|
|
|
|
return false
|
2020-12-18 13:39:35 +08:00
|
|
|
|
end
|
2021-02-20 15:44:09 +08:00
|
|
|
|
--检测主城红点
|
|
|
|
|
function this.CheckRedPoinStatusUpTowerMainCityRed()
|
|
|
|
|
CheckRedPointStatus(RedPointType.HongMeng_UpTower)
|
2021-02-20 21:22:05 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.HongMeng_Evory)
|
|
|
|
|
CheckRedPointStatus(RedPointType.HongMeng_OpenBox)
|
2021-02-20 15:44:09 +08:00
|
|
|
|
end
|
2020-12-18 18:25:38 +08:00
|
|
|
|
--票战力
|
|
|
|
|
local oldPowerNum = 0
|
|
|
|
|
function this.SetOldPowerNum(did)
|
|
|
|
|
local isCalculate = true
|
|
|
|
|
if did then
|
|
|
|
|
local heros = FormationManager.GetAllMainFormationHeroId()
|
|
|
|
|
if not heros[did] then
|
|
|
|
|
isCalculate = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if isCalculate then
|
|
|
|
|
oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.WarPowerChangeNotify(did)
|
|
|
|
|
local isCalculate = true
|
|
|
|
|
if did then
|
|
|
|
|
local heros = FormationManager.GetAllMainFormationHeroId()
|
|
|
|
|
if not heros[did] then
|
|
|
|
|
isCalculate = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if oldPowerNum ~= 0 and isCalculate then
|
|
|
|
|
local newPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
if oldPowerNum ~= newPowerNum then
|
|
|
|
|
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum})
|
|
|
|
|
if did then
|
|
|
|
|
FormationManager.CheckHeroIdExist(did)--如果是主线阵容发生变化 会通知后端 更新任务刷新
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-15 10:26:56 +08:00
|
|
|
|
|
2021-07-09 16:56:05 +08:00
|
|
|
|
function this.IsGongMing(_curHeroData)
|
|
|
|
|
return this.IsChangeColor(_curHeroData.dynamicId) or (this:IsEnvoy(_curHeroData.dynamicId) and this:HongMengTowerUpLimit() ~= 0)
|
|
|
|
|
end
|
2022-01-17 18:22:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this.updateHomeLandEquipLv()
|
2022-01-18 10:19:36 +08:00
|
|
|
|
if this.equipDatas then
|
|
|
|
|
for key, value in pairs(this.equipDatas) do
|
|
|
|
|
value.HomeEquipLv = function()
|
|
|
|
|
local data = HomeLandManager.EquipData[value.position]
|
|
|
|
|
if data and data.configData and data.configPro then
|
|
|
|
|
return {data.configData.Level,data.configPro.Level}
|
|
|
|
|
end
|
|
|
|
|
return {0,0}
|
2022-01-17 18:22:45 +08:00
|
|
|
|
end
|
2022-01-18 10:19:36 +08:00
|
|
|
|
value.homeEquipLv = value.HomeEquipLv()
|
2022-01-17 18:22:45 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-27 17:59:25 +08:00
|
|
|
|
return HarmonyManager
|