Added config saving feature for non MCM Repentance users

This commit is contained in:
Wofsauge committed 2021-05-26 21:33:00 +02:00
1 parent aafc9a7c54
commit ef48ea6880
2 files changed
+63 -5

No files matched your search

+56 -1
View File
@@ -1,4 +1,4 @@
EID.DefaultConfig = { EID.UserConfig = {
-------GENERAL--------- -------GENERAL---------
-- Change language of the mod. -- Change language of the mod.
@@ -175,3 +175,58 @@ EID.DefaultConfig = {
--END CONFIG-- --END CONFIG--
----------- -----------
----------- -----------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
-------- DO NOT EDIT FROM THIS POINT!!!!! --------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
--------------------------------------------------
EID.DefaultConfig = {
["Language"] = "en_us",
["TranslateItemName"] = 2,
["FontType"] = "default",
["TextboxWidth"] = 100,
["Scale"] = 1,
["Transparency"] = 0.75,
["XPosition"] = 60,
["YPosition"] = 45,
["MaxDistance"] = 5,
["Indicator"] = "none",
["HideKey"] = Keyboard.KEY_F2,
["Hidden"] = false,
["HideInBattle"] = false,
["DisableObstructionOnFlight"] = true,
["DisableOnCurse"] = true,
["DisableOnAltPath"] = true,
["ShowItemName"] = true,
["ShowItemType"] = true,
["ShowItemIcon"] = true,
["DisplayItemInfo"] = true,
["DisplayTrinketInfo"] = true,
["ItemNameColor"] = "ColorEIDObjName",
["TransformationText"] = true,
["TransformationIcons"] = true,
["TransformationColor"] = "ColorEIDTransform",
["DisplayCardInfo"] = true,
["DisplayCardInfoShop"] = false,
["DisplayObstructedCardInfo"] = false,
["DisplayPillInfo"] = true,
["DisplayPillInfoShop"] = true,
["DisplayObstructedPillInfo"] = true,
["ShowUnidentifiedPillDescriptions"] = false,
["DisplaySacrificeInfo"] = true,
["DisplayDiceInfo"] = true,
["DisplayBagOfCrafting"] = "always",
["BagOfCraftingResults"] = 7,
["SpindownDiceResults"] = 3,
["ErrorMessage"] = "[Effect not defined]",
["TextColor"] = "ColorEIDText",
["ErrorColor"] = "ColorEIDError",
["EnableEntityDescriptions"] = true
}
+7 -4
View File
@@ -7,7 +7,7 @@ local enableDebug = false
local game = Game() local game = Game()
require("eid_config") require("eid_config")
EID.Config = EID.DefaultConfig EID.Config = EID.UserConfig
EID.Config.Version = "3.2" EID.Config.Version = "3.2"
EID.isHidden = EID.Config["Hidden"] EID.isHidden = EID.Config["Hidden"]
@@ -653,7 +653,8 @@ local function onRender(t)
end end
-- Handle Bingeeater description addition -- Handle Bingeeater description addition
if player:HasCollectible(664) then if player:HasCollectible(664) then
local bingeBuff = EID.descriptions[EID.Config["Language"]]["bingeEaterBuffs"][closest.SubType] or EID.descriptions["en_us"]["bingeEaterBuffs"][closest.SubType] or nil local translatedDesc = EID.descriptions[EID.Config["Language"]]["bingeEaterBuffs"]
local bingeBuff = (translatedDesc and translatedDesc[closest.SubType]) or EID.descriptions["en_us"]["bingeEaterBuffs"][closest.SubType] or nil
if bingeBuff ~= nil then if bingeBuff ~= nil then
local bingeStr = "#{{Collectible664}} " local bingeStr = "#{{Collectible664}} "
descriptionObj.Description = descriptionObj.Description..bingeStr..bingeBuff[3]:gsub("#",bingeStr) descriptionObj.Description = descriptionObj.Description..bingeStr..bingeBuff[3]:gsub("#",bingeStr)
@@ -730,7 +731,7 @@ end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender) EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
-- only save and load configs when using MCM. Otherwise Config file changes arent valid -- only save and load configs when using MCM. Otherwise Config file changes arent valid
if EID.MCMLoaded then if EID.MCMLoaded or REPENTANCE then
local json = require("json") local json = require("json")
-------------------------------- --------------------------------
--------Handle Savadata--------- --------Handle Savadata---------
@@ -743,7 +744,9 @@ if EID.MCMLoaded then
if savedEIDConfig.Version == EID.Config.Version then if savedEIDConfig.Version == EID.Config.Version then
for key, value in pairs(EID.Config) do for key, value in pairs(EID.Config) do
if savedEIDConfig[key] ~= nil then if savedEIDConfig[key] ~= nil then
EID.Config[key] = savedEIDConfig[key] if (EID.DefaultConfig[key] == value and savedEIDConfig[key] ~= EID.DefaultConfig[key]) or EID.MCMLoaded then
EID.Config[key] = savedEIDConfig[key]
end
end end
end end
EID.isHidden = EID.Config["Hidden"] EID.isHidden = EID.Config["Hidden"]