Quantcast
Noob question on DK rune changes - WoWInterface
Thread Tools Display Modes
07-31-16, 11:10 PM   #1
Xaerran
A Murloc Raider
Join Date: Jul 2016
Posts: 5
Question Noob question on DK rune changes

I have an addon I am trying to update that would pull the rune count, by type and make spell suggestions based on what it found. I am trying to update this, to simply return the count for all of the runes (as the rune system changed). Would anyone mind helping me here? I took a crack at it, but it doesn't seem to be working Thanks for helping - I am fairly new to this.

New (not working):
Code:
local runes_c = {
    [1] = 0,
    [2] = 0,
    [3] = 0,
    [4] = 0,
    [5] = 0,
    [6] = 0
}

Goof.condition.register("runes.count", function(target, rune)
    local rune = string.lower(rune)
    runes_c[1], runes_c[2], runes_c[3], runes_c[4], runes_c[5], runes_c[6] = 0,0,0,0,0,0
    for i=1, 6 do
        local _, _, c = GetRuneCooldown(i)
        if c then
           runes_c[i] = runes_c[i] + 1
        end
    end
    return runes_c[1] + runes_c[2] + runes_c[3] + runes_c[4] + runes_c[5] + runes_c[6]
end)
Original:
Code:
local runes_t = {
    [1] = 0,
    [2] = 0,
    [3] = 0,
    [4] = 0
}
local runes_c = {
    [1] = 0,
    [2] = 0,
    [3] = 0,
    [4] = 0
}

Goof.condition.register("runes.count", function(target, rune)
    local rune = string.lower(rune)
    runes_t[1], runes_t[2], runes_t[3], runes_t[4], runes_c[1], runes_c[2], runes_c[3], runes_c[4] = 0,0,0,0,0,0,0,0
    for i=1, 6 do
        local _, _, c = GetRuneCooldown(i)
        local t = GetRuneType(i)
        runes_t[t] = runes_t[t] + 1
        if c then
            runes_c[t] = runes_c[t] + 1
        end
    end
    if rune == 'frost' then
        return runes_c[3] + runes_c[4]
    elseif rune == 'blood' then
        return runes_c[1] + runes_c[4]
    elseif rune == 'unholy' then
        return runes_c[2] + runes_c[4]
    elseif rune == 'death' then
        return runes_c[4]
    end
    return 0
end)
  Reply With Quote
07-31-16, 11:25 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,259
For the total active runes you should be able to:

Lua Code:
  1. local runeCount = 0
  2. for i=1, 6 do
  3.     local _, _, runeReady = GetRuneCooldown(i)
  4.     if runeReady then
  5.         runeCount = runeCount+1
  6.     end
  7. end
  8. return runeCount
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-01-16 at 12:10 AM.
  Reply With Quote
07-31-16, 11:55 PM   #3
Xaerran
A Murloc Raider
Join Date: Jul 2016
Posts: 5
Thanks so much! I had just found the GetRuneCount function but was missing the definition on runeReady.

there is a minor camel case capitalization error in your snippet, but this was perfect!

Thanks again
  Reply With Quote
08-01-16, 12:11 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,259
Originally Posted by Xaerran View Post
there is a minor camel case capitalization error in your snippet, but this was perfect!

Thanks again
Fixed in the original .
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Noob question on DK rune changes

Thread Tools
Display Modes

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

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