Thread Tools Display Modes
06-04-19, 04:09 AM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Are focus frames even possible in Classic Wow?

I know for vanilla wow, there were focus frame addons to be able to see a second unit's hp/mana/castbar/etc.

However, is this even possible for the classic beta?

It seems that functions like UnitHealth will only work on a party member or your current target.

When used on someone not inside of your group, the function returns 0.

Any ideas?
  Reply With Quote
06-04-19, 05:32 AM   #2
wardz
A Deviate Faerie Dragon
 
wardz's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 17
You have to build a database of the unit's information by scanning your party members target, mouseover, nearby nameplates etc. If a nearby nameplate belongs to your focused player, you can use something like nameplate1.Healthbar:GetValue() to get the health. For auras/casts you can parse the combat log. This is how focus frame works in vanilla aswell. Edit: Technically you could also estimate health based on damage taken in the combat log.

Edit2: I think in Classic/Retail nameplates have valid unitIDs which would make things slightly easier.



Btw, there's no way to target the focus in classic. At best, you could make your addon create a macro for you automatically like: "/targetexact name /cast spell /targetlasttarget" but addons can't create macros in combat so you won't be able to set a new focus in combat.

Last edited by wardz : 06-04-19 at 07:18 AM.
  Reply With Quote
06-04-19, 07:21 AM   #3
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by wardz View Post
You have to build a database of the unit's information by scanning your party members target, mouseover, nearby nameplates etc. If a nearby nameplate belongs to your focused player, you can use something like nameplate1.Healthbar:GetValue() to get the health. For auras/casts you can parse the combat log. This is how focus frame works in vanilla aswell. Edit: Technically you could also estimate health based on damage taken in the combat log.

Edit2: I think in Classic/Retail nameplates have valid unitIDs which would make things slightly easier.



Btw, there's no way to target the focus in classic. At best, you could make your addon create a macro for you automatically like: "/targetexact name /cast spell /targetlasttarget" but addons can't create macros in combat so you won't be able to set a new focus in combat.
I knew there was no way to target the focus, but I didn't know about the nameplate workaround to try to get unit health that way. I will look more into that. Thanks a lot for the helpful info!
  Reply With Quote
06-05-19, 08:50 AM   #4
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Okay, so i've looked more into it and i'm a bit stuck on something.
Code:
function ScanTest()
    local frames = { WorldFrame:GetChildren() }

    for _, plate in ipairs(frames) do
        local name = plate:GetName()
        if (name ~= nil) then
            if (name:find("NamePlate")) then
                print(UnitName(plate:GetName()))
            end
        end
    end
end
In this example, i'm scanning the frames to get the nameplates. If I have nameplates on, this is fine and I can get their info IF they are close to me.

However, if I don't have nameplates on, I can't get info like this... There was an addon made for 1.12 that was able to scan plates without having nameplates on. It also wasn't restricted to the short distance that nameplates have in classic wow beta. Any ideas how I can get around this issue?
  Reply With Quote
06-05-19, 09:50 AM   #5
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
Without a proper UnitID(i.e. target, targettarget, party1target, nameplate1, etc.) and nameplates you'll have to use the combat log method. As a plus every unit has a UnitGUID which can be tracked in the combat log.

Since you need a valid UnitID before casting/attacking you can get the UnitGUID and health on an event related to casting/attacking. Once you have those two things you can keep track of damage and healing from the combat log for a focus. This however means you can't click the focus frame since it has no UnitID, though you might be able to modify the interface to use something like /targetlasttarget (it is not a valid unit token) to constantly update the last target to always be your focus.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
06-05-19, 10:06 AM   #6
wardz
A Deviate Faerie Dragon
 
wardz's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 17
In this example, i'm scanning the frames to get the nameplates. If I have nameplates on, this is fine and I can get their info IF they are close to me.

However, if I don't have nameplates on, I can't get info like this...


That's why you build a list of scanners from multiple sources. If nameplates are disabled or out of range, you get the health from the combat log, party targets, target of target, unit events etc when it matches the focus. (You can even chain unitIDs like party1targettargettarget but that'll hurt performance)

There was an addon made for 1.12 that was able to scan plates without having nameplates on.


In Vanilla you could force enable the nameplates and set their alpha level to zero + disable mouse click, and still get info that way. No idea if this is still possible in retail.


It also wasn't restricted to the short distance that nameplates have in classic wow beta.
Afaik that wasn't possible in vanilla. You could increase combat log distance but not nameplate range. When the nameplates are hidden, they get recycled and no longer gets any unit updates.
  Reply With Quote
06-05-19, 10:21 AM   #7
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
Originally Posted by wardz View Post
In Vanilla you could force enable the nameplates and set their alpha level to zero + disable mouse click, and still get info that way. No idea if this is still possible in retail.
It is not.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
06-05-19, 11:37 AM   #8
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Thanks everybody for your help. The answer was not what I had hoped for, but i'm glad to know how it works now!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Are focus frames even possible in Classic Wow?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off