diff --git a/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua b/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua index 84512a3..2820fff 100644 --- a/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua +++ b/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua @@ -8,6 +8,19 @@ local config = require("Smarter Soultrap.config") local interop = require("Smarter Soultrap.interop") +-- Setup Rational Names interop +local rationalNames = include("RationalNames.interop") + +-- Get display name from Rational Names if it is enabled +local function getDisplayName(item) + if rationalNames == nil then + return item.name + end + + local displayName = rationalNames.common.getDisplayName(string.lower(item.id)) + return displayName or item.name +end + -- Setup MCM. local function registerModConfig() mwse.mcm.registerMCM(require("Smarter Soultrap.mcm")) @@ -105,14 +118,19 @@ local function addSoul(caster, target, targetMobile) if (displaced and checkLevelRequirement(caster, "displacement")) then local message = nil if (config.showDisplacementMessage) then - message = string.format("%s was displaced from %s", displaced.name, bestStack.object.name) + message = string.format("%s was displaced from %s", displaced.name, getDisplayName(bestStack.object)) end -- Check for relocation. if (checkLevelRequirement(caster, "relocation")) then local replaced, replacedTo = addSoul(caster, displaced) if (replaced) then - message = string.format("%s was relocated from %s to %s", displaced.name, bestStack.object.name, replacedTo.name) + message = string.format( + "%s was relocated from %s to %s", + displaced.name, + getDisplayName(bestStack.object), + getDisplayName(replacedTo) + ) end end diff --git a/User Interface Expansion/MWSE/mods/UI Expansion/MenuStat.lua b/User Interface Expansion/MWSE/mods/UI Expansion/MenuStat.lua index 7906e92..d5bcc18 100644 --- a/User Interface Expansion/MWSE/mods/UI Expansion/MenuStat.lua +++ b/User Interface Expansion/MWSE/mods/UI Expansion/MenuStat.lua @@ -65,7 +65,15 @@ local function OnMenuStatTooltip(source, effectFilter, idProperty, fortifyEffect icon.borderRight = 6 local magicInstance = activeEffect.instance - block:createLabel({ text = (magicInstance.item or magicInstance.source).name }) + + local labelText = '' + if magicInstance.item then + labelText = common.getDisplayName(magicInstance.item) + else + labelText = magicInstance.source.name + end + + block:createLabel({ text = labelText }) if (activeEffect.effectId == fortifyEffect) then local magnitudeLabel = block:createLabel({ text = string.format("+%d", activeEffect.magnitude) }) magnitudeLabel.color = GUI_Palette_Positive diff --git a/User Interface Expansion/MWSE/mods/UI Expansion/common.lua b/User Interface Expansion/MWSE/mods/UI Expansion/common.lua index 654c2b4..fff18cd 100644 --- a/User Interface Expansion/MWSE/mods/UI Expansion/common.lua +++ b/User Interface Expansion/MWSE/mods/UI Expansion/common.lua @@ -1,4 +1,5 @@ local common = {} +local rationalNames = include("RationalNames.interop") ---------------------------------------------------------------------------------------------------- -- Generic helper functions. @@ -84,6 +85,16 @@ function common.isTextInputActive() return focus.type == "textInput" end +--- Get display name from Rational Names if it is enabled +function common.getDisplayName(item) + if rationalNames == nil then + return item.name + end + + local displayName = rationalNames.common.getDisplayName(string.lower(item.id)) + return displayName or item.name +end + ---------------------------------------------------------------------------------------------------- -- Keyboard-to-UI binding helpers. ----------------------------------------------------------------------------------------------------