• 0

    posted a message on Two frame Cooldown question
    I have two questions about the frame Cooldown:

    The first is: if I want monitor the duration of a temporary enchant weapon through APIs GetWeaponEnchantInfo() and cd:SetCooldown (start, duration), how can I retrieve the start and duration values?

    The second is: How can I avoid, once the cooldown finish, the Flash animation?

    Thank you in advance
    Posted in: Lua Code Discussion
  • 0

    posted a message on UIDropDownMenu width
    I would have a problem with textures: instead of the tick, I get a green square

    <Texture name="$parentCheck" file="Interface\Common\UI-DropDownRadioChecks">
    


    I took this piece of code from here, because I needed the texture of the tick
    Posted in: Lua Code Discussion
  • 0

    posted a message on Down arrow
    Oh great! I can also make this in a different background color?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Down arrow
    I would create a button with the image down arrow pointing, like the one in the chat frame: could you tell me how can I do? :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Pet/minion spell catch
    local function getPetOwner(petName)
       
       scanTool:ClearLines()
       scanTool:SetUnit(petName)
       local ownerText = scanText:GetText()
       if not ownerText then return nil end
       local owner, _ = string.split("'",ownerText)
       
       return owner -- This is the pet's owner
    
    end
    


    This function only work for pets in your party/raid: if I wanted to extend this function, for example, to the pet of the enemy players in battlegrounds how can I do? I know that Afflicted3 has managed to do something like this.

    Quote from Phanx
    (4) You should probably also implement some kind of cache so you don't keep doing the same expensive processing on the same GUIDs over and over.


    Regarding this, I would not know where to start
    Posted in: Lua Code Discussion
  • 0

    posted a message on API UnitIsFriend
    This function will determine whether two units are friendly to each other (i.e. able to help each other in combat). But when I request a duel with a member of my party/raid, the reaction should change, because the player becomes aggressive towards me. Instead, it still reports as a friendly unit.
    However, it works correctly if I request a duel with player in my faction that is not part of my party/raid.
    Is there a way to determine if a player is part of my party/raid?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Pet/minion spell catch
    local f = CreateFrame("frame")
    f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    
    
    local function getType(sourceGUID)
    	local guid = sourceGUID
    	local B = tonumber(guid:sub(5,5), 16);
    	local maskedB = B % 8; -- x % 8 has the same effect as x & 0x7 on numbers <= 0xf
    	local knownTypes = {[0]="player", [3]="NPC", [4]="pet", [5]="vehicle"};
    
    	return(knownTypes[maskedB])
    end
    
    local function getPetOwner(petName)
    	local scanTool = CreateFrame( "GameTooltip", "ScanTooltip", nil, "GameTooltipTemplate" )
    	scanTool:SetOwner( WorldFrame, "ANCHOR_NONE" )
    	local scanText = _G["ScanTooltipTextLeft2"] -- This is the line with <[Player]'s Pet>
    	scanTool:ClearLines()
    	scanTool:SetUnit(petName)
    	local ownerText = scanText:GetText()
    	if not ownerText then return nil end
    	local owner, _ = string.split("'",ownerText)
    
    	return owner -- This is the pet's owner
    end
    
    f:SetScript("OnEvent", function(self, event, ...)
    	if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
    		if (arg2 == "SPELL_CAST_SUCCESS") then
    			if (getType(arg3) == "pet") then
    				local unit = "target,focus,mouseover,arena1,arena2,arena3,arena4,arena5"
    				for token in string.gmatch(unit, "[^,]+") do
    					if (UnitName(token)) and (UnitName(token) == getPetOwner(arg4)) then
    						local sourceFlags = UnitName(getPetOwner(arg4))
    						if (UnitIsPlayer(sourceFlags)) and (not UnitIsFriend(sourceFlags, "player")) then
    							if (arg10 == "Spell Lock") then
    								print(sourceFlags.."\032" .. "has cast".."\032" .. arg10)
    							end
    						end
    					end
    				end
    			end
    		end
    	end
    end)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Pet/minion spell catch
    I'm targeting a player. If I would catch a spell from this pet using UNIT_SPELLCAST_SUCCEEDED what can I do? There is a flag to identfy the target's pet?
    Posted in: Lua Code Discussion
  • 0

    posted a message on StatusBar Timers... trouble again
    Once create the bar, how can I recall it in a second time? Something like local bar = _G["barcreatedbycandybar"]
    Posted in: Lua Code Discussion
  • 0

    posted a message on StatusBar Timers... trouble again
    Well, now work. Another question: how can I remove the flash animation when the bar is about to expire?
    Posted in: Lua Code Discussion
  • 0

    posted a message on StatusBar Timers... trouble again
    I found the library LibCandyBar and I found it very interesting. I'm trying to create an addon with a list of timer that trips move as soon as one of them expires (like DBM). The only problem is that I can not find a function to identify the timer (you can not assign a name to the statusbar) and to see if it is active or not, so I decided to fall back on the library LibBars-1.0. Searching on the web I found a sample code and I have tested it, but I BugSack returns this error:

    1x LibBars-1.0-90013 (NewTwo):329: You may only call :NewBarGroup as an embedded function

    The sample code is:

    local LB = LibStub("LibBars-1.0") -- LibBars
    local LSM = LibStub("LibSharedMedia-3.0") -- LibSharedMedia
    local barFont = "Arial Narrow" -- Font text uses
    local barFontSize = 12 -- Font Size
    local barHeight = 20 -- Height of the bars
    local barWidth = 150 -- Width of the bars
    local barTexture = "Blizzard" -- Texture the bars use
    local bars = nil
    
    -- Create the bars
    bars = LB:NewBarGroup("Bars", nil, barWidth, barHeight, "testBars")
    bars:SetFont(LSM:Fetch('font', barFont), barFontSize)
    bars:SetTexture(LSM:Fetch('statusbar', barTexture))
    bars:SetUserPlaced(true)
    
    -- Add a countdown bar from 10 to 0
    bars:NewTimerBar("Test", "test", 10, 10, "Interface\\Icons\\Spell_Holy_WordFortitude")
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Gtb-1.0
    I'm trying the library GTB-1.0 to create dynamic progress bar. I followed the instructions to the site http://www.wowwiki.com/GTB and this is my attempt:

    http://nopaste.info/28b3117c05.html

    BugSack return me this error:

    NewAddon-0.2\NewAddon.lua:24: You must call 'RegisterBar' from a registered GTB object.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Progress bar
    mybar:Show() is include in mybar:Start()
    Posted in: Lua Code Discussion
  • 0

    posted a message on Progress bar
    local candy = LibStub("LibCandyBar-3.0")
    local texture = "Interface\\AddOns\\MyAddOn\\statusbar"
    local mybar = candy:New(texture, 100, 16)
    mybar:SetLabel("Yay!")
    mybar:SetDuration(60)
    mybar:Start()
    mybar:AddUpdateFunction( function(bar) print(bar.remaining) end )
    


    I've correctly load the libraries, but doesn't appear nothing, only last line works :confused:
    Posted in: Lua Code Discussion
  • 0

    posted a message on Progress bar
    How do I create dbm-style progress bar? With the bar reaches empty following a timer? Is there any tutorial? If so, you could link it?

    thanks
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.