WeakAuras

Weapon Equip Trigger

  • 2 posts
    #1 Mar 09, 2011 at 08:58 UTC - 0 likes

    Trying to figure out how to track current equipment sets either when they are equipped event or just a status that that's the current set, but I'm not sure that method to do this. The underlying reason is two identical weapons with different permanent enchants (dk tank in our guild switches weapons based on inc damage being magic or physical), so if there's another criteria to track this, that's cool too. I'm thinking a custom trigger for when in game /equipset parry or /equipset magic for example is used, but I don't know the way those display to addons in order to put into the .lua coding since I don't see equipset as an example and I'm not that experienced in addon coding.

    One option would be GetParryChance() based on his 4% parry from the avoidance weapon, but I'm not sure exactly how to use this other than I think it could give an output that if above a certain value I know it's that weapon (which then changes as new gear is acquired) or perhaps looking at stats/item since reforging would differ.

    Any ideas on how to do this or maybe another method of tracking it?

    Last edited Mar 09, 2011 by Neptuna1
    #2 Mar 09, 2011 at 11:26 UTC - 0 likes

    After looking at Broker_BlizzEquipmentSet, the event you'd have to track are PLAYER_ENTERING_WORLD and either
    UNIT_INVENTORY_CHANGED if you want to watch equipped-set status even if equipping items manually
    EQUIPMENT_SWAP_FINISHED if you just want to watch equipped-set status only when using equipment manager
    The best bet is really to go with the first event.

    Than the trigger-code would look something like:
    (Note this is modfied from Broker_...)

    function (...)
     if select(1, ...) == "PLAYER_ENTERING_WORLD" or select(1, ...) == "UNIT_INVENTORY_CHANGED" and select(2, ...) == "player" then
      local maxCoveredSlotNumber = -1
      for setIndex = 1, GetNumEquipmentSets() do
       local setName, setIcon = GetEquipmentSetInfo(setIndex)
    
       local locations = GetEquipmentSetLocations(setName)
       local matches = true
       local equippedLocations = 0
    			
       for i, location in pairs(locations)	do
        local wearing, bank, bags, slot, bag = EquipmentManager_UnpackLocation(location)
        local itemLink
        if not bags then
         itemLink = GetInventoryItemLink( "player", slot )  --being worn
        else
         itemLink = GetContainerItemLink( bag, slot )  -- bags or bank
        end
    				
        if bags and itemLink ~= nil then
         matches = false
        end
        if itemLink ~= nil then
         equippedLocations = equippedLocations + 1
        end
       end
    
       if matches and equippedLocations > maxCoveredSlotNumber then
        return true
        break
       end
      end
     end
    
     return false
    end
    

    For untrigger-code, invert return statements. ;)

    Last edited Mar 09, 2011 by CommanderSirow
  • 2 posts

You must login to post a comment. Don't have an account? Register to get one!