EC: health bars stop updating (part 1)

ForeverFunForeverFun Posts: 771
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:
  1. Free various table entries (leaks).  (I confirmed certain tables contain many hundreds of elements added per champ spawn round).
  2. Avoid un-necessary data dependency for updating the healthbar (mobileData can be non nil, while data can be nil).
  3. 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

  • GrimbeardGrimbeard Posts: 1,787
    I'm gonna go ahead and name forever the new lead developer based on work done and community communication
  • ForeverFunForeverFun Posts: 771
    Sorry, the last paste above didn't include the spellweaving update  (use mobileData, instead of data). 

    MobileHealthBar.UpdateStatus(mobileId)

    			LabelSetText(windowName .. "HealthBarPerc", perc .. L"%")
    if (Interface.HealthBarWod and (mobileData.Notoriety+1 ~= NameColor.Notoriety.FRIEND) and (mobileData.Notoriety+1 ~= NameColor.Notoriety.INVULNERABLE) and WindowData.SkillsCSV) then -- checks moved from below.
    local serverId = WindowData.SkillsCSV[Interface.SpellweavingID].ServerId
    local skillLevel = WindowData.SkillDynamicData[serverId].TempSkillValue / 10

    if (skillLevel >= 83 and not MobilesOnScreen.IsPet(mobileId) ) then
    local circleLimit = (Interface.ArcaneFocusLevel + 1) * 5
    if (circleLimit <= 0) then
    circleLimit = 0
    end

    if (perc < circleLimit) then
    WindowSetShowing(windowName .. "Wod", true)
    else
    WindowSetShowing(windowName .. "Wod", false)
    end

    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.


  • YoshiYoshi Posts: 3,322
    edited May 2023
    "lol players gotta program their own code bug fixes in EC or download third party stuff for fixes for CC
    this is pay to play every month too"
    Posts on this account have been pre filtered from personal comment or opinion in an effort to suppress conservative views in order to protect the reader.
  • YoshiYoshi Posts: 3,322
    “You’re actually wasting your time fixing things in EC because 
    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. “
    Posts on this account have been pre filtered from personal comment or opinion in an effort to suppress conservative views in order to protect the reader.
Sign In or Register to comment.