1. #1

    Track hidden aura?

    I'm trying to figure out how to track if 4pc bonus is active or not using Tell Me When. I've tried playing around with the aura settings and the item setting, I just can't get it to work. Here is the spell I'm trying to track:
    http://www.wowhead.com/spell=211045/...frost-4p-bonus
    I'm trying to make a full rotation for frost dk's but the rotation changes slightly based on whether you have 4pc or not. Any help would be great

  2. #2
    i'm pretty sure you can't track it directly

    I used to track set pieces for this. It's not TMW tho... Here's the code:


    Code:
    local ItemSetsRegistered = {}
    
    local function TrackItemSet(tiername, itemArray)
        ItemSetsRegistered[tiername] = ItemSetsRegistered[tiername] or {}
        if not ItemSetsRegistered[tiername].items then
            ItemSetsRegistered[tiername].items = {}
            ItemSetsRegistered[tiername].callbacks = {}
            local bitems = ItemSetsRegistered[tiername].items
            for _, itemID in ipairs(itemArray) do
                bitems[itemID] = true
            end
        end
    end
    
    local function RegisterSetBonusCallback(tiername, pieces, handle_on, handle_off)
        local tier = ItemSetsRegistered[tiername]
        if not tier then error(string.format("Itemset '%s' is not registered", tiername)) end
        tier.callbacks[pieces] = {}
        tier.callbacks[pieces].equipped = false
        tier.callbacks[pieces].on = handle_on
        tier.callbacks[pieces].off = handle_off
    end
    
    
    local function IsSetBonusActive(tiername, bonuscount)
            local tier = ItemSetsRegistered[tiername]
            local tier_items = tier.items
            local pieces_equipped = 0
            for _, slot in ipairs(tierSlots) do
                local itemID = GetInventoryItemID("player", slot)
                if tier_items[itemID] then pieces_equipped = pieces_equipped + 1 end
            end
            return (pieces_equipped >= bonuscount)
    end
    
    local tierSlots = {
        (GetInventorySlotInfo("ChestSlot")),
        (GetInventorySlotInfo("HeadSlot")),
        (GetInventorySlotInfo("ShoulderSlot")),
        (GetInventorySlotInfo("LegsSlot")),
        (GetInventorySlotInfo("HandsSlot")),
    }
    
    local setwatcher = CreateFrame("Frame", nil, UIParent)
    setwatcher:SetScript("OnEvent", function(self, event, ...)
        return self[event](self, event, ...)
    end)
    
    setwatcher:RegisterEvent("PLAYER_LOGIN")
    
    function setwatcher:PLAYER_LOGIN()
        if next(ItemSetsRegistered) then
            self:RegisterUnitEvent("UNIT_INVENTORY_CHANGED", "player")
            self:UNIT_INVENTORY_CHANGED(nil, "player")
        end
    end
    
    
    function setwatcher:UNIT_INVENTORY_CHANGED(event, unit)
        for tiername, tier in pairs(ItemSetsRegistered) do
            local tier_items = tier.items
            local pieces_equipped = 0
            for _, slot in ipairs(tierSlots) do
                local itemID = GetInventoryItemID("player", slot)
                if tier_items[itemID] then pieces_equipped = pieces_equipped + 1 end
            end
    
            for bp, bonus in pairs(tier.callbacks) do
                if pieces_equipped >= bp then
                    if not bonus.equipped then
                        if bonus.on then bonus.on() end
                        bonus.equipped = true
                    end
                else
                    if bonus.equipped then
                        if bonus.off then bonus.off() end
                        bonus.equipped = false
                    end
                end
            end
        end
    end
    Usage example:
    Code:
    TrackItemSet("Shadow_T15", {
        96674, 96675, 96676, 96677, 96678, --heroic
        95300, 95301, 95302, 95303, 95304, --normal
        95930, 95931, 95932, 95933, 95934, --lfr
    })
    RegisterSetBonusCallback("Shadow_T15", 2,
        function()
            -- setbonus on
        end,
        function()
            -- setbonus off
        end
    )
    Last edited by d87; 2017-03-15 at 05:00 AM.

  3. #3
    This looks damn near exactly what I'm looking for, thanks a bunch

Posting Permissions

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