From 70b73e1d5bf659082bf67e841e890bb9f259beef Mon Sep 17 00:00:00 2001 From: Dana Yatsuta Date: Thu, 28 Nov 2024 13:47:54 +0300 Subject: [PATCH 1/5] Rational Names helper method --- .../MWSE/mods/UI Expansion/common.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/User Interface Expansion/MWSE/mods/UI Expansion/common.lua b/User Interface Expansion/MWSE/mods/UI Expansion/common.lua index 654c2b4..bee34ac 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(item.id) + return displayName or item.name +end + ---------------------------------------------------------------------------------------------------- -- Keyboard-to-UI binding helpers. ---------------------------------------------------------------------------------------------------- From b3cdad7ad960dc231f7a27e1687b4c46236c42bd Mon Sep 17 00:00:00 2001 From: Dana Yatsuta Date: Thu, 28 Nov 2024 14:31:43 +0300 Subject: [PATCH 2/5] Show display name in stat modifier UI --- .../MWSE/mods/UI Expansion/MenuStat.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 From 8378ca35e96b54388ee0ad2813e6fd289ccaf7a8 Mon Sep 17 00:00:00 2001 From: Dana Yatsuta Date: Thu, 28 Nov 2024 15:19:59 +0300 Subject: [PATCH 3/5] Convert ID to lowercase before lookup --- User Interface Expansion/MWSE/mods/UI Expansion/common.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/User Interface Expansion/MWSE/mods/UI Expansion/common.lua b/User Interface Expansion/MWSE/mods/UI Expansion/common.lua index bee34ac..fff18cd 100644 --- a/User Interface Expansion/MWSE/mods/UI Expansion/common.lua +++ b/User Interface Expansion/MWSE/mods/UI Expansion/common.lua @@ -91,7 +91,7 @@ function common.getDisplayName(item) return item.name end - local displayName = rationalNames.common.getDisplayName(item.id) + local displayName = rationalNames.common.getDisplayName(string.lower(item.id)) return displayName or item.name end From b5655a16bd857ae7c3041bcafded945061bc4c81 Mon Sep 17 00:00:00 2001 From: Dana Yatsuta Date: Sat, 30 Nov 2024 18:33:00 +0300 Subject: [PATCH 4/5] Smarter Soultrap RN compat --- .../MWSE/mods/Smarter Soultrap/main.lua | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua b/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua index 84512a3..96cc888 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 +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 From 4d9c0992a7f6ee63507c58300fe6d4212d32555d Mon Sep 17 00:00:00 2001 From: Dana Yatsuta Date: Thu, 5 Dec 2024 23:30:02 +0300 Subject: [PATCH 5/5] Smarter Soultrap: Make getDisplayName function local --- Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua b/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua index 96cc888..2820fff 100644 --- a/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua +++ b/Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua @@ -12,7 +12,7 @@ local interop = require("Smarter Soultrap.interop") local rationalNames = include("RationalNames.interop") -- Get display name from Rational Names if it is enabled -function getDisplayName(item) +local function getDisplayName(item) if rationalNames == nil then return item.name end