Page 2 of 8 FirstFirst
1
2
3
4
... LastLast
  1. #21
    This looks awesome, Good job on it so far
    I`ll certainly keep my Eye on this for woD

    Quote Originally Posted by ThrashMetalFtw View Post
    The pre-WotLK Mind Flay animation. 2nd biggest reason for rolling a Priest, biggest obviously being Shadowform. Anyone who uses Glyph of Shadow should reroll Hunter, filthy blasphemers.

  2. #22
    Very nice scripts, Atonement/Dessi!

    -- Edit, I overlooked something ahaha

    I'm not sure how expensive getting data from GetCurrentMapDungeonLevel or GetCurrentMapZone is (CPU usage wise), or even, if they always return good values (blizz functions tend to give different results without much change whatsoever), but there is a nice lib that has all map data hardcoded: LibMapdata. For performance, you could, of course, get the raid maps size only from this lib and put them in your code.

    -- Edit
    Just in case you haven't figured how to make the radar yet, here's the DBM radar code stripped down, so it's easier to understand:
    Note: To update the position, you have to normalize the map coordinate value so it fits in the radar
    Code:
    Code included in below's no paste
    -- Edit
    Here's the radar working, and the code (very rough, just to give you a glimpse). Range radius has to be doubled because it becomes diameter, should have doubled in the function instead of setting "24"
    http://i.imgur.com/XXXZD2V.jpg
    http://nopaste.info/8570eac3a6.html

    I chose to scan everything and put into an array, then call the radar and rangecheck/heal amount function (yours).
    Last edited by moothz; 2014-09-15 at 05:00 PM.

  3. #23
    Deleted
    Hey there,
    i was doing the options interface today plus saving/loading. Still some things on my TODO but beta is currently down. I will upload it tomorrow.

  4. #24
    Updated my code to make it look better than the last version, should be easy enough to understand and includes all functionalities in last Atonement Post.
    I have not tested since I'm not home, but I'll be testing in a few hours.

    Obs:
    - Radar with colored Health Dots
    - Used same map size calculations you guys provided, still don't know if it's the best solution
    - No Holy Nova calculation
    - Icon with Players in range number
    - Icon Overlay is a single texture, it's color is changed instead of creating two different ones
    - All colors are globally defined, makes it easy to swap colors and create config menus for them
    - Slash commands for Enable/Disable Icon and radar separately
    - Still needs to create a frame that contains both the radar and the icon, then set the update event to it - better readability and avoid issues


    -- Link Updated, it had A LOT if silly errors: (I even forgot do square root the hypotenuse)
    http://pastebin.com/EQBaQEU7
    Screencaps:
    http://i.imgur.com/Ty4kO3E.jpg
    http://i.imgur.com/FnAONvW.jpg

    -- The code is VERY bad optimized, running very slow
    Last edited by moothz; 2014-09-16 at 01:53 AM.

  5. #25
    Here's where I got with trying to extract the radar from DBM:
    Code:
    -------------------------------------------------------------------------------------------
    ------------------------------------ Holy Nova Radar --------------------------------------
    -------------------------------------------------------------------------------------------
    ------------------------------------- Version 1.0.2 ---------------------------------------
    -------------------------------------------------------------------------------------------
    -- 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 and other stuff ------
    -------------------------------------
    HNR = {}
    local dots = {}
    local mainFrame = CreateFrame("Frame")
    local radarFrame = {}
    local max, sin, cos, pi = math.max, math.sin, math.cos, math.pi
    ---------------------
    ------ Options ------
    ---------------------
    
    ---------------------------
    ---- Create Icon 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)
    
    --------------------------
    --- Create Radar Frame ---
    --------------------------
    	local radarFrame = CreateFrame("Frame", "HNRRadar", UIParent)
    	radarFrame:SetMovable(true)
    	radarFrame:EnableMouse(true)
    	radarFrame:RegisterForDrag("LeftButton")
    	radarFrame:SetScript("OnDragStart", HNR.StartMoving)
    	radarFrame:SetScript("OnDragStop", HNR.StopMovingOrSizing)
    	radarFrame:SetFrameStrata("DIALOG")
    	radarFrame:SetPoint("CENTER");
    	radarFrame:SetHeight(128);
    	radarFrame:SetWidth(128);
    	radarFrame:SetUserPlaced(true)
    
    	local bg = radarFrame:CreateTexture(nil, "BACKGROUND")
    	bg:SetAllPoints(radarFrame)
    	bg:SetBlendMode("BLEND")
    	bg:SetTexture(0, 0, 0, 0.3)
    	radarFrame.background = bg
    
    	local circle = radarFrame:CreateTexture(nil, "ARTWORK")
    	circle:SetSize(85, 85)
    	circle:SetPoint("CENTER")
    	circle:SetTexture("Interface\\AddOns\\HNR\\textures\\radar_circle.blp")
    	circle:SetVertexColor(0, 1, 0)
    	circle:SetBlendMode("ADD")
    	radarFrame.circle = circle
    
    	local player = radarFrame:CreateTexture(nil, "OVERLAY")
    	player:SetSize(32, 32)
    	player:SetTexture("Interface\\Minimap\\MinimapArrow.blp")
    	player:SetBlendMode("ADD")
    	player:SetPoint("CENTER")
    
    	local text = radarFrame:CreateFontString(nil, "OVERLAY", "GameTooltipText")
    	text:SetWidth(128)
    	text:SetHeight(15)
    	text:SetPoint("BOTTOMLEFT", radarFrame, "TOPLEFT", 0,0)
    	text:SetTextColor(1, 1, 1, 1)
    	text:Show()
    	radarFrame.text = text
    
    	local inRangeText = radarFrame:CreateFontString(nil, "OVERLAY", "GameTooltipText")
    	inRangeText:SetWidth(128)
    	inRangeText:SetHeight(15)
    	inRangeText:SetPoint("TOPLEFT", radarFrame, "BOTTOMLEFT", 0,0)
    	inRangeText:SetTextColor(1, 1, 1, 1)
    	inRangeText:Hide()
    	radarFrame.inRangeText = inRangeText
    
    	for i = 1, 40 do
    		local dot = radarFrame:CreateTexture(nil, "OVERLAY")
    		dot:SetSize(24, 24)
    		dot:SetTexture("Interface\\Minimap\\PartyRaidBlips")
    		dot:Hide()
    		dots[i] = dot
    	end
    
    
    
    ------------------------
    ------- 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
    --------------------
    ------ Radar -------
    --------------------
    local RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS
    local BLIP_TEX_COORDS = {
    	["WARRIOR"]	= { 0,	   0.125, 0,    0.25 },
    	["PALADIN"]	= { 0.125, 0.25,  0,    0.25 },
    	["HUNTER"]	= { 0.25,  0.375, 0,    0.25 },
    	["ROGUE"]	= { 0.375, 0.5,   0,    0.25 },
    	["PRIEST"]	= { 0.5,   0.625, 0,    0.25 },
    	["DEATHKNIGHT"]	= { 0.625, 0.75,  0,    0.25 },
    	["SHAMAN"]	= { 0.75,  0.875, 0,    0.25 },
    	["MAGE"]	= { 0.875, 1,     0,    0.25 },
    	["WARLOCK"]	= { 0,     0.125, 0.25, 0.5  },
    	["DRUID"]	= { 0.25,  0.375, 0.25, 0.5  },
    	["MONK"]	= { 0.125, 0.25, 0.25, 0.5 }
    }
    local rotation, pixelsperyard, activeDots, numPlayers, circleColor, prevRange, prevNumClosePlayer, prevColor = 0, 0, 0, 0, 0, 0, 0, 0
    local unitList = {}
    do
    function radarFrame:setDot(id)
    		local dot = dots[id]
    		local x = dots[id].x
    		local y = dots[id].y
    		local range = dots[id].range
    		if range < (activeRange * 1.5) then -- if person is closer than 1.5 * range, show the dot. Else hide it
    			local dx = ((x * cos(rotation)) - (-y * sin(rotation))) * pixelsperyard -- Rotate the X,Y based on player facing
    			local dy = ((x * sin(rotation)) + (-y * cos(rotation))) * pixelsperyard
    			dot:ClearAllPoints()
    			dot:SetPoint("CENTER", radarFrame, "CENTER", dx, dy)
    			if not dot.isShown then
    				dot.isShown = true
    				dot:Show()
    			end
    		elseif dot.isShown then
    			dot.isShown = nil
    			dot:Hide()
    		end
    	end
    end
    
    function radarFrame:updateIcon()
    		numPlayers = GetNumGroupMembers()
    		activeDots = max(numPlayers, activeDots)
    		for i = 1, activeDots do
    			local dot = dots[i]
    			if i <= numPlayers then
    				unitList[i] = IsInRaid() and "raid"..i or "party"..i
    				local uId = unitList[i]
    				local _, class = UnitClass(uId)
    				local icon = GetRaidTargetIndex(uId)
    				dot.class = class
    				if icon then
    					dot.icon = icon
    					dot:SetTexture(format("Interface\\TargetingFrame\\UI-RaidTargetingIcon_%d", icon))
    					dot:SetTexCoord(0, 1, 0, 1)
    					dot:SetSize(16, 16)
    					dot:SetDrawLayer("OVERLAY", 1)
    				else
    					dot.icon = nil
    					class = class or "PRIEST"
    					local c = RAID_CLASS_COLORS[class]
    					dot:SetTexture("Interface\\Minimap\\PartyRaidBlips")
    					dot:SetTexCoord(BLIP_TEX_COORDS[class][1], BLIP_TEX_COORDS[class][2], BLIP_TEX_COORDS[class][3], BLIP_TEX_COORDS[class][4])
    					dot:SetSize(24, 24)
    					dot:SetDrawLayer("OVERLAY", 0)
    				end
    			elseif dot.isShown then
    				dot.isShown = nil
    				dot:Hide()
    			end
    		end
    	end
    updater = mainFrame:CreateAnimationGroup()
    updater:SetLooping("REPEAT")
    local anim = updater:CreateAnimation()
    anim:SetDuration(0.05)
    function radarFrame:Show()
    updater:SetScript("OnLoop", updateRangeFrame)
    updater:Play()
    end
    function radarFrame:Hide()
    	updater:Stop()
    end
    
    mainFrame:SetScript("OnEvent", function(self, event, ...)
    	if event == "GROUP_ROSTER_UPDATE" or event == "RAID_TARGET_UPDATE" then
    		updateIcon()
    	elseif event == "ZONE_CHANGED" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED_NEW_AREA" then
    		dims = nil
    		HNR:UpdateMapSizes()
    	end
    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
    ---------------------
    --- Slash Command ---
    ---------------------
    
    SLASH_HNR1 = '/HNR'
    function SlashCmdList.HNR(input, editbox)
    	if input == "" then
    		if HNRFrame:IsShown() then
    				HNRFrame:Hide()
    			else
    				HNRFrame:Show()
    		end			
    	elseif input == "radar" then
    			if radarFrame:IsShown() then
    				radarFrame:Hide()
    			else
    				radarFrame:Show()
    		end
    	end
    end
    
    HNR:SetScript("OnUpdate", HNR.onUpdate)
    I managed to get the radar frame to appear, but I wasn't able to get it to show the dots. TBH I had no clue what I was doing, I only got that far with excessive trial and error. I'll have a look at the code you said was the trimmed down version of DBM's range radar.
    I should add, I actually perfer the look of the radar in the screenshot you linked Moothz. Do you think it would be possible to make it so that the player can resize it (within a certain range)?

    - - - Updated - - -

    Would we be able to just mesh that radar you've made into the existing 1.0.1 code I linked on the previous page?

    - - - Updated - - -

    I've also made copies of the addon at each version, so we can go back to working ones if we need.

    - - - Updated - - -

    Also, I'm not certain, but in the screenshot, it looks like the position on the radar has been inverted?

    - - - Updated - - -

    In regards to the map sizes stuff, my version 1.0.1 code is working perfectly having extracted the DBM map sizes code, so I would assume its good enough to use

    - - - Updated - - -

    I just saw the updated screencaps, that's looking really awesome. It still looks like its inverted though?

    - - - Updated - - -

    Okay so I tested it out - looks like what's happening is that the radar isn't rotating like the DBM one is. The other thing is that the player isn't being counted in the icon check if they're low health - that might only be in a party situation, I didn't test it in a raid.

    - - - Updated - - -

    I've also found that something in the radar code is storing data without clearing it for a fair while, and was causing noticeable FPS drops. When I used /hn radar to turn off the radar it stopped. It was also considerably worse in the shrine where there were a lot of people around. Not sure what's causing it, it shouldn't have anything to do with the radar dots because I wasn't in a group, so I'm not sure, it could be something to do with the maps.. or idk

    - - - Updated - - -

    Might want to try using the code I extracted from DBM's map update scripts
    Code:
    ------------------------
    ------- 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
    Idk if that helps at all. Its definitely got something to do with the radar, because it stops when I turn the radar off. I can't tell if it's having an effect on fps anymore, but its definitely storing data
    Disc Priests: Just 2 mana trinkets away from becoming Withered

  6. #26
    Okay so I tested it out - looks like what's happening is that the radar isn't rotating like the DBM one is. The other thing is that the player isn't being counted in the icon check if they're low health - that might only be in a party situation, I didn't test it in a raid.
    I`m no coder and have absolutely zero knowledge about it but i was wondering could the Malkorok helper addon help in some way with the code
    http://www.curse.com/addons/wow/malkorok-helper

    Possibly also with the data gathering you mentioned in your post but i might be talking horse shite :P

    Quote Originally Posted by ThrashMetalFtw View Post
    The pre-WotLK Mind Flay animation. 2nd biggest reason for rolling a Priest, biggest obviously being Shadowform. Anyone who uses Glyph of Shadow should reroll Hunter, filthy blasphemers.

  7. #27
    Hey, I'm back! ahahah Different Timezones
    Ye, I made it inverted. I can code it so it "spins" like the DBM one, but I removed that on purpouse ahahah (Because our facing doesn't matter for holy hova).
    I'll make it spin for fun! (and leave a variable to toggle it)

    Oh, I'll use those DBM map codes, they look better than the "cut here cut there" I did.

    I have some ideas for better performance - doing one calculation on a pulse, and the other calculation on another, so they don't hang the code for too long. The goal is to run the code faster than the time I've set for it to pulse, which is not happening. Gotta put some "timestamps" to check this out, since I couldn't track it with a performance addon. I have a mount farm guild run tonight (in 12 hours), so I'll be fixing it while I raid.
    If separating the codes execution doesn't fix the lag issues, I'll give a different approach to the code. I focused on readability/reusability by making a list of player objects first, then iterating through that list - that causes the code to run two different for loops, instead of only one (like the code you first posted, and that's where I'm going for optimization).

    Posting another code and updating it without testing (or maybe, I'll try to test it on the proving grounds, it's hard to find people willing to group with me on the beta or my main server (very low pop).

    ---- Answering your questions
    - I want to make it resizeable, but not like DBMs, only if I can make it resize only as a square, to make things easier (a lot easier). Otherwise, we should put an option for it on the options menu.
    - I didn't account the player on purpose, should I? I didn't seem to be receiving healing from my own holy nova. It's an easy fix, though (remove UnitIsUnit from the check on the getList method).
    - Weird FPS drops for the radar, there shouldnt be any leak (even in lua, that has garbage collecting I think). When not in a group it definitely should drop any FPS, since pretty much nothing is running. Gonna run my eyes through the code and look for optimizations

    Ps.: I have no idea how to make an options menu, btw, but I did separate everything in variables, we should be able to load/store values into them easily (like colors, sizes, positions). Ace3 provides great profiling for saving I heard.
    Last edited by moothz; 2014-09-16 at 10:39 AM.

  8. #28
    addon create a lot of new tables. use wipe(table) instead.


    Code:
     UpdatePinMap()
    instead of
    Code:
            local playerList = getValidPlayerList()
            updateData(playerList,radius)

    UpdatePinMap() code:
    Code:
    
    local function UnitHP(unit)
    	local maxHp = UnitHealthMax(unit)
        local currentHp = UnitHealth(unit)
    
    	if maxHp == 0 then
            maxHp = 1
        end
        if currentHp == 0 then
            currentHp = 1
        end
     
        local pctHp = currentHp/maxHp
     
        return pctHp, currentHp-maxHp
    end
    
    -- Holy Nova Heal amount - TBD
    local HolyNovaAmount = 5000
    
    -- 1 = No overheal is allowed, 0 = Full overheal is allowed
    local HolyNovaOverhealCoheficient = 1
    local holynovaRadius = 12
    
    local function UpdatePinMap()
    
    	local playersInRange = 0
    
    	local playerX, playerY = GetPlayerMapPosition("player")
    	
    	if playerX == 0 and playerY == 0 then
    		SetMapToCurrentZone()
    		playerX, playerY = GetPlayerMapPosition("player")		
    	end
    	
    	for i=1, #dot do
    		dot:Hide()
    	end
    	
    	for i=1, GetNumGroupMembers() do
    		local unit = IsInRaid() and format("raid%d", i) or format("party%d", i)
    
    
    		if UnitExists(unit) and not UnitIsDeadOrGhost(unit) and not UnitIsUnit(unit,"player") then
    
    			
    			local pctHp, difHp = UnitHP(unit)
    
    			local unitX, unitY = GetPlayerMapPosition(unit)
    			
    			local distance = getDistance(currentMap.width*playerX, currentMap.height*playerY, currentMap.width*unitX, currentMap.height*unitY)
    			
    			if difHp > HolyNovaAmount*HolyNovaOverhealCoheficient then
    				if distance <= holynovaRadius*1.1 then
    					 playersInRange = playersInRange + 1
    				end
    			end
    			
    			 -- Get a dot
    			local dot = dots[i]
    		   
    			-- Get its color based on player Health percent
    			local color = getDeficitColor(pctHp)
    			dot:SetVertexColor(color.r,color.g,color.b,1)
    	 
    			-- Now we have to calculate where the point will be in the radar
    			-- To make things easier, let's get the distance between the player x,y and the current unit x,y
    			-- This is considering the player is in the center of the radar
    			-- Calculate Distances in yards
    			local dist_x = unitX - playerX
    			local dist_y = unitY - playerY
    	 
    			-- Normalize it to pixels
    			-- How much does 1 yard is in pixels for our radar size? RadarRadius/Measuring radius
    			-- Radius is doubled because we're considering the diameter here
    			local radarSize = tonumber(Radar:GetHeight())
    			local yardInPixel = (radarSize/(holynovaRadius*2))
    	 
    			-- Multiply it so we get the values in pixel
    			local radar_x = dist_x*yardInPixel
    			local radar_y = dist_y*yardInPixel
    		   
    			-- Since we considered the player is in the center, we set the anchor to the center of the radar
    			-- and place our offsets for x and y as calculated
    			-- Need to clear point always
    			dot:ClearAllPoints();
    			dot:SetPoint("CENTER", radar_x, radar_y)
    			
    			if distance <= holynovaRadius then
    				dot:Show()
    			else
    				dot:Hide()
    			end
    	 
    			-- If this is the last, then everything beyond should be hidden (see below)
    		end
    
    
    
    	end
    	
    	HolyNovaIcon.text:SetText(playersInRange)
        --HolyNovaIcon.text:SetText(string)
     
        local overlay = HolyNovaIcon.overlay
        if playersInRange > 4 then
            overlay:SetTexture(Colors.GOOD.r, Colors.GOOD.g, Colors.GOOD.b)
        else
            overlay:SetTexture(Colors.BAD.r, Colors.BAD.g, Colors.BAD.b)
        end
    end
    also remove
    Code:
    updateCurrentMap()
    from OnUpdate. Better use events
    Code:
    if event == "ZONE_CHANGED" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED_NEW_AREA" then
        updateCurrentMap()
      end
    Last edited by Aleaa; 2014-09-16 at 11:29 AM.

  9. #29
    Quote Originally Posted by moothz View Post
    Ps.: I have no idea how to make an options menu, btw, but I did separate everything in variables, we should be able to load/store values into them easily (like colors, sizes, positions). Ace3 provides great profiling for saving I heard.
    Found this which might help i guess:
    http://www.wowwiki.com/Creating_GUI_...ration_options

    Quote Originally Posted by ThrashMetalFtw View Post
    The pre-WotLK Mind Flay animation. 2nd biggest reason for rolling a Priest, biggest obviously being Shadowform. Anyone who uses Glyph of Shadow should reroll Hunter, filthy blasphemers.

  10. #30
    Thank you, Aleaa! Your tips are very welcome! I am just a Java/Web programmer that happens to know a bit of LUA. Nice tips on improving the code also
    Those global stuff and everything-on-one-method hurts on the inside, but it'll have to to :'(

    -- Edit
    Is there any problem in using my "getUnitMapPosition" method? So I don't have to multiply things in the argument of getDistance
    I don't like the idea of hiding all dots, also - there's no "blit" or "flip screen" on this, so if you hide all of them and then show some, they might flicker
    - UnitHP should be maxHp-currentHp (fixed)
    - Needs to consider ir party or raid, because of how the unit ids work for party (fixed)

    I'll post an updated code (with Aleaa tips and DBM map thing) as soon as I can

    Quote Originally Posted by Succath View Post
    Found this which might help i guess:
    http://www.wowwiki.com/Creating_GUI_...ration_options
    I'll Give it a try after the main code is "ready" ahahha
    Last edited by moothz; 2014-09-16 at 11:47 AM.

  11. #31
    Is there any problem in using my "getUnitMapPosition" method? So I don't have to multiply things in the argument of getDistance
    getUnitMapPosition request table. getDistance only values


    I don't like the idea of hiding all dots, also - there's no "blit" or "flip screen" on this, so if you hide all of them and then show some, they might flicker
    nope. They dont. But you may count player and use
    Code:
    local dot = dots[k]     for i=k, #dots do dots[k]:Hide() end

  12. #32
    Quote Originally Posted by moothz View Post
    I'll Give it a try after the main code is "ready" ahahha
    wish i could be a bit more helpful since i really like this idea and possibilities but since i`m a coding nub this will have to do :P

    Quote Originally Posted by ThrashMetalFtw View Post
    The pre-WotLK Mind Flay animation. 2nd biggest reason for rolling a Priest, biggest obviously being Shadowform. Anyone who uses Glyph of Shadow should reroll Hunter, filthy blasphemers.

  13. #33
    K, if they don't flicker

    I don't understand why it requests a table? You mean the return values or the fact that my function is stored in a table? My method seems to return values only

    Code:
    -- Map methods
    local function getUnitMapPosition(unit) 
        local relative_x, relative_y = GetPlayerMapPosition(unit) 
    
        -- Only call SetMatpToCurrentZone if something went wrong
        if relative_x == 0 and relative_y == 0 then
            SetMapToCurrentZone()
            relative_x, relative_y = GetPlayerMapPosition(unit)
        end
    
        return currentMap.width*relative_x, currentMap.height*relative_y 
    end
    Quote Originally Posted by Succath View Post
    wish i could be a bit more helpful since i really like this idea and possibilities but since i`m a coding nub this will have to do :P
    No problems, ahahah
    Just keep the tips and ideas coming, how you would like to use, what features you would like to see
    Last edited by moothz; 2014-09-16 at 12:46 PM.

  14. #34
    Quote Originally Posted by moothz View Post
    No problems, ahahah
    Just keep the tips and ideas coming, how you would like to use, what features you would like to see
    Well i`m not sure as to what the current functions are exactly, and i assume it should not be to difficult to potentially lose focus on what the add-on initially should be doing.
    However i do have BETA and PTR access so if there is some testing to be done i`m more than happy to do it.

    As for input
    * I believe a big green circle in the screen will obstruct the view on other things so i would suggest making the circle more transparent and adjustable in scale.
    I can imagine someone with a smaller screen would find this better.

    Quote Originally Posted by ThrashMetalFtw View Post
    The pre-WotLK Mind Flay animation. 2nd biggest reason for rolling a Priest, biggest obviously being Shadowform. Anyone who uses Glyph of Shadow should reroll Hunter, filthy blasphemers.

  15. #35
    Proving grounds doesn't le met use GetPlayerMapPosition so I can't test it there :'(

    Code seems fine, so far: http://pastebin.com/BAc9REeB (I'll be updating this link from now on, decided to make an account here)
    Performance is much better, also!
    Last edited by moothz; 2014-09-16 at 12:49 PM.

  16. #36
    Deleted
    I have done some work on the options GUI. see i.imgur.com/pFT8dMJ.jpg
    Its not done yet.
    Maybe we can agree on what should be customizable. My current options are
    Code:
    ---------------------
    ------ Options ------
    ---------------------
    
    HNROptions = {
    	ShowIcon = true,
    	ShowRadar = true,
    	Lock = false,
    	ClickThrough = false,
    	Icon = {
    		Scale = 1,
    		OffsetX = 1,
    		OffsetY = 1,
    		RefreshRate = 0.1 -- in seconds
    	},
    	Radar = {
    		Scale = 1,
    		OffsetX = 1,
    		OffsetY = 1
    	}	
    }
    is something missing?

  17. #37
    Yes! Let's see:
    Visual options:
    - Show Icon
    - Show Radar
    - Lock/Unlock Frames button
    - Radar Square Size (only one number, default it to 200)
    - Icon Square Size (only one number, default it to 64)
    - Show Radar/Icon offsets in numbers with + and - Signs next to them
    - Also show Anchor points dropdown menu for each (Here, there are 9 possibilities)
    - RGB Color pickers for: HP Percentage (4 colors)
    - RGBA Color Pickers for: Radar Background Color (the black square), Radar Circle Color (green default)
    - RGBA Color Pickers for: GOOD status overlay on icon (green default) and BAD Status overlay on icon (red default)
    - Option to toggle between showing units outside of radar circle or not (so you know if there is someone really close)

    Coheficients and other:
    - Refresh rate is a nice thing, making a slider for it would be great! Should go from 5ms to 500ms, maybe more, but gets really unusable
    - HolyNovaOverhealCoheficient Goes from 0 = Full overheal is allowed to 1 = No overheal is allowed. You can make a slider that goes from 0 to 100, seems more intuitive I think


    -- Edit
    Tested it on beta (so laggy , server lag, not addon ahahha):
    http://i.imgur.com/XENziHf.jpg
    Range seems off, probably because of map data...
    Last edited by moothz; 2014-09-16 at 03:05 PM.

  18. #38
    Also show Anchor points dropdown menu for each (Here, there are 9 possibilities)
    No needed. You use only parent:SetPoint("CENTER", anchor, "CENTER", opt_x, opt_y. Maybe x and y goes to option frame for specific coordinates
    Last edited by Aleaa; 2014-09-16 at 04:45 PM.

  19. #39
    Not needed, indeed, but I love having them on my addons and miss it on some

  20. #40
    I would look into AceGUI for creating options. Instead of doing all the small things to create one, the lib does it for you. All of the Ace3 framework is great stuff. It's libs so you don't have to do it in your addon. Saves a lot of coding.

Posting Permissions

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