Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Smarter Soultrap/MWSE/mods/Smarter Soultrap/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion User Interface Expansion/MWSE/mods/UI Expansion/MenuStat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions User Interface Expansion/MWSE/mods/UI Expansion/common.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local common = {}
local rationalNames = include("RationalNames.interop")

----------------------------------------------------------------------------------------------------
-- Generic helper functions.
Expand Down Expand Up @@ -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.
----------------------------------------------------------------------------------------------------
Expand Down