Mercurial > wow > turok
view Equip.lua @ 5:8a9a6637f082
focusbar data collection tracking
db info declarations to main chunk
author | Nenue |
---|---|
date | Tue, 15 Dec 2015 10:10:22 -0500 |
parents | 766d8a40a1d6 |
children |
line wrap: on
line source
-- User: Krakyn -- Created: 12/4/2015 11:20 PM -- Equipment, spec, etc. local T = LibStub("AceAddon-3.0"):GetAddon("Turok") local mod = T:NewModule("Equip", "AceEvent-3.0") --setprinthandler(function (...) T:debug('Equip', nil, ...) end) local t18_slots = { [INVSLOT_HEAD] = 124296, -- head [INVSLOT_SHOULDER] = 124307, -- shoulders [INVSLOT_CHEST] = 124284, -- chest [INVSLOT_LEGS] = 124301, -- legs [INVSLOT_HAND] = 124292, -- hands } local use_slots = { [INVSLOT_FINGER1] = 1, [INVSLOT_FINGER2] = 2, [INVSLOT_TRINKET1] = 3, [INVSLOT_TRINKET2] = 4, } function mod:OnEnable() self.equipped = {} self:RegisterEvent('COMBAT_RATING_UPDATE', 'UpdateCombatRatings') self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED', 'UpdateEquipment') self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED', 'UpdateSpec') end function mod:UpdateEquipment (_, slot, hasItem) -- ratings event will handle the rest if not t18_slots[slot] or use_slots[slot] then return end -- debug local link = GetInventoryItemID('player', slot) print('|cFF00FFFFequipment ', slot, hasItem, link) -- /debug if t18_slots[slot] then t18_count = 0 for slot, itemID in pairs(t18_slots) do if GetInventoryItemID(slot) == itemID then t18_count = t18_count + 1 end end if t18 >= 4 then T.stats.aimedshot = s.gcd else T.stats.aimedshot = 2 * T.stats.castingmod end T.statstext =string.format('%.2f', s.aimedshot) end if use_slots[slot] then if hasItem then local itemID = GetInventoryItemID('player', slot) self.equipped[slot] = itemID T:GetModule("Spirit").item_watch[itemID] = {GetInventoryItemCooldown('player', slot) } else if self.equipped[slot] then self.equipped[slot] = nil end end end end function mod:UpdateCombatRatings() local s = T.stats s.haste = UnitSpellHaste('player') s.focusregen = 4 * (1 + s.haste/100) s.castingmod = 1+ s.haste/1000 s.gcd = 1.5 * s.castingmod T.statstext = { haste = string.format('%.2f', s.haste), focusregen = string.format('%.2f', s.focusregen), castingmod = string.format('%.2f', s.castingmod), } local t = T.statstext print('|cFF00FFFFCOMBAT_RATING_UPDATE:|r', 'haste:', t.haste, 'regen:', t.focusregen) end function mod:UpdateSpec (e, unit) if unit ~= 'player' then return end T.stats.focusmax = UnitPowerMax('player') end