Add custom mod icon + custom mod name

This commit is contained in:
Valentin Lampriere committed 2022-01-15 00:28:33 +01:00
1 parent a783265bc8
commit c06348aeeb
4 files changed
+34 -18

No files matched your search

+8 -1
View File
@@ -49,7 +49,6 @@ EID.ItemTypeAnm2Names = {
"familiar", -- 4 "familiar", -- 4
"trinket" -- 5 "trinket" -- 5
} }
EID.MODS = { }
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-------------------------Handle API Functions ----------------------------- -------------------------Handle API Functions -----------------------------
@@ -1049,3 +1048,11 @@ end
function EID:getErrorColor() function EID:getErrorColor()
return EID:getColor(EID.Config["ErrorColor"], EID.InlineColors["ColorEIDError"]) return EID:getColor(EID.Config["ErrorColor"], EID.InlineColors["ColorEIDError"])
end end
function EID:addModIndicatorName(newName)
EID.ModIndicator[EID._currentMod].Name = newName
end
function EID:addModIndicatorIcon(iconMarkup)
EID.ModIndicator[EID._currentMod].Icon = iconMarkup
end
+4 -4
View File
@@ -131,9 +131,9 @@ EID.UserConfig = {
-- REPENTANCE ONLY!!! -- REPENTANCE ONLY!!!
-- Default = true -- Default = true
["ShowQuality"] = true, ["ShowQuality"] = true,
-- Display mod name for modded items -- Set the mod indicator display
-- Default = true -- Default = "Both"
["ShowModName"] = true, ["ModIndicatorDisplay"] = "Both",
-------TRANSFORMATIONS--------- -------TRANSFORMATIONS---------
@@ -362,7 +362,7 @@ EID.DefaultConfig = {
["DisplayTrinketInfo"] = true, ["DisplayTrinketInfo"] = true,
["ItemNameColor"] = "ColorEIDObjName", ["ItemNameColor"] = "ColorEIDObjName",
["ShowQuality"] = true, ["ShowQuality"] = true,
["ShowModName"] = true, ["ModIndicatorDisplay"] = "Both",
["ShowObjectID"] = false, ["ShowObjectID"] = false,
["TransformationText"] = true, ["TransformationText"] = true,
["TransformationIcons"] = true, ["TransformationIcons"] = true,
+13 -3
View File
@@ -57,11 +57,15 @@ local hudBBSprite = Sprite()
hudBBSprite:Load("gfx/eid_transform_icons.anm2", true) hudBBSprite:Load("gfx/eid_transform_icons.anm2", true)
hudBBSprite:Play("boundingBox") hudBBSprite:Play("boundingBox")
EID._currentMod = ""
EID.ModIndicator = { }
-- Overwriting "RegisterMod" to track which mods are loading
-- Useful to associate items to mods
EID._currentMod = ""
local OldRegisterMod = RegisterMod local OldRegisterMod = RegisterMod
RegisterMod = function (modName, apiVersion) RegisterMod = function (modName, apiVersion)
EID._currentMod = modName EID._currentMod = modName
EID.ModIndicator[modName] = { Name = modName, Icon = nil }
return OldRegisterMod(modName, apiVersion) return OldRegisterMod(modName, apiVersion)
end end
@@ -376,9 +380,15 @@ function EID:printDescription(desc)
curName = curName.." - {{Quality"..quality.."}}" curName = curName.." - {{Quality"..quality.."}}"
end end
if EID.Config["ShowModName"] and desc.ModName then if desc.ModName then
curName = curName .. " {{ColorWhite}}" .. desc.ModName if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Name only" then
curName = curName .. " {{ColorWhite}}" .. EID.ModIndicator[desc.ModName].Name
end
if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Icon only" and EID.ModIndicator[desc.ModName].Icon then
curName = curName .. "{{".. EID.ModIndicator[desc.ModName].Icon .."}}"
end
end end
print(EID.Config["ModIndicatorDisplay"])
EID:renderString( EID:renderString(
curName, curName,
+9 -10
View File
@@ -1206,24 +1206,23 @@ if MCMLoaded then
} }
) )
end end
-------Mod name for modded items--------- -------Mod indicator for modded items---------
local modIndicatorDisplays = {"Both","Name only","Icon only", "None"}
MCM.AddSetting( MCM.AddSetting(
"EID", "EID",
"Visuals", "Visuals",
{ {
Type = ModConfigMenu.OptionType.BOOLEAN, Type = ModConfigMenu.OptionType.NUMBER,
CurrentSetting = function() CurrentSetting = function()
return EID.Config["ShowModName"] return AnIndexOf(modIndicatorDisplays, EID.Config["ModIndicatorDisplay"])
end, end,
Minimum = 1,
Maximum = #modIndicatorDisplays,
Display = function() Display = function()
local onOff = "False" return "Mod indicator displayed for: " .. EID.Config["ModIndicatorDisplay"]
if EID.Config["ShowModName"] then
onOff = "True"
end
return "Display mod name: " .. onOff
end, end,
OnChange = function(currentBool) OnChange = function(currentNum)
EID.Config["ShowModName"] = currentBool EID.Config["ModIndicatorDisplay"] = modIndicatorDisplays[currentNum]
end end
} }
) )