|
|
@@ -33,6 +33,7 @@ local orderNameMap = {
|
|
|
}
|
|
|
|
|
|
local GC_WARORDER_CHANGE = 13
|
|
|
+local isRed = {}
|
|
|
------------------------------------------------------
|
|
|
-- local 函数
|
|
|
------------------------------------------------------
|
|
|
@@ -59,12 +60,60 @@ local function checkRewardByIdx(human,orderType,idx)
|
|
|
return not orderData.finish[idx] , isUpgradeOk
|
|
|
end
|
|
|
|
|
|
+local function checkRed(human,orderType)
|
|
|
+ if isRed[orderType] then
|
|
|
+ return true
|
|
|
+ end
|
|
|
+ local orderName = orderNameMap[orderType]
|
|
|
+ local cfg = OrderExcel[orderName]
|
|
|
+ local orderData = human.db.warOrder[orderName]
|
|
|
+
|
|
|
+ local exp = orderData.exp
|
|
|
+ local maxFinishIdx = 0
|
|
|
+ for _,lv in ipairs(orderData.finish) do
|
|
|
+ if maxFinishIdx <= lv then
|
|
|
+ maxFinishIdx = lv
|
|
|
+ end
|
|
|
+ end
|
|
|
+ local maxExpIdx = 0
|
|
|
+ for _,cfg in pairs(cfg) do
|
|
|
+ if cfg.process <= exp and maxExpIdx <= cfg.idx then
|
|
|
+ maxExpIdx = cfg.idx
|
|
|
+ end
|
|
|
+ end
|
|
|
+ isRed[orderType] = maxFinishIdx < maxExpIdx
|
|
|
+ return (isRed[orderType] == true) and 1 or 0
|
|
|
+end
|
|
|
+
|
|
|
+local function getWarOrderByType(human,orderType)
|
|
|
+ local orderName = orderNameMap[orderType]
|
|
|
+ local orderData = human.db.warOrder[orderName]
|
|
|
+ local finish = {}
|
|
|
+ for lv in pairs(orderData.finish) do
|
|
|
+ finish[#finish+1] = lv
|
|
|
+ end
|
|
|
+ local upgradeFinish = {}
|
|
|
+ for lv in pairs(orderData.upgradeFinish) do
|
|
|
+ finish[#finish+1] = lv
|
|
|
+ end
|
|
|
+
|
|
|
+ return {
|
|
|
+ type = orderType,
|
|
|
+ exp = orderData.exp,
|
|
|
+ isRed = checkRed(human,orderType),
|
|
|
+ unlock = orderData.unlock,
|
|
|
+ finish = finish,
|
|
|
+ upgradeFinish = upgradeFinish,
|
|
|
+ }
|
|
|
+end
|
|
|
+
|
|
|
------------------------------------------------------
|
|
|
-- 对外暴露接口
|
|
|
------------------------------------------------------
|
|
|
function warOrderInfo(human,orderType)
|
|
|
local orderName = orderNameMap[orderType]
|
|
|
local cfg = OrderExcel[orderName]
|
|
|
+ local langCfg = OrderExcel.desc
|
|
|
local orderData = human.db.warOrder[orderName]
|
|
|
if not cfg or not orderData then
|
|
|
return
|
|
|
@@ -74,8 +123,13 @@ function warOrderInfo(human,orderType)
|
|
|
local normal = {}
|
|
|
local upgrade = {}
|
|
|
for _,v in pairs(cfg) do
|
|
|
+ local cfgData = {
|
|
|
+ idx = v.idx,
|
|
|
+ process = v.process,
|
|
|
+ }
|
|
|
+ local content = {}
|
|
|
+ local upgradeContent = {}
|
|
|
if #v.content ~= 0 then
|
|
|
- local content = {}
|
|
|
for _,item in ipairs(v.content) do
|
|
|
local data = {
|
|
|
getway = {},
|
|
|
@@ -88,15 +142,10 @@ function warOrderInfo(human,orderType)
|
|
|
end
|
|
|
content[#content + 1] = data
|
|
|
end
|
|
|
- normal[#normal+1] = {
|
|
|
- idx = v.idx,
|
|
|
- process = v.process,
|
|
|
- content = content
|
|
|
- }
|
|
|
+
|
|
|
end
|
|
|
- if #v.upgradeContent ~= 0 then
|
|
|
- local content = {}
|
|
|
- for _,item in ipairs(v.content) do
|
|
|
+ if #v.upgradeContent ~= 0 then
|
|
|
+ for _,item in ipairs(v.upgradeContent) do
|
|
|
local data = {
|
|
|
getway = {},
|
|
|
suipian = {},
|
|
|
@@ -106,12 +155,18 @@ function warOrderInfo(human,orderType)
|
|
|
if not ItemDefine.isEquip(item[1]) then
|
|
|
Grid.makeItem(data, item[1], item[2])
|
|
|
end
|
|
|
- content[#content + 1] = data
|
|
|
+ upgradeContent[#upgradeContent + 1] = data
|
|
|
end
|
|
|
- upgrade[#upgrade+1] = {
|
|
|
- process = v.process,
|
|
|
- content = content
|
|
|
- }
|
|
|
+ end
|
|
|
+ cfgData.content = content
|
|
|
+ cfgData.upgradeContent = upgradeContent
|
|
|
+ normal[#normal+1] = cfgData
|
|
|
+ end
|
|
|
+ local language = ""
|
|
|
+ for _,v in pairs(langCfg) do
|
|
|
+ if v.type == orderType then
|
|
|
+ language = v.desc
|
|
|
+ break
|
|
|
end
|
|
|
end
|
|
|
-------------------
|
|
|
@@ -126,6 +181,7 @@ function warOrderInfo(human,orderType)
|
|
|
return {
|
|
|
orderType = orderType,
|
|
|
normal = normal,
|
|
|
+ language = language,
|
|
|
upgrade = upgrade,
|
|
|
-- 自身的进度问题
|
|
|
exp = orderData.exp,
|
|
|
@@ -190,12 +246,14 @@ function warOrderReward(human,orderType)
|
|
|
for lv in pairs(orderData.upgradeFinish) do
|
|
|
finish[#finish+1] = lv
|
|
|
end
|
|
|
+ isRed[orderType] = nil
|
|
|
return {
|
|
|
orderType = orderType,
|
|
|
exp = orderData.exp,
|
|
|
unlock = orderData.unlock,
|
|
|
finish = finish,
|
|
|
upgradeFinish = upgradeFinish,
|
|
|
+ isRed = checkRed(human,orderType),
|
|
|
}
|
|
|
end
|
|
|
|
|
|
@@ -235,8 +293,18 @@ function trigger(human,orderType)
|
|
|
unlock = orderData.unlock,
|
|
|
finish = finish,
|
|
|
upgradeFinish = upgradeFinish,
|
|
|
+ isRed = checkRed(human,orderType),
|
|
|
}
|
|
|
-- 临时require 确保两个文件不会相互引用
|
|
|
local newLogic = require "role.NewLogic"
|
|
|
newLogic.PushClient(human,GC_WARORDER_CHANGE,data)
|
|
|
+end
|
|
|
+
|
|
|
+function getWarOrderInfo(human)
|
|
|
+ local ret = {}
|
|
|
+ -- 用于遍历
|
|
|
+ for orderType in pairs(orderExpMap) do
|
|
|
+ ret[#ret + 1] = getWarOrderByType(human,orderType)
|
|
|
+ end
|
|
|
+ return ret
|
|
|
end
|