diff --git a/betterContracts.lua b/betterContracts.lua
index 000f40f..84f4eea 100644
--- a/betterContracts.lua
+++ b/betterContracts.lua
@@ -47,6 +47,7 @@
-- v1.2.7.2 15.02.2023 Add settings to adjust contract generation
-- Icon for roller missions. Don't show negative togos
-- v1.2.7.3 20.02.2023 double progress bar active contracts. Fix PnH BGA/ Maize+
+-- v1.2.7.4 22.02.2023 increase range for "toDeliver". Add setting "toDeliverBale"
--=======================================================================================================
SC = {
FERTILIZER = 1, -- prices index
@@ -223,7 +224,8 @@ function readconfig(self)
self.config.maxActive = xmlFile:getValue(key.."#maxActive", 3)
self.config.multReward= xmlFile:getValue(key.."#reward", 1.)
self.config.multLease = xmlFile:getValue(key.."#lease", 1.)
- self.config.toDeliver = xmlFile:getValue(key.."#deliver", 0.93)
+ self.config.toDeliver = xmlFile:getValue(key.."#deliver", 0.94)
+ self.config.toDeliverBale = xmlFile:getValue(key.."#deliver", 0.90)
self.config.refreshMP = xmlFile:getValue(key.."#refreshMP", 2)
self.config.lazyNPC = xmlFile:getValue(key.."#lazyNPC", false)
self.config.hardMode = xmlFile:getValue(key.."#hard", false)
@@ -407,7 +409,8 @@ function BetterContracts:initialize()
maxActive = 3, -- max active contracts
multReward = 1., -- general reward multiplier
multLease = 1., -- general lease cost multiplier
- toDeliver = 0.93, -- HarvestMission.SUCCESS_FACTOR
+ toDeliver = 0.94, -- HarvestMission.SUCCESS_FACTOR
+ toDeliverBale = 0.90, -- BaleMission.SUCCESS_FACTOR
generationInterval = 1, -- MissionManager.MISSION_GENERATION_INTERVAL
missionGenPercentage = 0.2, -- percent of missions to be generated (default: 20%)
refreshMP = SC.ADMIN, -- necessary permission to refresh contract list (MP)
@@ -583,7 +586,7 @@ function BetterContracts:onPostLoadMap(mapNode, mapFile)
end
-- init Harvest SUCCESS_FACTORs (std is harv = .93, bale = .9)
HarvestMission.SUCCESS_FACTOR = self.config.toDeliver
- BaleMission.FILL_SUCCESS_FACTOR = self.config.toDeliver - 0.03
+ BaleMission.FILL_SUCCESS_FACTOR = self.config.toDeliverBale
BetterContracts:updateGenerationSettings()
@@ -649,6 +652,7 @@ function BetterContracts:onPostSaveSavegame(saveDir, savegameIndex)
xmlFile:setFloat( key.."#reward", conf.multReward)
xmlFile:setFloat( key.."#lease", conf.multLease)
xmlFile:setFloat( key.."#deliver", conf.toDeliver)
+ xmlFile:setFloat( key.."#deliverBale", conf.toDeliverBale)
xmlFile:setInt ( key.."#refreshMP", conf.refreshMP)
xmlFile:setBool ( key.."#lazyNPC", conf.lazyNPC)
xmlFile:setBool ( key.."#discount", conf.discountMode)
diff --git a/l10n/l10n_br.xml b/l10n/l10n_br.xml
index b25287c..fa8ab6a 100644
--- a/l10n/l10n_br.xml
+++ b/l10n/l10n_br.xml
@@ -100,6 +100,7 @@
+
diff --git a/l10n/l10n_cs.xml b/l10n/l10n_cs.xml
index 6a0c40a..94af9fa 100644
--- a/l10n/l10n_cs.xml
+++ b/l10n/l10n_cs.xml
@@ -102,6 +102,7 @@
+
diff --git a/l10n/l10n_cz.xml b/l10n/l10n_cz.xml
index b91215f..2b7a1b1 100644
--- a/l10n/l10n_cz.xml
+++ b/l10n/l10n_cz.xml
@@ -101,6 +101,7 @@
+
diff --git a/l10n/l10n_de.xml b/l10n/l10n_de.xml
index afa69b5..8e7eeea 100644
--- a/l10n/l10n_de.xml
+++ b/l10n/l10n_de.xml
@@ -69,6 +69,7 @@
+
diff --git a/l10n/l10n_en.xml b/l10n/l10n_en.xml
index ef768de..7d62325 100644
--- a/l10n/l10n_en.xml
+++ b/l10n/l10n_en.xml
@@ -69,6 +69,7 @@
+
diff --git a/l10n/l10n_fr.xml b/l10n/l10n_fr.xml
index 7e62580..4af608d 100644
--- a/l10n/l10n_fr.xml
+++ b/l10n/l10n_fr.xml
@@ -101,6 +101,7 @@
+
diff --git a/l10n/l10n_it.xml b/l10n/l10n_it.xml
index 080830a..bf23186 100644
--- a/l10n/l10n_it.xml
+++ b/l10n/l10n_it.xml
@@ -101,6 +101,7 @@
+
diff --git a/l10n/l10n_jp.xml b/l10n/l10n_jp.xml
index 46895b4..bca154a 100644
--- a/l10n/l10n_jp.xml
+++ b/l10n/l10n_jp.xml
@@ -101,6 +101,7 @@
+
diff --git a/l10n/l10n_pl.xml b/l10n/l10n_pl.xml
index 3f3a770..9390845 100644
--- a/l10n/l10n_pl.xml
+++ b/l10n/l10n_pl.xml
@@ -101,6 +101,7 @@
+
diff --git a/l10n/l10n_ru.xml b/l10n/l10n_ru.xml
index b189aa4..46ec7f8 100644
--- a/l10n/l10n_ru.xml
+++ b/l10n/l10n_ru.xml
@@ -100,6 +100,7 @@
+
diff --git a/modDesc.xml b/modDesc.xml
index 81c3784..9a4b7f9 100644
--- a/modDesc.xml
+++ b/modDesc.xml
@@ -1,7 +1,7 @@
Mmtrx
- 1.2.7.3
+ 1.2.7.4
Better Contracts
@@ -24,7 +24,8 @@ Disclaimer: All values shown in details display are ESTIMATES. You should not ta
The mod keeps track of the amount of contracts you completed for each of the NPC farmers (number of completed jobs is displayed below the farmers image, if "Details" on). If you enable the optional discount mode or hard mode options (on the mods settings page), the amount of completed jobs influence gameplay.
-Changelog v1.2.7.3:
+Changelog v1.2.7.4:
+- increase settings range for harvest success, separate setting for baling
- add 2nd progress bar for active harvest contracts
- fix Maize+ issue with Pumps'n Hoses BGA
- add setting to change time interval between contract generation runs
diff --git a/scripts/gui.lua b/scripts/gui.lua
index ea5d728..99801f4 100644
--- a/scripts/gui.lua
+++ b/scripts/gui.lua
@@ -105,74 +105,62 @@ function loadIcons(self)
self.missionIcons[type] = icon
end
end
-function BetterContracts:loadGUI(guiPath)
- local canLoad = true
- local fname
- -- load my gui profiles
- fname = guiPath .. "guiProfiles.xml"
- if fileExists(fname) then
- g_gui:loadProfiles(fname)
- else
- Logging.error("[GuiLoader %s] Required file '%s' could not be found!", self.name, fname)
- return false
- end
- local xmlFile, layout
- local cont = self.frCon.contractsContainer
-
- -- load "SCGui.xml"
- fname = guiPath .. "SCGui.xml"
+function loadGuiFile(self, fname, parent, initial)
+ -- load gui from file, attach to parent, call initial func
if fileExists(fname) then
xmlFile = loadXMLFile("Temp", fname)
local fbox = self.frCon.farmerBox
-- load our "npcbox" as child of farmerBox:
- g_gui:loadGuiRec(xmlFile, "GUI", fbox, self.frCon)
- local npcbox = fbox:getDescendantById("npcbox")
- npcbox:applyScreenAlignment()
- npcbox:updateAbsolutePosition()
- layout = fbox:getDescendantById("layout")
- layout:invalidateLayout(true) -- adjust sort buttons
+ g_gui:loadGuiRec(xmlFile, "GUI", parent, self.frCon)
+ initial(parent)
delete(xmlFile)
else
Logging.error("[GuiLoader %s] Required file '%s' could not be found!", self.name, fname)
return false
end
- -- load "filterGui.xml"
- fname = guiPath .. "filterGui.xml"
+ return true
+end
+function BetterContracts:loadGUI(guiPath)
+ -- load my gui profiles
+ local fname = guiPath .. "guiProfiles.xml"
if fileExists(fname) then
- xmlFile = loadXMLFile("Temp", fname)
- g_gui:loadGuiRec(xmlFile, "GUI", cont, self.frCon)
- layout = cont:getDescendantById("filterlayout")
- layout:applyScreenAlignment()
- layout:updateAbsolutePosition()
- layout:invalidateLayout(true) -- adjust filter buttons
- local hidden = cont:getDescendantById("hidden")
- hidden:applyScreenAlignment()
- hidden:updateAbsolutePosition()
- delete(xmlFile)
+ g_gui:loadProfiles(fname)
else
Logging.error("[GuiLoader %s] Required file '%s' could not be found!", self.name, fname)
return false
end
-
- -- load "progressGui.xml"
- fname = guiPath .. "progressGui.xml"
- if fileExists(fname) then
- xmlFile = loadXMLFile("Temp", fname)
- local contBox = self.frCon.contractBox
- -- load our "progressbar" as child of contractBox:
- g_gui:loadGuiRec(xmlFile, "GUI", contBox, self.frCon)
- for _,id in ipairs({"box1","box2"}) do
- layout = contBox:getDescendantById(id)
+ -- load our "npcbox" as child of farmerBox:
+ local canLoad = loadGuiFile(self, guiPath.."SCGui.xml", self.frCon.farmerBox, function(parent)
+ local npcbox = parent:getDescendantById("npcbox")
+ npcbox:applyScreenAlignment()
+ npcbox:updateAbsolutePosition()
+ parent:getDescendantById("layout"):invalidateLayout(true) -- adjust sort buttons
+ end)
+ -- load filter buttons
+ if canLoad then
+ canLoad = loadGuiFile(self, guiPath.."filterGui.xml", self.frCon.contractsContainer, function(parent)
+ layout = parent:getDescendantById("filterlayout")
layout:applyScreenAlignment()
layout:updateAbsolutePosition()
- layout:invalidateLayout(true) -- adjust text fields
- end
- delete(xmlFile)
- else
- Logging.error("[GuiLoader %s] Required file '%s' could not be found!", self.name, fname)
- return false
+ layout:invalidateLayout(true) -- adjust filter buttons
+ local hidden = parent:getDescendantById("hidden")
+ hidden:applyScreenAlignment()
+ hidden:updateAbsolutePosition()
+ end)
+ end
+ -- load progress bars
+ if canLoad then
+ canLoad = loadGuiFile(self, guiPath.."progressGui.xml", self.frCon.contractBox, function(parent)
+ for _,id in ipairs({"box1","box2"}) do
+ layout = parent:getDescendantById(id)
+ layout:applyScreenAlignment()
+ layout:updateAbsolutePosition()
+ layout:invalidateLayout(true) -- adjust text fields
+ end
+ end)
end
-
+ if not canLoad then return false end
+
-- load "BCsettingsPage.lua"
if g_gui ~= nil and g_gui.guis.BCSettingsFrame == nil then
local luaPath = guiPath .. "BCsettingsPage.lua"
diff --git a/scripts/settings.lua b/scripts/settings.lua
index f344fb5..9327deb 100644
--- a/scripts/settings.lua
+++ b/scripts/settings.lua
@@ -6,6 +6,7 @@
-- Changelog:
-- v1.2.6.0 30.11.2022 UI for all settings
-- v1.2.6.5 18.01.2023 add setting "toDeliver": harvest contract success factor
+-- v1.2.7.4 22.02.2023 increase range for "toDeliver". Add setting "toDeliverBale"
--=======================================================================================================
local function lazyNPCDisabled()
return not BetterContracts.config.lazyNPC
@@ -49,18 +50,27 @@ BCSettingsBySubtitle = {
noTranslate = true
},
{name = "toDeliver",
- values = {.85,.87,.89,.91,.93},
- texts = {"85 %","87 %","89 %","91 %","standard"},
- default = 5,
+ min = .7, max = .941, increment = .03, unit = true,
+ default = 9,
title = "bc_toDeliver",
tooltip = "bc_toDeliver_tooltip",
actionFunc = function(self,ix)
HarvestMission.SUCCESS_FACTOR = self.values[ix]
- BaleMission.FILL_SUCCESS_FACTOR = self.values[ix] - 0.03
BetterContracts:refresh() -- to recalc deliver/keep for harvest contr
end,
noTranslate = true
},
+ {name = "toDeliverBale",
+ min = .7, max = .91, increment = .04, unit = true,
+ default = 6,
+ title = "bc_toDeliverBale",
+ tooltip = "bc_toDeliver_tooltip",
+ actionFunc = function(self,ix)
+ BaleMission.FILL_SUCCESS_FACTOR = self.values[ix]
+ BetterContracts:refresh() -- to recalc deliver/keep for baling contr
+ end,
+ noTranslate = true
+ },
{name = "refreshMP",
values = {SC.ADMIN, SC.FARMMANAGER, SC.PLAYER},
texts = {"ui_admin","ui_farmManager","ui_players"},
@@ -239,7 +249,6 @@ function BCsetting.new(data, customMt)
self.values = table.copy(data.values)
self.texts = table.copy(data.texts)
elseif data.min ~= nil and data.max ~=nil then
- -- maybe future use --
self.data.values = {}
self.data.texts = {}
BCsetting.generateValues(self, self.data.values, self.data.texts, data.min, data.max, data.increment, data.unit)
@@ -279,7 +288,7 @@ function BCsetting:generateValues(values, texts, min, max, inc, percent)
for i=min, max, inc do
table.insert(values, i)
local value = MathUtil.round(i, 2)
- local text = percent and string.format("%+d %%",value*100) or tostring(value)
+ local text = percent and string.format("%d %%",value*100) or tostring(value)
table.insert(texts, text)
end
end