morrowind-mods icon indicating copy to clipboard operation
morrowind-mods copied to clipboard

UI Expansion: Filled Soul Gem value wrong on tooltip

Open jimfcarroll opened this issue 5 years ago • 2 comments

The value of an unfilled soul gem is always shown in the tooltip even if the soul gem is filled.

For my own purposes I personally hacked around this by preventing the hiding of the default fields for weight and value for soul gems. This is a terrible "fix" since both the correct value and incorrect value is shown. I don't know where the correct value could be attained from or I'd have posted a proper fix. Sorry.

jimfcarroll avatar Dec 12 '19 23:12 jimfcarroll

-- Soul gem capacity
elseif e.object.isSoulGem then
  local rawSoulValue
  pcall(function()
    rawSoulValue = e.itemData.soul.soul
  end)
  if rawSoulValue == nil then
    rawSoulValue = 0
  end
  labelFormatted(e.tooltip, string.format("%s: %u", common.dictionary.soulCapacity, rawSoulValue))

  -- Fixup item value based on MCP feature state.
  if rawSoulValue > 0 then
    if (tes3.hasCodePatchFeature(65)) then
      objectValue = (rawSoulValue ^ 3) / 10000 + rawSoulValue * 2
    else
      objectValue = objectValue * rawSoulValue
    end
  end
end

This works for me, although I don't know if it's correct or idiomatic.

ledigbick avatar Mar 28 '20 02:03 ledigbick

I think this has been fixed by this (value is correct for me now):

https://github.com/NullCascade/morrowind-mods/commit/ca755ee3b4de89b4b950499a8998c25c9b18d2b6#diff-dc7a88405997f1cc9459f35656b26afbR264

However, the soul size is displayed 3x the actual size of what I get when I try to enchant sh*t:

image

raveren avatar Jul 06 '20 22:07 raveren