EC: health bars stop updating (part 1)
in Bugs
In EC, healthbars of pets and other mobiles (not in your party) stop updating after extended gameplay. Champ spawns are a common case where this happens.
There may be more than one change for this, hence the "part 1". With the below changes, I didn't see the problem where healthbars stop updating.
There are 3 parts to this change:
- Free various table entries (leaks). (I confirmed certain tables contain many hundreds of elements added per champ spawn round).
- Avoid un-necessary data dependency for updating the healthbar (mobileData can be non nil, while data can be nil).
- Reduce un-necessary calls inside the commonly called MobileHealthBar.UpdateStatus(), as this can be called dozens of times a second.
All changes to mobilehealthbar.lua
MobileHealthBar.UnregisterHealthBar()
MobileHealthBar.windowDisabled[mobileId] = nil
-- added free for these
MobileHealthBar.Handled[mobileId] = nil
MobileHealthBar.CheckStatus[mobileId] = nil
MobileHealthBar.RegisterTime[mobileId] = nil
-- overheadtext.lua can create these. (low counts over time).
MobileHealthBar.Changelings[mobileId] = nil
MobileHealthBar.Irks[mobileId] = nil
MobileHealthBar.Guiles[mobileId] = nil
MobileHealthBar.Spites[mobileId] = nil
MobileHealthBar.Travestys[mobileId] = nil
MobileHealthBar.UpdateStatus(mobileId)
local mobileData = Interface.GetMobileData(mobileId, true) -- uses WindowData.MobileStatus[mobileId]
-- local data = WindowData.MobileName[mobileId] -- no longer needed.
-- if(MobileHealthBar.hasWindow[mobileId] == true and data and mobileData) then
if(MobileHealthBar.hasWindow[mobileId] == true and mobileData) then
if(mobileData.Notoriety+1 == NameColor.Notoriety.INVULNERABLE) then -- notoriety check, since most of this is not applicable to other mobiles.
local bodDealer = IsBodDealer( mobileId )
if bodDealer and not DoesWindowNameExist(windowName.."Bod") then
CreateWindowFromTemplate( windowName.."Bod", "BodIconTemplate", windowName)
WindowClearAnchors(windowName.."Bod")
WindowAddAnchor(windowName.."Bod", "topright", windowName .. "Name", "topleft", -7, 20)
WindowSetShowing(windowName.."Bod", true)
elseif(DoesWindowNameExist(windowName.."Bod") and not bodDealer) then
DestroyWindow(windowName.."Bod")
end
-- move this above, where CreateWindowFromTemplate is called?
if(DoesWindowNameExist(windowName.."Bod")) then
WindowSetScale(windowName.."Bod", WindowGetScale(windowName))
end
end
--WindowSetShowing(windowName .. "GreenButton", data.Notoriety+1 ~= NameColor.Notoriety.INVULNERABLE)
--WindowSetShowing(windowName .. "RedButton", data.Notoriety+1 ~= NameColor.Notoriety.INVULNERABLE)
--WindowSetShowing(windowName .. "BlueButton", data.Notoriety+1 ~= NameColor.Notoriety.INVULNERABLE)
-- all windows started with the green, red, blue buttons showing by default, so no reason to set those.
-- note: these buttons should be disabled on monsters...
if(mobileData.Notoriety+1 == NameColor.Notoriety.INVULNERABLE) then -- only invulnerable targets have these buttons removed, currently.
-- avoid repeated calls to SetShowing.
if(WindowGetShowing(windowName .. "GreenButton") == true) then
WindowSetShowing(windowName .. "GreenButton", false)
WindowSetShowing(windowName .. "RedButton", false)
WindowSetShowing(windowName .. "BlueButton", false)
end
end
-- elseif ((data == nil or tostring(perc) == "-1.#IND") and not MobileHealthBar.Handled[mobileId] and mobileId ~= WindowData.PlayerStatus.PlayerId ) then
elseif ((tostring(perc) == "-1.#IND") and not MobileHealthBar.Handled[mobileId] and mobileId ~= WindowData.PlayerStatus.PlayerId ) then -- data could never be nil in prior code.
MobileHealthBar.CheckStatus[mobileId] = true
Comments
https://forum.uo.com/discussion/872/enhance-client-character-sheet
dev still haven’t yet figured out how to copy paste the fixes into default UI after 2 years
This one I linked to is still broken in default UI even though fix is posted here
i think there have been half a dozen player made fixes over the years. “