Page 1 of 8
1
2
3
... LastLast
  1. #1

    Holy Nova Addon for WoD

    It's currently looking like WoD will feature some pretty heavy use of HN for disc, and a lot of the math is showing it to only be really worth using if it will have minimal overhealing on the full 5 targets.

    I was hoping to look into the possibility of an addon or WA/TMW string that does a simple range and health check to determine if we're in range of 5 people who need healing. I'm not particularly familiar with the limitations of addons/WA/TMW, but I expect this to be pretty easy to do.

    If there's anyone who's good with addons and is interested in looking into this idea, just let me know
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  2. #2
    Too bad, Vuhdo is no longer supported, but still seems to be usable and clusters still work on it(at least in beta).
    "My successes are my own, but my failures are due to extremist leftist liberals" - Party of Personal Responsibility

    Prediction for the future

  3. #3
    I haven't been using Vuhdo so I'm not all that familiar with what kinds of extra features it has.

    The DBM range radar seems like it would have most of the functionality we would need for this, so I'm certain its possible to make one. I'm not really sure what the deal is with addon copyright and whatnot, but hypothetically, if we started with the DBM range radar as the foundation, then added some code to check the health of those within the desired ranged - 12 yrds in this case. Obviously we wouldn't need the actual radar, although there'd be no reason not to have an option for it. We'd want it to check that their health missing is at least as much as HN heals for, and then just make a simple interface output - some icon that displays different colour based on how many valid targets are in range.

    - - - Updated - - -

    I just looked at the .LUA file for the DBM range radar, and the section on copyright is as follows:
    -- The code of this addon is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License. (see license.txt)
    -- All included textures and sounds are copyrighted by their respective owners.
    --
    --
    -- You are free:
    -- * to Share ?to copy, distribute, display, and perform the work
    -- * to Remix ?to make derivative works
    -- Under the following conditions:
    -- * Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
    -- * Noncommercial. You may not use this work for commercial purposes.
    -- * Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
    So... I think it would be okay to use it as the basis for an addon as long as we acknowledge that it was based on their code or something like that?
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  4. #4
    Quote Originally Posted by Atonement View Post
    I haven't been using Vuhdo so I'm not all that familiar with what kinds of extra features it has.

    The DBM range radar seems like it would have most of the functionality we would need for this, so I'm certain its possible to make one. I'm not really sure what the deal is with addon copyright and whatnot, but hypothetically, if we started with the DBM range radar as the foundation, then added some code to check the health of those within the desired ranged - 12 yrds in this case. Obviously we wouldn't need the actual radar, although there'd be no reason not to have an option for it. We'd want it to check that their health missing is at least as much as HN heals for, and then just make a simple interface output - some icon that displays different colour based on how many valid targets are in range.

    - - - Updated - - -

    I just looked at the .LUA file for the DBM range radar, and the section on copyright is as follows:

    So... I think it would be okay to use it as the basis for an addon as long as we acknowledge that it was based on their code or something like that?
    Vuhdo scans and puts a number on people's health bars according to your cluster indicator settings. This number tells you how many valid targets are in range of said person should you decide to cast a spell on him/her.

    Works wonderfully for any aoe healing spells, but you need to set the thresholds properly, as well as whether it's a PBAoE spell, or a spell centered around a target that is either party-only or any ally/raid member.

    And yes to your last question.
    Last edited by PosPosPos; 2014-09-13 at 06:12 AM.
    "My successes are my own, but my failures are due to extremist leftist liberals" - Party of Personal Responsibility

    Prediction for the future

  5. #5
    Awesome, now to teach myself some LUA coding.
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  6. #6
    Quote Originally Posted by PosPosPos View Post
    Too bad, Vuhdo is no longer supported, but still seems to be usable and clusters still work on it(at least in beta).
    As far as I know, someone took over the development of Vuhdo, so it should be updated in WoD.

  7. #7
    Deleted
    I guess it can be easily made in Grid2. It supports health deficit, range/radius and number of players to be healed.

  8. #8
    Quote Originally Posted by laplacedemon View Post
    As far as I know, someone took over the development of Vuhdo, so it should be updated in WoD.
    Is this true? As far as I know some guy took it over just to update the ToC/make it functional for beta. He has no intent of supporting it for WoD.

    Unless there's someone else?

  9. #9
    Mechagnome
    10+ Year Old Account
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    666
    Another option would be to develop a friendly nameplate module for Tidy Plates (or something similar) that displays nothing above a healthy player (>80%), a yellow triangle (50-80%) and a red exclamation point (<50%) and make the symbols, colors and thresholds configurable. I was thinking of something like that for MW Monk because of all the PBAoE they have.

  10. #10
    Would love to know if Vuhdo is actually going to be supported come WoD...Not sure what the alternative would be. Holy Nova cluster would have been ideal. Was always great for Chain Heal.

  11. #11
    Mechagnome
    10+ Year Old Account
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    666
    I don't understand how a raid frame is supposed to tell you where to stand to cast HN. It's not like you can target someone with HN. That's why I think the best solution would be an indicator on the players. That way when you suddenly see a bunch of players in an area with an indicator pop up above their heads you can move to that location. That's why Atonement is looking for something like the range indicator in DBM, but to highlight locations of low health players, not players within x yards. I just think a nameplate solution would work better.

  12. #12
    I plan to make one for that, I'll probably test it with a weakaura custom script and then make an addon for optimization. If VuhDo is not supported maybe I'll try to code a Grid plugin for this also.
    If you want to get a good example on how to start coding on AoE Clusters I'd recommend Grid Plugin for Circle of Healing (GridStatusPriestAOE), it had the trigonometry functions bultin last time I checked
    Last edited by moothz; 2014-09-14 at 02:02 AM.

  13. #13
    Yeah, I don't think a raidframe will be very good for PBAoE. I wasn't thinking of making something that tells you where to stand, just one that tells you if there are enough people in range that need healing. The extra idea for the range radar was just because I was looking at working from the DBM range radar as a basis for the code, but my original idea was simply an icon that indicates if there are enough low health players in range of HN to make it worth using. Ideally I'd set up a WA or TMW icon that just changes colour based on how many injured players are within 12 yrds, maybe display the number too, but I'm not convinced that TMW/WA is capable of that kind of functionality.

    The idea for a tidyplates kind of indicator is a good idea for indicating where to stand, but it doesn't make it all that much easier to judge if there are actually enough people in range. I know I wouldn't really have the reactions to count if there are enough injured markes in range, let alone be able to work out exactly what the range is. I also think the Tidyplates option wouldn't be too difficult to make for someone familiar with the Tidyplates code.

    Right now my main problem is trying to isolate the DBM range radar from the rest of the addon. I thought I had managed to extract all the necessary code from the DBM-RangeCheck LUA files, but I ran into plenty of problems when it came to anything that involved the DBM-Core LUA script and everything to do with the XML scripts -_-

    - - - Updated - - -

    Although, now that I think about it, you'd only need a cluster finder on yourself for HN, so grid/vuhdo could actually work, but I'd like it to be a stand alone addon if possible. Makes it easier for people who don't want to use the parent addon.

    - - - Updated - - -

    okay so I've given up on trying to understand DBM's code and have just started from scratch. The following code is very rough and I have very little idea what I'm doing, so yeah, be gentle
    Code:
    ------------------------------------
    --------- Holy Nova Radar ----------
    ----------------HNR-----------------
    -- much alpha, such clueless, WOW --
    -- pls halp ------------------------
    ------------------------------------
    SetMapToCurrentZone() -- Not sure where to put this
    function HNRrangecheck()
    local numPlayers = GetNumGroupMembers() -- Find number of raid members
    local playerX, playerY = GetPlayerMapPosition("player")-- get player position
    local t    = GetTime
    local mastery = GetMastery()
    local sbh     = GetSpellBonusHealing()
    local HNheal = (1.125*sbh*(1 + (mastery) / 100))-- meant to be the direct healing done on each target, pls halp
            if playerX == 0 and playerY == 0 then return end -- Avoids an issue with map origin (0,0)
            k = 0 -- set inRange counter to 0
            validTargets = 0
            for i = 1, numPlayers do
                if i <= numPlayers then
                    uId = "raid"i or "party"i
                    if UnitIsVisible(uId)=1 then-- ensures unit is in the same zone
                        local unitX, unitY = GetPlayerMapPosition(uId) -- gets unit position
                            if unitX == 0 and unitY == 0 then return end
                        dist = ((playerX - unitX)^2 + (playerY - unitY)^2)^(1/2) -- calculate distance
                        if dist <=12 then -- in range of Holy Nova (12 yrds) 
                        k = k + 1-- adds to inRange counter
                        local inRangeId[k] = uId -- adds uId to an inRange array at the k'th position
                    end
                end
            end
            k = numInRange -- saves the total number of players in range
        for k = 1 to numInRange do
            local unitMaxHP = UnitHealthMax(inRangeId[k]) -- gets unit's max HP
            local unitHP = UnitHealth(inRangeId[k]); -- gets unit's current HP
            local unitHPdeficit = unitMaxHp - unitHP -- gets unit's HP deficit
            if unitHPdeficit <= HNheal then -- checks if unit's HP deficit is less than HN's heal amount
                    validTargets = validTargets + 1 -- if true, adds 1 to the total valid target count
            end
        end
    end
    So when validTargets is 1-2 the icon will be green, when validTargets is 3-4 it will be orange/yellow and when its 5+ the icon will be red.

    Things I need help with
    • Everything
    • Making Frames for the UI output
    • Making it 'refresh' or 'update' every however often is necessary
    • Making it not bad
    • Everything
    • Making it update the map on zone change
    • Everything
    • The XML file
    • Adding a /HNR on/off command
    • Renaming it now that it doesn't actually have a radar
    • Maybe I'll leave it as HNR and add that function in later if I ever learn how :|
    • Everything
    • Adding options to save the UI frame position
    • The math for the amount HN heals for (the "HNheal" variable)
    • A graphic for the UI output - I was thinking maybe just some styalized version of the HN icon in 3 shades (red, yellow/orange, green?)
    I'll try to get round to as much of this as possible myself, but basically I'll have to teach myself everything on that list, so any help is really appreciated, especially for the refreshing/OnUpdate stuff and adding options/save data.
    Last edited by Jimjam38; 2014-09-14 at 12:28 PM.
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  14. #14
    A vuhdo cluster based on range and health percentage would work for me: icons popping up on vuhdo's raid frames. Just a quick visual indicator. 5Sure there may be other ways, but that's what I like about vuhdo. Sort of a one stop shop for clusters, rebuffs, etc.

    - - - Updated - - -

    A vuhdo cluster based on range and health percentage would work for me: icons popping up on vuhdo's raid frames. Just a quick visual indicator. Sure there may be other ways, but that's what I like about vuhdo. Sort of a one stop shop for clusters, rebuffs, etc.
    Last edited by constantduty; 2014-09-14 at 03:16 PM.

  15. #15
    Quote Originally Posted by Atonement View Post
    Yeah, I don't think a raidframe will be very good for PBAoE. I wasn't thinking of making something that tells you where to stand, just one that tells you if there are enough people in range that need healing. The extra idea for the range radar was just because I was looking at working from the DBM range radar as a basis for the code, but my original idea was simply an icon that indicates if there are enough low health players in range of HN to make it worth using. Ideally I'd set up a WA or TMW icon that just changes colour based on how many injured players are within 12 yrds, maybe display the number too, but I'm not convinced that TMW/WA is capable of that kind of functionality.

    The idea for a tidyplates kind of indicator is a good idea for indicating where to stand, but it doesn't make it all that much easier to judge if there are actually enough people in range. I know I wouldn't really have the reactions to count if there are enough injured markes in range, let alone be able to work out exactly what the range is. I also think the Tidyplates option wouldn't be too difficult to make for someone familiar with the Tidyplates code.

    Right now my main problem is trying to isolate the DBM range radar from the rest of the addon. I thought I had managed to extract all the necessary code from the DBM-RangeCheck LUA files, but I ran into plenty of problems when it came to anything that involved the DBM-Core LUA script and everything to do with the XML scripts -_-

    - - - Updated - - -

    Although, now that I think about it, you'd only need a cluster finder on yourself for HN, so grid/vuhdo could actually work, but I'd like it to be a stand alone addon if possible. Makes it easier for people who don't want to use the parent addon.

    - - - Updated - - -

    okay so I've given up on trying to understand DBM's code and have just started from scratch. The following code is very rough and I have very little idea what I'm doing, so yeah, be gentle
    Code:
    ------------------------------------
    --------- Holy Nova Radar ----------
    ----------------HNR-----------------
    -- much alpha, such clueless, WOW --
    -- pls halp ------------------------
    ------------------------------------
    SetMapToCurrentZone() -- Not sure where to put this
    function HNRrangecheck()
    local numPlayers = GetNumGroupMembers() -- Find number of raid members
    local playerX, playerY = GetPlayerMapPosition("player")-- get player position
    local t    = GetTime
    local mastery = GetMastery()
    local sbh     = GetSpellBonusHealing()
    local HNheal = (1.125*sbh*(1 + (mastery) / 100))-- meant to be the direct healing done on each target, pls halp
            if playerX == 0 and playerY == 0 then return end -- Avoids an issue with map origin (0,0)
            k = 0 -- set inRange counter to 0
            validTargets = 0
            for i = 1, numPlayers do
                if i <= numPlayers then
                    uId = "raid"i or "party"i
                    if UnitIsVisible(uId)=1 then-- ensures unit is in the same zone
                        local unitX, unitY = GetPlayerMapPosition(uId) -- gets unit position
                            if unitX == 0 and unitY == 0 then return end
                        dist = ((playerX - unitX)^2 + (playerY - unitY)^2)^(1/2) -- calculate distance
                        if dist <=12 then -- in range of Holy Nova (12 yrds) 
                        k = k + 1-- adds to inRange counter
                        local inRangeId[k] = uId -- adds uId to an inRange array at the k'th position
                    end
                end
            end
            k = numInRange -- saves the total number of players in range
        for k = 1 to numInRange do
            local unitMaxHP = UnitHealthMax(inRangeId[k]) -- gets unit's max HP
            local unitHP = UnitHealth(inRangeId[k]); -- gets unit's current HP
            local unitHPdeficit = unitMaxHp - unitHP -- gets unit's HP deficit
            if unitHPdeficit <= HNheal then -- checks if unit's HP deficit is less than HN's heal amount
                    validTargets = validTargets + 1 -- if true, adds 1 to the total valid target count
            end
        end
    end
    You'll need a lib to calc the distance between players b/c the GetUnitPosition only returns data relative to the current map that you are on. LibMapData or Astrolabe is the one I think.
    Anyways, I took the easier route and did a plugin for ElvUI that uses the distance function built in to it. I plan to re-enable HN for my plugin ElvUI_PriestAoe (though it does chain heal, holy radiance and wild growth as well) since HN was irrelevant in MoP.

  16. #16
    Deleted
    Hey Atonement, i think i can help you with some parts. I made an example, it displays the holy nova icon, draggable, and a text in the center, currently the amount of potential healing targets. it also shows how to do a slash command ("/hnr toggle" to hide the frame) and the update part. The only thing missing is: saving and loading the position, calculating the holy nova heal amount and clean code ^^. The range check in this example depends on DBM. the example does not use xml for layout.

    Code:
    SLASH_HNT1 = '/hnt'
    function SlashCmdList.HNT(input, editbox)
    	if input == "toggle" then
    		if HNTrackerFrame:IsShown() then
    			HNTrackerFrame:Hide()
    		else
    			HNTrackerFrame:Show()
    		end			
    	end
    end
    
    local HNTracker
    HNTracker = CreateFrame("Frame","HNTrackerFrame",UIParent)
    HNTracker:SetMovable(true)
    HNTracker:EnableMouse(true)
    HNTracker:RegisterForDrag("LeftButton")
    HNTracker:SetScript("OnDragStart", HNTracker.StartMoving)
    HNTracker:SetScript("OnDragStop", HNTracker.StopMovingOrSizing)
    HNTracker:SetPoint("CENTER"); HNTracker:SetWidth(64); HNTracker:SetHeight(64);
    HNTracker:SetUserPlaced(true) -- tell blizz to care about saving the position
    
    local tex = HNTracker:CreateTexture("ARTWORK"); -- holy nova texture
    tex:SetAllPoints();
    tex:SetTexture("Interface\\Icons\\Spell_Holy_HolyNova.blp")
    
    local topMost = CreateFrame("Frame", nil, HNTracker)
    topMost:SetWidth(HNTracker:GetWidth()); 
    topMost:SetHeight(HNTracker:GetHeight());
    topMost:SetPoint("CENTER");
    local texGreen = topMost:CreateTexture("ARTWORK"); -- texture green transparent overlay
    texGreen:SetAllPoints();
    texGreen:SetTexture(0, 1, 0);
    texGreen:SetAlpha(0.2);
    
    local texRed = topMost:CreateTexture("ARTWORK"); -- texture green transparent overlay
    texRed:SetAllPoints();
    texRed:SetTexture(1, 0, 0); 
    texRed:SetAlpha(0.2);
    texRed:Hide();
    
    local text = topMost:CreateFontString();
    text:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE, MONOCHROME")
    text:SetText(0)
    text:SetTextColor(1,1,1)
    text:SetPoint("CENTER",topMost,"CENTER",0,0)
    
    
    
    function HNTracker:updateHNTracker()
    	
    	SetMapToCurrentZone()
      
    	local activeRange = 12; -- HN range 12 yrds
    	local numPlayers = GetNumGroupMembers()
    
        local player = GetUnitName("player")	 
    	local prefix = "raid"
    	local playerThreshold = 5000 -- TODO calc HN Heal value
    	local dims = DBM:GetMapSizes()
    
    	local playerX, playerY = GetPlayerMapPosition("player")
    	if playerX == 0 and playerY == 0 then return end -- Somehow we can't get the correct position?
    
    	
    	if not IsInRaid() then
    		prefix = "party"
    		numPlayers = numPlayers - 1
    	end		
    	
    	local playersInRange = 0 -- anzahl spieler in range mit health defizit
    	-- add yourself as a potential healing target
    	local healthDeficit = UnitHealthMax("player") - UnitHealth("player")
    	if healthDeficit > playerThreshold then					
    		playersInRange = playersInRange + 1						
    	end
    	
    	
    	for i = 1, numPlayers do
    
    		local unit = prefix..i	
    	
    		if not UnitIsUnit(unit, "player") and not UnitIsDeadOrGhost(unit) then
    	
    			local x, y = GetPlayerMapPosition(unit)		
    			
    			if x ~= 0 and y ~= 0 then 
    				
    				local cx = (x - playerX) * dims[1]
    				local cy = (y - playerY) * dims[2]
    				local range = (cx * cx + cy * cy) ^ 0.5
    
    				if range < (activeRange * 1.1) then-- add 10% because of map data inaccuracies
    					-- player is in nova range
    					--determine if player has a health deficit
    					
    					local healthDeficit = UnitHealthMax(unit) - UnitHealth(unit)
    					if healthDeficit > playerThreshold then					
    						playersInRange = playersInRange + 1						
    					end
    				end	
    			end
    		end
    		if playersInRange >= 5 then -- exit loop when 5 viable players were found
    			break
    		end
    	end
    
    	text:SetText(playersInRange) -- TODO change texture depending on player count
    	if playersInRange > 4 then 
    		texRed:Hide()
    		texGreen:Show()
    	else 
    		texRed:Show()
    		texGreen:Hide()	
    	end
    	
    	return playersInRange
    end
    
    
    -- setup onUpdate
    local tickTime = 0.5 -- call range checking function ever tickTime seconds
    local targetTime = 0
    local total = 0
    function HNTracker:onUpdate(elapsed)
        total = total + elapsed
    
        if total >= tickTime then
    		
    		HNTracker:updateHNTracker() -- call updateHNTracker every 0,5 secs
    		total = 0
            targetTime = tickTime
        end	
    end
    
    HNTracker:SetScript("OnUpdate", HNTracker.onUpdate)
    Last edited by mmoc1481f7b61b; 2014-09-14 at 06:59 PM. Reason: code updated, turns out that blizz saves the position of named frames themself if you set frame:SetUserPlaced(true)

  17. #17
    Thanks so much Dessi, I clearly have no idea what im doing lol. I'll look at it when I get home tonight, but it looks like thats a lot of the stuff I needed xD

    Do you think I'll need to use a lib for the distance? Its just that I really dont know much about this stuff, the extent of my programing education was a VB and VBA course at uni last year, and libs are certainly beyond my current understanding :| I didnt think the dbm range check used a lib, but then again I wouldnt even know what im looking for if it does.

    I know GetMapPosition only returns data relative to the current map, but cant I just make sure to update the current map on zone change?

    - - - Updated - - -

    Thanks so much Dessi, I clearly have no idea what im doing lol. I'll look at it when I get home tonight, but it looks like thats a lot of the stuff I needed xD

    Do you think I'll need to use a lib for the distance? Its just that I really dont know much about this stuff, the extent of my programing education was a VB and VBA course at uni last year, and libs are certainly beyond my current understanding :| I didnt think the dbm range check used a lib, but then again I wouldnt even know what im looking for if it does.

    I know GetMapPosition only returns data relative to the current map, but cant I just make sure to update the current map on zone change?

    - - - Updated - - -

    So, the way I understand it, that code looks like the only part that depends on DBM in the "dims = DBM:GetMapSizes()"? I can see that a lot of it was based on the DBM code, but what parts actually require DBM to be installed to function?

    - - - Updated - - -

    Also, why is it necessary to exclude yourself from the numPlayers? If you're not in the last raid position then wouldnt "numPlayers = numPlayers-1" result in it checking all but the last person in the group? I thought that as long as you have it check everyone in the raid then it will include yourself as a target if your health deficit is enough. Is there some particular reason that you have it check yourself separately?
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  18. #18
    Deleted
    Well, im not familiar with neither the wow api nor the dbm code. The dbm function only does some caching and calls some wow api function so you could remove the dependency. I was doing some lfr and it seems to work fine.

    The documentation on UnitId says "The Nth party member excluding the player (1,2,3 or 4).". So if you are in a party with another guy, only party1 is accessible, there is no party2 in this case. Iterating over partyN will ignore the player in the party case, not in the raidN case. Kind of strange. Another aproach would be to include the player in the party case and not to explude the player in the raid case ^^.

    My biggest Problem is getting the right Holy Nova Heal value. I couldnt figure out how to read out the versatility and even if i could the calculation does not match ingame values.

    Code:
    local mastery = GetMasteryEffect()
    local versatilityRating = 102 -- TODO api function for versatility?
    local spellBonusHealing = GetSpellBonusHealing()
    
    --  coeff * spellpower * heal mastery * versatility * grace
    HNTracker.HNheal = (1.125 * spellBonusHealing * (mastery/100/2+1) *   ( (1/130* versatilityRating ) /100+1) * 1.08)

    You wanted yellow for 3-4 targets. i did not include this yet. tbh i did not look at the hpm values for disc yet so i have no clue about a basic ruleset when to cast holy nova. I Switched green/red because "do things on green" is more intuitive in my opinion.

  19. #19
    Bloodsail Admiral nobodysbaby's Avatar
    15+ Year Old Account
    Join Date
    Feb 2009
    Location
    Sweden
    Posts
    1,055
    Im pretty sure there will come addons for this purpose. I wouldnt want raidicons used for it tho :-D A simple range checker in Grid is all I need.

  20. #20
    Holy Nova is our best HPM, so mana isn't a concern for this addon. General consensus at the moment is that it's only worth casting with 5 targets due to PWS being so strong, but this could change before live. Either way HN is going to be used a lot, and it will generally be best to use when you have the most targets - the purpose of this addon is to make it easy to see how many people are in range.

    I'm having trouble getting it to work - I'm testing it on the PTR and dbm isn't loading, so I'm going to try fixing that first. Do I need to do anything special with the TOC file or does the LUA containing the code you wrote need to be saved as a specific name?

    - - - Updated - - -

    Okay I've got DBM working - I just downloaded the Beta version. I'm still not getting anything when i /hnt

    - - - Updated - - -

    Okay awesome, I got it to work and its pretty much exactly what I was after I might see if i can make something nicer for the UI but its pretty good already. I'll also see if i can remove the DBM dependency and if all goes well I'll work on adding the radar component.

    - - - Updated - - -

    Okay, so I've removed the DBM dependency, fixed a bug where it was counting the player when dead, added a HNR global, changed the /HNR to toggle without having to type 'toggle' and a few other things. Anyway, here's the code:
    Code:
    -------------------------------------------------------------------------------------------
    ------------------------------------ Holy Nova Radar --------------------------------------
    -------------------------------------------------------------------------------------------
    ------------------------------------- Version 1.0.1 ---------------------------------------
    -------------------------------------------------------------------------------------------
    -- This code was created and developed by the priest community of MMO-Champion.com, with
    -- special thanks to Dessi, who wrote most of the working script, and to Atonement who had
    -- an idea, some good intentions and access to Google.
    -------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------
    -- Disclaimer:
    -- This code was written using elements of the DBM-RangeChecker.lua code which 
    -- was written and copyrighted by:
    --    * Paul Emmerich (Tandanu @ EU-Aegwynn) (DBM-Core)
    --    * Martin Verges (Nitram @ EU-Azshara) (DBM-GUI)
    -- however HNR and its creators are by no means endorsed by DBM or its authors
    --
    -- In compliance with the copyright specifications outlined by the DBM authors
    -- on which this work is based, you are free:
    --    * to Share to copy, distribute, display, and perform the work
    --    * to Remix to make derivative works
    --  Under the following conditions:
    --    * Attribution. You must attribute the work in the manner specified by the author or 
    --      licensor (but not in any way that suggests that they endorse you or your use of the
    --      work).
    --    * Noncommercial. You may not use this work for commercial purposes.
    --    * Share Alike. If you alter, transform, or build upon this work, you may distribute
    --      the resulting work only under the same or similar license to this one.
    --------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------
    
    ---------------------
    ------ Globals ------
    ---------------------
    HNR = {}
    
    ---------------------
    ------ Options ------
    ---------------------
    
    ---------------------
    --- Slash Command ---
    ---------------------
    
    SLASH_HNR1 = '/HNR'
    function SlashCmdList.HNR(input, editbox)
    	if input == "" then
    		if HNRFrame:IsShown() then
    			HNRFrame:Hide()
    		else
    			HNRFrame:Show()
    		end			
    	end
    end
    
    ----------------------
    ---- Create Frame ----
    ----------------------
    local HNR
    HNR = CreateFrame("Frame","HNRFrame",UIParent)
    HNR:SetMovable(true)
    HNR:EnableMouse(true)
    HNR:RegisterForDrag("LeftButton")
    HNR:SetScript("OnDragStart", HNR.StartMoving)
    HNR:SetScript("OnDragStop", HNR.StopMovingOrSizing)
    HNR:SetPoint("CENTER"); 
    HNR:SetWidth(64); 
    HNR:SetHeight(64);
    HNR:SetUserPlaced(true) -- tells blizz to care about saving the position
    
    local tex = HNR:CreateTexture("ARTWORK"); -- holy nova texture
    tex:SetAllPoints();
    tex:SetTexture("Interface\\Icons\\Spell_Holy_HolyNova.blp")
    
    local topMost = CreateFrame("Frame", nil, HNR)
    topMost:SetWidth(HNR:GetWidth()); 
    topMost:SetHeight(HNR:GetHeight());
    topMost:SetPoint("CENTER");
    local texGreen = topMost:CreateTexture("ARTWORK"); -- texture green transparent overlay
    texGreen:SetAllPoints();
    texGreen:SetTexture(0, 1, 0);
    texGreen:SetAlpha(0.2);
    
    local texRed = topMost:CreateTexture("ARTWORK"); -- texture green transparent overlay
    texRed:SetAllPoints();
    texRed:SetTexture(1, 0, 0); 
    texRed:SetAlpha(0.2);
    texRed:Hide();
    
    local text = topMost:CreateFontString();
    text:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE, MONOCHROME")
    text:SetText(0)
    text:SetTextColor(1,1,1)
    text:SetPoint("CENTER",topMost,"CENTER",0,0)
    
    
    ------------------------
    ------- Map Sizes ------
    ------------------------
    HNR.MapSizes = {}
    
    function HNR:RegisterMapSize(zone, ...)
    	if not HNR.MapSizes[zone] then
    		HNR.MapSizes[zone] = {}
    	end
    	local zone = HNR.MapSizes[zone]
    	for i = 1, select("#", ...), 3 do
    		local level, width, height = select(i, ...)
    		zone[level] = {width, height}
    	end
    end
    
    function HNR:UpdateMapSizes()
    	-- try custom map size first
    	SetMapToCurrentZone()
    	local mapName = GetMapInfo()
    	local floor, a1, b1, c1, d1 = GetCurrentMapDungeonLevel()
    	local dims = HNR.MapSizes[mapName] and HNR.MapSizes[mapName][floor]
    	if dims then
    		currentSizes = dims
    		return
    	end
    
    	-- failed, try Blizzard's map size
    	if not (a1 and b1 and c1 and d1) then
    		local zoneIndex, a2, b2, c2, d2 = GetCurrentMapZone()
    		a1, b1, c1, d1 = a2, b2, c2, d2
    	end
    
    	if not (a1 and b1 and c1 and d1) then return end
    	currentSizes = {abs(c1-a1), abs(d1-b1)}
    end
    
    function HNR:GetMapSizes()
    	if not currentSizes then
    		HNR:UpdateMapSizes()
    	end
    	return currentSizes
    end
    
    
    -----------------------
    ---- Range Checker ----
    -----------------------
    
    function HNR:updateHNR()
    	
    	SetMapToCurrentZone()
      
    	local activeRange = 12; -- HN range 12 yrds
    	local numPlayers = GetNumGroupMembers()
    
        local player = GetUnitName("player")	 
    	local prefix = "raid"
    	local playerThreshold = 5000 -- TODO calc HN Heal value
    	local dims = HNR:GetMapSizes()
    
    	local playerX, playerY = GetPlayerMapPosition("player")
    	if playerX == 0 and playerY == 0 then return end -- Somehow we can't get the correct position?
    
    	
    	if not IsInRaid() then
    		prefix = "party"
    		numPlayers = numPlayers - 1
    	end		
    	
    	local playersInRange = 0 -- anzahl spieler in range mit health defizit
    	-- add yourself as a potential healing target
    	if not UnitIsDeadOrGhost("player") then
    		local healthDeficit = UnitHealthMax("player") - UnitHealth("player")
    		if healthDeficit > playerThreshold then					
    				playersInRange = playersInRange + 1						
    		end
    	end
    	
    	
    	for i = 1, numPlayers do
    
    		local unit = prefix..i	
    	
    		if not UnitIsUnit(unit, "player") and not UnitIsDeadOrGhost(unit) then
    	
    			local x, y = GetPlayerMapPosition(unit)		
    			
    			if x ~= 0 and y ~= 0 then 
    				
    				local cx = (x - playerX) * dims[1]
    				local cy = (y - playerY) * dims[2]
    				local range = (cx * cx + cy * cy) ^ 0.5
    
    				if range <= (activeRange * 1.1) then-- add 10% because of map data inaccuracies
    					-- player is in nova range
    					--determine if player has a health deficit
    					
    					local healthDeficit = UnitHealthMax(unit) - UnitHealth(unit)
    					if healthDeficit > playerThreshold then					
    						playersInRange = playersInRange + 1						
    					end
    				end	
    			end
    		end
    		if playersInRange >= 5 then -- exit loop when 5 viable players were found
    			break
    		end
    	end
    
    	text:SetText(playersInRange) -- TODO change texture depending on player count
    	if playersInRange > 4 then 
    		texRed:Hide()
    		texGreen:Show()
    	else 
    		texRed:Show()
    		texGreen:Hide()	
    	end
    	
    	return playersInRange
    end
    
    ----------------------
    --- setup onUpdate ---
    ----------------------
    local tickTime = 0.05 --call range checking function ever tickTime seconds
    local targetTime = 0
    local total = 0
    function HNR:onUpdate(elapsed)
        total = total + elapsed
    
        if total >= tickTime then
    		
    		HNR:updateHNR() -- call updateHNR every 0.05secs
    		total = 0
            targetTime = tickTime
        end	
    end
    
    HNR:SetScript("OnUpdate", HNR.onUpdate)
    Things we still need to do:
    • Add a proper options interface + allow the icon the be resized + save layout (position, size)
    • Design a proper Icon/GUI + good shading options (currently the red/green is pretty hard to see and is horrible for colourblind players)
    • Solve the maths behind calculating Holy Nova's heal amount - interaction with versatility (see Dessi's post above)
    • Clean up the code if necessary - not sure what 'clean' code looks like exactly, but I actually understand all this code so it seems clean to me and its using a minimal amount of memory (<10 KB in the wow addon's pannel thingy) so I presume it's pretty good as is.
    • Try to add in the actual Radar component - based on DBM's radar, but using health colour for the dots rather than class colour, ie green for full health players (95-100%), yellow for light ( 75-95%), orange for moderate (50-75%), red for severe (<50%).
    Last edited by Jimjam38; 2014-09-15 at 06:53 AM.
    Disc Priests: Just 2 mana trinkets away from becoming Withered

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •