Merge pull request #307 from valentinLampriere/master
Add an mod indicator which indicates from which mod an item came from
This commit is contained in:
4 files changed
+95
-4
No files matched your search
+20
-4
@@ -49,6 +49,7 @@ EID.ItemTypeAnm2Names = {
|
|||||||
"familiar", -- 4
|
"familiar", -- 4
|
||||||
"trinket" -- 5
|
"trinket" -- 5
|
||||||
}
|
}
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-------------------------Handle API Functions -----------------------------
|
-------------------------Handle API Functions -----------------------------
|
||||||
local nullVector = Vector(0,0)
|
local nullVector = Vector(0,0)
|
||||||
@@ -61,28 +62,28 @@ local dynamicSpriteCache = {} -- used to store sprite objects of collectible ico
|
|||||||
function EID:addCollectible(id, description, itemName, language)
|
function EID:addCollectible(id, description, itemName, language)
|
||||||
itemName = itemName or nil
|
itemName = itemName or nil
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
EID.descriptions[language].custom["5.100." .. id] = {id, itemName, description}
|
EID.descriptions[language].custom["5.100." .. id] = {id, itemName, description, EID._currentMod}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adds a description for a trinket. Optional parameters: itemName, language
|
-- Adds a description for a trinket. Optional parameters: itemName, language
|
||||||
function EID:addTrinket(id, description, itemName, language)
|
function EID:addTrinket(id, description, itemName, language)
|
||||||
itemName = itemName or nil
|
itemName = itemName or nil
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
EID.descriptions[language].custom["5.350." .. id] = {id, itemName, description}
|
EID.descriptions[language].custom["5.350." .. id] = {id, itemName, description, EID._currentMod}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adds a description for a card/rune. Optional parameters: itemName, language
|
-- Adds a description for a card/rune. Optional parameters: itemName, language
|
||||||
function EID:addCard(id, description, itemName, language)
|
function EID:addCard(id, description, itemName, language)
|
||||||
itemName = itemName or nil
|
itemName = itemName or nil
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
EID.descriptions[language].custom["5.300." .. id] = {id, itemName, description}
|
EID.descriptions[language].custom["5.300." .. id] = {id, itemName, description, EID._currentMod}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adds a description for a pilleffect id. Optional parameters: itemName, language
|
-- Adds a description for a pilleffect id. Optional parameters: itemName, language
|
||||||
function EID:addPill(id, description, itemName, language)
|
function EID:addPill(id, description, itemName, language)
|
||||||
itemName = itemName or nil
|
itemName = itemName or nil
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
EID.descriptions[language].custom["5.70." .. id+1] = {id+1, itemName, description}
|
EID.descriptions[language].custom["5.70." .. id+1] = {id+1, itemName, description, EID._currentMod}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adds a character specific description for the item "Birthright". Optional parameters: playerName, language
|
-- Adds a character specific description for the item "Birthright". Optional parameters: playerName, language
|
||||||
@@ -320,6 +321,9 @@ function EID:getDescriptionObj(Type, Variant, SubType, entity)
|
|||||||
|
|
||||||
description.Transformation = EID:getTransformation(Type, Variant, SubType)
|
description.Transformation = EID:getTransformation(Type, Variant, SubType)
|
||||||
|
|
||||||
|
description.ModName = tableEntry and tableEntry[4]
|
||||||
|
description.ModName = tableEntry and tableEntry[4]
|
||||||
|
|
||||||
for k,modifier in pairs(EID.DescModifiers) do
|
for k,modifier in pairs(EID.DescModifiers) do
|
||||||
if modifier.condition(description) then
|
if modifier.condition(description) then
|
||||||
description = modifier.callback(description)
|
description = modifier.callback(description)
|
||||||
@@ -1045,3 +1049,15 @@ 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
|
||||||
|
|
||||||
|
-- Specify the name of the mod which will be displayed next to the item name
|
||||||
|
-- By default EID takes the mod name
|
||||||
|
function EID:setModIndicatorName(newName)
|
||||||
|
EID.ModIndicator[EID._currentMod].Name = newName
|
||||||
|
end
|
||||||
|
-- Set an icon for the mod which will be displayed next to the item name
|
||||||
|
function EID:setModIndicatorIcon(iconMarkup, override)
|
||||||
|
if override == nil then override = true end -- overide previous value if not specified
|
||||||
|
if EID.ModIndicator[EID._currentMod].Icon ~= nil and override == false then return end
|
||||||
|
EID.ModIndicator[EID._currentMod].Icon = iconMarkup
|
||||||
|
end
|
||||||
@@ -131,6 +131,12 @@ EID.UserConfig = {
|
|||||||
-- REPENTANCE ONLY!!!
|
-- REPENTANCE ONLY!!!
|
||||||
-- Default = true
|
-- Default = true
|
||||||
["ShowQuality"] = true,
|
["ShowQuality"] = true,
|
||||||
|
-- Set the mod indicator display
|
||||||
|
-- Default = "Both"
|
||||||
|
["ModIndicatorDisplay"] = "None",
|
||||||
|
-- Set the mod indicator text color
|
||||||
|
-- Default = "ColorLightOrange"
|
||||||
|
["ModIndicatorTextColor"] = "ColorLightOrange",
|
||||||
|
|
||||||
-------TRANSFORMATIONS---------
|
-------TRANSFORMATIONS---------
|
||||||
|
|
||||||
@@ -359,6 +365,8 @@ EID.DefaultConfig = {
|
|||||||
["DisplayTrinketInfo"] = true,
|
["DisplayTrinketInfo"] = true,
|
||||||
["ItemNameColor"] = "ColorEIDObjName",
|
["ItemNameColor"] = "ColorEIDObjName",
|
||||||
["ShowQuality"] = true,
|
["ShowQuality"] = true,
|
||||||
|
["ModIndicatorDisplay"] = "None",
|
||||||
|
["ModIndicatorTextColor"] = "ColorLightOrange",
|
||||||
["ShowObjectID"] = false,
|
["ShowObjectID"] = false,
|
||||||
["TransformationText"] = true,
|
["TransformationText"] = true,
|
||||||
["TransformationIcons"] = true,
|
["TransformationIcons"] = true,
|
||||||
|
|||||||
@@ -57,6 +57,18 @@ 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.ModIndicator = { }
|
||||||
|
-- Overwriting "RegisterMod" to track which mods are loading
|
||||||
|
-- Useful to associate items to mods
|
||||||
|
EID._currentMod = ""
|
||||||
|
local OldRegisterMod = RegisterMod
|
||||||
|
RegisterMod = function (modName, apiVersion)
|
||||||
|
EID._currentMod = modName
|
||||||
|
EID.ModIndicator[modName] = { Name = modName, Icon = nil }
|
||||||
|
return OldRegisterMod(modName, apiVersion)
|
||||||
|
end
|
||||||
|
|
||||||
------- Load all modules and other stuff ------
|
------- Load all modules and other stuff ------
|
||||||
|
|
||||||
--transformation infos
|
--transformation infos
|
||||||
@@ -367,6 +379,16 @@ function EID:printDescription(desc)
|
|||||||
local quality = tonumber(EID.itemConfig:GetCollectible(tonumber(desc.ObjSubType)).Quality)
|
local quality = tonumber(EID.itemConfig:GetCollectible(tonumber(desc.ObjSubType)).Quality)
|
||||||
curName = curName.." - {{Quality"..quality.."}}"
|
curName = curName.." - {{Quality"..quality.."}}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if desc.ModName then
|
||||||
|
if EID.Config["ModIndicatorDisplay"] == "Both" or EID.Config["ModIndicatorDisplay"] == "Name only" then
|
||||||
|
curName = curName .. " {{"..EID.Config["ModIndicatorTextColor"].."}}" .. 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
|
||||||
|
|
||||||
EID:renderString(
|
EID:renderString(
|
||||||
curName,
|
curName,
|
||||||
renderPos + (Vector(offsetX, -3) * EID.Scale),
|
renderPos + (Vector(offsetX, -3) * EID.Scale),
|
||||||
@@ -404,6 +426,7 @@ function EID:printDescription(desc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
EID:printBulletPoints(desc.Description, renderPos)
|
EID:printBulletPoints(desc.Description, renderPos)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function EID:printBulletPoints(description, renderPos)
|
function EID:printBulletPoints(description, renderPos)
|
||||||
|
|||||||
@@ -1206,6 +1206,26 @@ if MCMLoaded then
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
-------Mod indicator for modded items---------
|
||||||
|
local modIndicatorDisplays = {"Both","Name only","Icon only", "None"}
|
||||||
|
MCM.AddSetting(
|
||||||
|
"EID",
|
||||||
|
"Visuals",
|
||||||
|
{
|
||||||
|
Type = ModConfigMenu.OptionType.NUMBER,
|
||||||
|
CurrentSetting = function()
|
||||||
|
return AnIndexOf(modIndicatorDisplays, EID.Config["ModIndicatorDisplay"])
|
||||||
|
end,
|
||||||
|
Minimum = 1,
|
||||||
|
Maximum = #modIndicatorDisplays,
|
||||||
|
Display = function()
|
||||||
|
return "Mod indicator displayed for: " .. EID.Config["ModIndicatorDisplay"]
|
||||||
|
end,
|
||||||
|
OnChange = function(currentNum)
|
||||||
|
EID.Config["ModIndicatorDisplay"] = modIndicatorDisplays[currentNum]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
)
|
||||||
-------Object ID---------
|
-------Object ID---------
|
||||||
MCM.AddSetting(
|
MCM.AddSetting(
|
||||||
"EID",
|
"EID",
|
||||||
@@ -1565,4 +1585,28 @@ if MCMLoaded then
|
|||||||
Info = {"Changes the color of error messages like Unknown pills"}
|
Info = {"Changes the color of error messages like Unknown pills"}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
-- Mod indicator Color
|
||||||
|
MCM.AddSetting(
|
||||||
|
"EID",
|
||||||
|
"Colors",
|
||||||
|
{
|
||||||
|
Type = ModConfigMenu.OptionType.NUMBER,
|
||||||
|
CurrentSetting = function()
|
||||||
|
return AnIndexOf(colorNameArray, EID.Config["ModIndicatorTextColor"])
|
||||||
|
end,
|
||||||
|
Minimum = 0,
|
||||||
|
Maximum = 1000,
|
||||||
|
Display = function()
|
||||||
|
if EID.Config["ModIndicatorTextColor"] == nil then EID.Config["TextColor"] = EID.DefaultConfig["ModIndicatorTextColor"] end
|
||||||
|
EID.MCMCompat_isDisplayingEIDTab = "Visuals";
|
||||||
|
return "Mod Indicator: " .. string.gsub(EID.Config["ModIndicatorTextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ModIndicatorTextColor"]).."/"..#colorNameArray..")"
|
||||||
|
end,
|
||||||
|
OnChange = function(currentNum)
|
||||||
|
if currentNum == 0 then currentNum = #colorNameArray end
|
||||||
|
if currentNum > #colorNameArray then currentNum = 1 end
|
||||||
|
EID.Config["ModIndicatorTextColor"] = colorNameArray[currentNum]
|
||||||
|
end,
|
||||||
|
Info = {"Changes the color of mod indicator texts (as long as they are enabled)."}
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user