WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   An awesome mod for raid spot healing (https://www.wowinterface.com/forums/showthread.php?t=2711)

oxonian 12-22-05 12:58 PM

An awesome mod for raid spot healing
 
OK this is about range but keep reading!

In a raid, some healers are often on spot heal duty, healing anyone in the raid that needs it. It's very annoying not being able to see, by glacing at the CT Raid status bars, who is in range of your favorite spell. You *can* clear your target and click the spell to bring up the spell gauntlet cursor, and then mouse over status bars until the gauntlet goes blue (so the information is there!)... but that wastes time.

What would be very nice, would be automatic shading on the whole raid's status bars to show who is in range. See the (crappy!) photoshop mockup. It would look much nicer by shading the *background* to the status bars instead of putting borders on, but it would have taken me ages to mock that up.

Cladhaire 12-22-05 01:48 PM

The only realistic way to do this is to change the shading when you cast a spell and it fails, it shades that unit out until you try again and succeed-- but that seems self-defeating.

We have a way to tell if an action is in range of a unit, but I believe we need that unit targeted, and we'd have to do it for everyoen in the raid over a reasonable period of time.

This is asked for a lot =/

oxonian 12-22-05 01:58 PM

Hmmm you need a unit targeted to see if in range of given spell?

Then how come it is ALREADY possible to simply mouse over the status bars with the spell gauntlet (as I described) and the gauntlet changes from glowing to not-glowing as you move from in-range to out-of-range? There is no targetting going on there, no clicking, just mousing around and watching the cursor graphic.

Gazmik 12-22-05 06:23 PM

The glowing/not-glowing gauntlet only happens once you have a spell that's been "cast" and is awaiting target selection (e.g. you don't have a target already and you press an action button or call CastSpell or CastSpellByName). It's based on SpellCanTargetUnit().

It's probably possible (and maybe even feasible performance-wise) to have a script check SpellCanTargetUnit() for all raid members and then dim/highlight frames accordingly, but it would only be accurate for as long as you had a spell currently awaiting target selection. (That is, you couldn't continue to get range updates in real time after you've targeted your spell.)

Depending on what spells you care about range for, though, there's a "trick" that might help. The CheckInteractDistance() function is used to determine which items in the unit popup menu should be available based on your distance to the unit (e.g. trade, inspect, and follow). "Follow" distance is ~28 yards, so you can call CheckInteractDistance(unit, 4) for each unit in your raid and get a pretty good estimate of which units are in range of your spells -- for 30-yard-range spells, anyone within "follow" range is definitely in range for your spells, though there might be some people in range of the spell but not close enough to be flagged by this check. Again, how useful this is depends on which spells you care about range for.

oxonian 12-22-05 07:48 PM

Thanks for the reply. Interesting stuff. Now the trick you mention is a good one, but my main spell is a 40y range one so as it happens that trick isn't the solution (might be better than nothing).

I'm interested to try to understand fully your comments on how the SpellCanTargetUnit() call works. I'm getting the impression that it is necesssary that the user manually has actived the spell? I mean is there no way that an addon can automatically periodically simulate the process of the player clicking a spell icon without a target selected. But even if this is so, presumably one could make an addon where the player hits a specific button, call it the 'Scan' button, and the effect is to (a) clear the target, (b) cast MyFavoriteSpell, (c) assign colouring to all raid memebers accoring to SpellCanTargetUnit(). I'd be happy with that - a nearly perfect solution.
So: as I run around in a busy raid fight, I'd periodically click that scan button to see who is in range of my current position.

Snarfle 12-23-05 09:48 AM

I think the addon called squeaky wheel does much of what you want. From what I understand it tries to follow various targets to see whether they're in range.

Gello 12-23-05 11:31 AM

Instead of a button to scan and then another to heal, you can make casting the heal do the scan. This is a very simplified way to do it with CTRA:
Code:

oldHealRange_UseAction = UseAction
UseAction = function(v1,v2,v3)
        local i,name
        local function findbutton(name)
                local i,found
                for i=1,40 do
                        if getglobal("CT_RAMember"..i.."Name"):GetText()==name then
                                found = i
                        end
                end
                return found or ""
        end
        oldHealRange_UseAction(v1,v2,v3)
        if SpellIsTargeting() then
                for i=1,40 do
                        name = UnitName("raid"..i)
                        button = getglobal("CT_RAMember"..findbutton(name))
                        if name and button then
                                if SpellCanTargetUnit("raid"..i) then
                                        button:SetAlpha(1) -- visually mark them as in range
                                else
                                        button:SetAlpha(.5) -- visually mark them out of range
                                end
                        end
                end
        end
end

What it does is hook UseAction and after a UseAction it checks if you are in spell targeting mode. If you are, then it scans the raid to see who is in range of the spell and then darkens their button if they are out of range (SetAlpha(.5)) and lightens it if they are in range (SetAlpha(1)).

Alternately, you can have it periodically check while in spell targeting mode. In the XML:
Code:

<Frame name="HealRange_Update" hidden="true">
        <Scripts>
                <OnUpdate>
                        HealRange_Update_OnUpdate()
                </OnUpdate>
        </Scripts>
</Frame>

In the lua:
Code:

local timer

oldHealRange_UseAction = UseAction
UseAction = function(v1,v2,v3)
        local i,name
        local function findbutton(name)
                local i,found
                for i=1,40 do
                        if getglobal("CT_RAMember"..i.."Name"):GetText()==name then
                                found = i
                        end
                end
                return found or ""
        end
        oldHealRange_UseAction(v1,v2,v3)
        if SpellIsTargeting() then
                timer = 2 -- do an immediate scan (timer>1)
                HealRange_Update:Show() -- start OnUpdates
        end
end

function HealRange_Update_OnUpdate()
        timer = timer + arg1
        if timer > 1 then
                timer = 0
                if SpellIsTargeting() then
                        for i=1,40 do
                                name = UnitName("raid"..i)
                                button = getglobal("CT_RAMember"..findbutton(name))
                                if name and button then
                                        if SpellCanTargetUnit("raid"..i) then
                                                button:SetAlpha(1) -- visually mark them as in range
                                        else
                                                button:SetAlpha(.5) -- visually mark them out of range
                                        end
                                end
                        end
                else
                        HealRange_Update:Hide() -- stop OnUpdates
                end
        end
end

You would probably want to tweak the findbutton() function since it's likely that the name isn't wiped when someone is moved to a different raid button. Something like:

Code:

        local function findbutton(name)
                local i,found,button
                for i=1,40 do
                        button = getglobal("CT_RAMember"..i.."Name")
                        if button:IsVisible() and button:GetText()==name then
                                found = i
                        end
                end
                return found or ""
        end

And the SetAlpha probably isn't the best solution as a visual indicator if they're in range. You could make 40 frames each anchored to the TOPLEFT and BOTTOMRIGHT of the CT_RAMember1-40 buttons. (Doesn't need to be a part of CTRA either) And then hide or show or set colors or whatever if they're in range or out.

Probably more that would need doing but it's a start.

oxonian 12-23-05 08:06 PM

Wow thanks for the detailed response. From what you are saying, seems like what I want is entirely doable.

One part I didn't follow is the purpose of the last block of code, the bit about find button.

How long would it take an experienced mod maker to try this?

Gello 12-24-05 02:29 AM

The findbutton translates a name ("Bob", "Joe", etc) to the number of the raid button in CTRA (1 for "CTRAMember1", 2 for "CTRAMember2", etc)

The first block of code at least should work, just copy/paste it into any existing lua file. I don't play a priest anymore but I'll see about fleshing it out a bit and posting a version someone else can pick up.

edit: Posted likely at this link when it's approved: http://www.wowinterface.com/download...fo.php?id=4433

oxonian 12-24-05 11:30 PM

I just tried this with a small raid (since most of guild offline ATM) - it rocks! I'm amazed - it's exactly what I hoped it would be.

There is one small bug - I've mentioned it in the addon's own thread on the linked page.

Gonna post about this on my guilds site, get some more testers using it...

solariz 01-12-06 11:19 AM

Another Idea how to get along with this:

click

But not quite as good for this reason.

Jondice 02-07-06 01:16 AM

thank you
 
hats off to you sir for making this modification to CTRA


All times are GMT -6. The time now is 02:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI