comparison KBF.lua @ 26:547b70e235fe

cleanup
author Chris Mellon <arkanes@gmail.com>
date Tue, 16 Nov 2010 07:09:20 -0600
parents 69f46450ef82
children 9967caf18b2a
comparison
equal deleted inserted replaced
25:69f46450ef82 26:547b70e235fe
181 local slot = slotOverride or parentFrame:GetAttribute("target-slot") 181 local slot = slotOverride or parentFrame:GetAttribute("target-slot")
182 local itemIndex = slot - 15 -- 1MH, 2OF 182 local itemIndex = slot - 15 -- 1MH, 2OF
183 local RETURNS_PER_ITEM = 3 183 local RETURNS_PER_ITEM = 3
184 local hasEnchant, remaining, enchantCharges = select(RETURNS_PER_ITEM * (itemIndex - 1) + 1, GetWeaponEnchantInfo()) 184 local hasEnchant, remaining, enchantCharges = select(RETURNS_PER_ITEM * (itemIndex - 1) + 1, GetWeaponEnchantInfo())
185 -- remaining time is in milliseconds 185 -- remaining time is in milliseconds
186 if not hasEnchant then return end 186 if not hasEnchant then return end -- this should never happen
187 local remaining = remaining / 1000 187 local remaining = remaining / 1000
188 if not hasEnchant then return end -- this should never happen
189 local icon = GetInventoryItemTexture("player", slot) 188 local icon = GetInventoryItemTexture("player", slot)
190 -- this is terrible, but I hate myself and everyone else. 189 -- this is terrible, but I hate myself and everyone else.
191 -- We're going to assume that the duration of the temp enchant 190 -- We're going to assume that the duration of the temp enchant
192 -- is either 60 minutes, or however long is left, because poisons are 1 hour 191 -- is either 60 minutes, or however long is left, because poisons are 1 hour
193 local duration = max((60 * 60), remaining) 192 local duration = max((60 * 60), remaining)
253 return timetext 252 return timetext
254 end 253 end
255 254
256 function KBF:OnEnter(button, motion) 255 function KBF:OnEnter(button, motion)
257 -- this is for the secure buttons, so use the attributes 256 -- this is for the secure buttons, so use the attributes
258 local unit = SecureButton_GetModifiedUnit(button) or button.unit-- will perform vehicle toggle 257 local unit = SecureButton_GetModifiedUnit(button) or button.unit -- will perform vehicle toggle
259 local filter = button:GetAttribute("filter") or button.filter 258 local filter = button:GetAttribute("filter") or button.filter
260 local index = button:GetAttribute("index") or button.index 259 local index = button:GetAttribute("index") or button.index
261 if unit and filter and index then 260 if unit and filter and index then
262 -- I'd like a better place to position this but it's funky for right now, handle it later 261 -- I'd like a better place to position this but it's funky for right now, handle it later
263 GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT"); 262 GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT");