fix(flows): udkørselsregler vises kun når en vare bruger dem

Rent lager-flow viste 'sælg fra 90 %' / 'pris >= 90 %' selv om det aldrig
sælger. Guidens Regler-trin, resuméet og statuslinjen viser nu kun
salgsgrænser ved salg og lagergrænsen ved lager (v1.60.11.0).
This commit is contained in:
2026-09-29 21:02:10 +02:00
parent 089fb98782
commit 76f51c7be7
8 changed files with 73 additions and 12 deletions
+19 -8
View File
@@ -327,15 +327,23 @@ local function rowsStore(guide)
return rows
end
local function productPolicies(draft)
local policies = {}
for _, product in ipairs(draft.products or {}) do table.insert(policies, product.policy) end
return policies
end
-- Kun regler varernes politik bruger: rent lager-flow viser ikke salgsgrænser og omvendt (in-game 29/9).
local function rowsRules(guide)
local draft = guide.draft
if isOut(guide) then
return {
choice("sellAtPercent", L("spu_sellAt"), percentOptions(ADRuns.MIN_SELL_AT_PERCENT, ADRuns.MAX_SELL_AT_PERCENT, 5), draft.sellAtPercent),
choice("storeAbovePercent", L("spu_storeAbove"), percentOptions(ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT, 5), draft.storeAbovePercent),
choice("sellAbovePercent", L("spu_sellAbove"), sellAboveOptions(), draft.sellAbovePercent),
toggle("collectRound", L("spu_collectRound"), draft.collectRound),
}
local sells, stores = ADFlowView.policyUse(productPolicies(draft))
local rows = {}
if sells then table.insert(rows, choice("sellAtPercent", L("spu_sellAt"), percentOptions(ADRuns.MIN_SELL_AT_PERCENT, ADRuns.MAX_SELL_AT_PERCENT, 5), draft.sellAtPercent)) end
if stores then table.insert(rows, choice("storeAbovePercent", L("spu_storeAbove"), percentOptions(ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT, 5), draft.storeAbovePercent)) end
if sells then table.insert(rows, choice("sellAbovePercent", L("spu_sellAbove"), sellAboveOptions(), draft.sellAbovePercent)) end
table.insert(rows, toggle("collectRound", L("spu_collectRound"), draft.collectRound))
return rows
end
local loops = {{label = L("spu_loops_infinite"), value = 0}}
for count = 1, ADRuns.MAX_LOOPS do table.insert(loops, {label = T(tostring(count)), value = count}) end
@@ -479,8 +487,11 @@ local SUMMARY = {
rules = function(guide)
local draft = guide.draft
if isOut(guide) then
local parts = {L("spu_guide_flow_sumSellAt", {draft.sellAtPercent}), L("spu_guide_flow_sumStoreAbove", {draft.storeAbovePercent})}
if (draft.sellAbovePercent or 0) > 0 then table.insert(parts, L("spu_guide_flow_sumSellAbove", {draft.sellAbovePercent})) end
local sells, stores = ADFlowView.policyUse(productPolicies(draft))
local parts = {}
if sells then table.insert(parts, L("spu_guide_flow_sumSellAt", {draft.sellAtPercent})) end
if stores then table.insert(parts, L("spu_guide_flow_sumStoreAbove", {draft.storeAbovePercent})) end
if sells and (draft.sellAbovePercent or 0) > 0 then table.insert(parts, L("spu_guide_flow_sumSellAbove", {draft.sellAbovePercent})) end
if draft.collectRound then table.insert(parts, L("spu_guide_flow_sumRound")) end
return parts
end