【关卡新条件】完善
parent
4a9c197563
commit
6c259fbf26
|
@ -21,7 +21,6 @@ end
|
||||||
function this.GetHaveEquipDatas()
|
function this.GetHaveEquipDatas()
|
||||||
return this.HaveEquipDatas
|
return this.HaveEquipDatas
|
||||||
end
|
end
|
||||||
|
|
||||||
--upHeroDid
|
--upHeroDid
|
||||||
function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook)
|
function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook)
|
||||||
if not this.equipDatas then
|
if not this.equipDatas then
|
||||||
|
@ -70,6 +69,37 @@ function this.InitUpdateEquipData(id, upHeroDid, isFindHandBook)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取拥有某星级以上的装备数量
|
||||||
|
function this.GetLimitStarEquipNum(star)
|
||||||
|
local allNum = 0
|
||||||
|
-- 背包里面的
|
||||||
|
local equips = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
||||||
|
for _, e in ipairs(equips) do
|
||||||
|
if e.id and e.num > 0 then
|
||||||
|
if equipConfig[e.id].Star >= star then
|
||||||
|
allNum = allNum + e.num
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
LogRed("4, bag "..allNum)
|
||||||
|
|
||||||
|
-- 身上穿的
|
||||||
|
local allHeroDatas = HeroManager.GetAllHeroList()
|
||||||
|
for _, hero in pairs(allHeroDatas) do
|
||||||
|
if hero.equipIdList and #hero.equipIdList > 0 then
|
||||||
|
for i = 1, #hero.equipIdList do
|
||||||
|
local id = hero.equipIdList[i]
|
||||||
|
if equipConfig[id].Star >= star then
|
||||||
|
allNum = allNum + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
LogRed("4, wear "..allNum)
|
||||||
|
|
||||||
|
return allNum
|
||||||
|
end
|
||||||
|
|
||||||
function this.UpdateEquipData(idlist, heroDid)
|
function this.UpdateEquipData(idlist, heroDid)
|
||||||
for i = 1, #idlist do
|
for i = 1, #idlist do
|
||||||
this.InitUpdateEquipData(idlist[i], heroDid, false)
|
this.InitUpdateEquipData(idlist[i], heroDid, false)
|
||||||
|
|
|
@ -259,9 +259,10 @@ function this.IsCanFight(fightId)
|
||||||
if this.IsChapterClossState() then
|
if this.IsChapterClossState() then
|
||||||
|
|
||||||
-- 以防后端不校验,再来一次
|
-- 以防后端不校验,再来一次
|
||||||
if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then
|
local isOk, tip = this.CheckFightOpenRule(this.curOpenFight)
|
||||||
|
if not isOk then
|
||||||
Log("等级不足,无法挑战关卡")
|
Log("等级不足,无法挑战关卡")
|
||||||
return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
|
return false, tip
|
||||||
else -- 等级不足未通关时设置一下
|
else -- 等级不足未通关时设置一下
|
||||||
if this.curFightState == -1 then
|
if this.curFightState == -1 then
|
||||||
this.curFightState = 1
|
this.curFightState = 1
|
||||||
|
@ -275,7 +276,7 @@ function this.IsCanFight(fightId)
|
||||||
return true, Language[10617]
|
return true, Language[10617]
|
||||||
elseif state == FIGHT_POINT_STATE.OPEN_LOW_LEVEL then
|
elseif state == FIGHT_POINT_STATE.OPEN_LOW_LEVEL then
|
||||||
Log("等级不足,无法挑战关卡")
|
Log("等级不足,无法挑战关卡")
|
||||||
return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
|
return false, "关卡未满足解锁条件"--tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
|
||||||
elseif state == FIGHT_POINT_STATE.PASS then -- 最后一关
|
elseif state == FIGHT_POINT_STATE.PASS then -- 最后一关
|
||||||
Log("已经通关")
|
Log("已经通关")
|
||||||
return false, Language[10618]
|
return false, Language[10618]
|
||||||
|
@ -285,50 +286,101 @@ function this.IsCanFight(fightId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 检测其他关卡条件
|
||||||
function this.CheckFightOpenRule(fightId)
|
function this.CheckFightOpenRule(fightId)
|
||||||
if fightId and mainLevelConfig[fightId] then
|
if not fightId or not mainLevelConfig[fightId] then
|
||||||
return false, "没有这个关卡"
|
return false, "没有这个关卡"
|
||||||
end
|
end
|
||||||
local openRule = mainLevelConfig[fightId].OpenRule
|
|
||||||
if not openRule or openRule[1] == 0 then
|
|
||||||
return true
|
|
||||||
elseif openRule[1] == 1 then
|
|
||||||
local star = FightLevelManager.GetAllChapterStars()
|
|
||||||
if openRule[2] < star then
|
|
||||||
return false, string.format("山河社稷图星数达%s解锁", star)
|
|
||||||
end
|
|
||||||
elseif openRule[1] == 2 then
|
|
||||||
local wave = MonsterCampManager.GetMonsterCampCurWave()
|
|
||||||
if openRule[2] <= wave then
|
|
||||||
return false, string.format("心魔试炼通关%s层解锁", wave)
|
|
||||||
end
|
|
||||||
elseif openRule[1] == 3 then
|
|
||||||
local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv)
|
|
||||||
if openRule[2] <= lv then
|
|
||||||
return false, string.format("鸿蒙阵共鸣等级达%s解锁", lv)
|
|
||||||
end
|
|
||||||
elseif openRule[1] == 4 then
|
|
||||||
-- 指定星级(运算星级)装备数量(初始可用)
|
|
||||||
-- local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv)
|
|
||||||
-- if openRule[2] <= lv then
|
|
||||||
-- return false, string.format("鸿蒙阵共鸣等级达%s解锁", lv)
|
|
||||||
-- end
|
|
||||||
elseif openRule[1] == 5 then
|
|
||||||
local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1)
|
|
||||||
if openRule[2] <= tlv then
|
|
||||||
return false, string.format("神将总好感度等级达%s解锁", tlv)
|
|
||||||
end
|
|
||||||
elseif openRule[1] == 6 then
|
|
||||||
-- 逍遥游通关次数
|
|
||||||
-- local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1)
|
|
||||||
|
|
||||||
elseif openRule[1] == 6 then
|
|
||||||
-- 达到指定英雄等级及数量(初始可用)
|
|
||||||
-- local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1)
|
|
||||||
|
|
||||||
|
|
||||||
|
if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then
|
||||||
|
local tip = tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. Language[10056])
|
||||||
|
LogRed(tip .. " 当前:"..PlayerManager.level)
|
||||||
|
return false, tip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local openRule = mainLevelConfig[fightId].OpenRule
|
||||||
|
if openRule then
|
||||||
|
local states = {}
|
||||||
|
local tips = {}
|
||||||
|
for index, rule in ipairs(openRule) do
|
||||||
|
if not rule[1] or rule[1] == 0 then
|
||||||
|
LogRed("当前:没有限制条件1")
|
||||||
|
states[index] = true
|
||||||
|
elseif rule[1] == 1 then
|
||||||
|
local star = FightLevelManager.GetAllChapterStars()
|
||||||
|
if star < rule[2] then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("山河社稷图星数达%s", rule[2])
|
||||||
|
LogRed(tips[index]..", 当前:"..star)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 2 then
|
||||||
|
local wave = MonsterCampManager.GetMonsterCampCurWave()
|
||||||
|
if wave <= rule[2] then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("心魔试炼通关%s层", rule[2])
|
||||||
|
LogRed(tips[index]..", 当前:"..wave)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 3 then
|
||||||
|
local lv = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv)
|
||||||
|
if lv < rule[2] then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("鸿蒙阵共鸣等级达%s", rule[2])
|
||||||
|
LogRed(tips[index]..", 当前:"..lv)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 4 then
|
||||||
|
-- 指定星级(运算星级)装备数量(初始可用)
|
||||||
|
LogRed("4, rule[2]"..rule[2])
|
||||||
|
LogRed("4, rule[3]"..rule[3])
|
||||||
|
local num = EquipManager.GetLimitStarEquipNum(rule[2])
|
||||||
|
LogRed("4, 当前:"..num)
|
||||||
|
if num < rule[3] then
|
||||||
|
local equipStarConfig = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig, rule[2])
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("拥有%s个%s%s星装备", rule[3], QualityNameDef[equipStarConfig.Quality], equipStarConfig.Stars)
|
||||||
|
LogRed(tips[index]..", 当前:"..num)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 5 then
|
||||||
|
local _, tlv, _ = LikabilityManager.GetTotalHeroLikeLv(1)
|
||||||
|
if tlv < rule[2] then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("神将总好感度等级达%s", rule[2])
|
||||||
|
LogRed(tips[index]..", 当前:"..tlv)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 6 then
|
||||||
|
-- 逍遥游通关次数
|
||||||
|
local xyPassTimes = XiaoYaoManager.GetCurPassTimes()
|
||||||
|
if xyPassTimes < rule[2] then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("通关逍遥游%s次", rule[2])
|
||||||
|
LogRed(tips[index]..", 当前:"..xyPassTimes)
|
||||||
|
end
|
||||||
|
elseif rule[1] == 7 then
|
||||||
|
local c_lv = rule[2]
|
||||||
|
local c_num = rule[3]
|
||||||
|
local num = #HeroManager.GetAllHeroDatas(c_lv)
|
||||||
|
if num < c_num then
|
||||||
|
states[index] = false
|
||||||
|
tips[index] = string.format("拥有%s个等级%s以上的神将", c_num, c_lv)
|
||||||
|
LogRed(tips[index]..", 当前:"..num)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local tip = ""
|
||||||
|
local isOk = true
|
||||||
|
for index, state in pairs(states) do
|
||||||
|
if not state then
|
||||||
|
isOk = false
|
||||||
|
if tip ~= "" then
|
||||||
|
tip = tip..string.format(",且%s", tips[index])
|
||||||
|
else
|
||||||
|
tip = tips[index]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return isOk, tip.."解锁"
|
||||||
|
end
|
||||||
|
LogRed("当前:没有限制条件2")
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,6 +398,10 @@ function this.GetBtnText()
|
||||||
if PlayerManager.level < limitLevel then
|
if PlayerManager.level < limitLevel then
|
||||||
return limitLevel .. Language[10056]
|
return limitLevel .. Language[10056]
|
||||||
end
|
end
|
||||||
|
--
|
||||||
|
if not this.CheckFightOpenRule(this.curOpenFight) then
|
||||||
|
return "条件未达成"
|
||||||
|
end
|
||||||
|
|
||||||
local offset = 1
|
local offset = 1
|
||||||
offset = mainLevelConfig[this.curOpenFight].Difficulty
|
offset = mainLevelConfig[this.curOpenFight].Difficulty
|
||||||
|
|
|
@ -14,6 +14,7 @@ this.luckyluckyTurnTableRemainTime = 0
|
||||||
this.isAutoYouli=false --逍遥游自动游历开关
|
this.isAutoYouli=false --逍遥游自动游历开关
|
||||||
|
|
||||||
this.first = true
|
this.first = true
|
||||||
|
this.finishNum = 0
|
||||||
--打开逍遥游地图列表界面
|
--打开逍遥游地图列表界面
|
||||||
function this.OpenMapList()
|
function this.OpenMapList()
|
||||||
this.first = false
|
this.first = false
|
||||||
|
@ -37,7 +38,9 @@ function this.GetOpenMapData(func)
|
||||||
_data[msg.infos[i].mapId].first=msg.infos[i].first
|
_data[msg.infos[i].mapId].first=msg.infos[i].first
|
||||||
end
|
end
|
||||||
this.allMapData=_data
|
this.allMapData=_data
|
||||||
|
--逍遥游累计通关次数
|
||||||
|
this.finishNum = msg.finishNum or 0
|
||||||
|
|
||||||
this.CheckRedPoint2()
|
this.CheckRedPoint2()
|
||||||
if func then
|
if func then
|
||||||
func(_data)
|
func(_data)
|
||||||
|
@ -45,6 +48,11 @@ function this.GetOpenMapData(func)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取逍遥游通关总次数
|
||||||
|
function this.GetCurPassTimes()
|
||||||
|
return this.finishNum
|
||||||
|
end
|
||||||
|
|
||||||
-- 判断地图是否首通
|
-- 判断地图是否首通
|
||||||
function this.IsFirstPass(mapId)
|
function this.IsFirstPass(mapId)
|
||||||
if not this.allMapData or not this.allMapData[mapId] or this.allMapData[mapId].first ~= 1 then
|
if not this.allMapData or not this.allMapData[mapId] or this.allMapData[mapId].first ~= 1 then
|
||||||
|
|
Loading…
Reference in New Issue