annotate Modules/ArtifactPower.lua @ 110:73316951ce73

- Fix extra value text updates
author Nick@Zahhak
date Mon, 06 Mar 2017 02:31:15 -0500
parents a41f6b74709a
children 1196c2bad31c
rev   line source
Nenue@97 1 -- Veneer
Nenue@97 2 -- ArtifactPower.lua
Nenue@97 3 -- Created: 1/15/2017 11:44 PM
Nenue@97 4 -- %file-revision%
Nenue@97 5 --
Nenue@97 6
Nenue@97 7 local print = DEVIAN_WORKSPACE and function(...) print('VnAP', ...) end or nop
Nenue@97 8 VeneerArtifactPowerMixin = {
Nenue@99 9 numItems = 0,
Nenue@99 10 Tokens = {},
Nenue@101 11 cache = {},
Nenue@101 12 fishingCache = {},
Nenue@101 13 scanQueue = {},
Nenue@99 14 ItemButtons = {},
Nenue@97 15 anchorPoint = 'TOP',
Nenue@97 16 anchorFrom = 'TOP',
Nenue@97 17 }
Nenue@101 18 local defaultSettings = {
Nenue@101 19 firstUse = true,
Nenue@101 20 autoHide = true,
Nenue@101 21 }
Nenue@97 22 local ap = VeneerArtifactPowerMixin
Nenue@97 23 local BAGS_TO_SCAN = {BACKPACK_CONTAINER }
Nenue@97 24 local TOOLTIP_NAME = 'VeneerAPScanner'
Nenue@98 25 local POINT_COSTS = {
Nenue@98 26 100, 300, 325, 350, 375,
Nenue@98 27 400, 425, 450, 525, 625,
Nenue@98 28 750, 875, 1000, 6840, 8830,
Nenue@98 29 11280, 14400, 18620, 24000, 30600,
Nenue@98 30 39520, 50880, 64800, 82500, 105280,
Nenue@98 31 138650, 182780, 240870, 325520, 417560,
Nenue@98 32 546000, 718200, 946660, 1245840, 1635200,
Nenue@98 33 191500, 2010000, 2110000, 2215000, 2325000,
Nenue@98 34 2440000, 2560000, 2690000, 2825000, 2965000,
Nenue@98 35 3115000, 3270000, 3435000, 3605000, 3785000,
Nenue@98 36 3975000, 4175000, 4385000, 4605000
Nenue@98 37 }
Nenue@97 38
Nenue@99 39 local FRAME_LIST = {'ContainerFrame1', 'BankFrame'}
Nenue@99 40 local BAG_FRAMES = {'ContainerFrame1'}
Nenue@99 41 local BANK_FRAMES = {'BankFrame'}
Nenue@99 42
Nenue@97 43 function ap:OnLoad()
Nenue@97 44 self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan
Nenue@97 45 self:RegisterEvent('BAG_UPDATE_DELAYED') -- use to trigger actual scan activity
Nenue@97 46 self:RegisterEvent('BANKFRAME_OPENED') -- determine when bank info is available
Nenue@97 47 self:RegisterEvent('BANKFRAME_CLOSED') -- " " "
Nenue@97 48 self:RegisterEvent('ARTIFACT_UPDATE') -- when artifact data has changed
Nenue@98 49 self:RegisterEvent('ARTIFACT_XP_UPDATE') -- when artifact xp has changed (but not necessarily data)
Nenue@97 50 self:RegisterEvent('PLAYER_REGEN_ENABLED')
Nenue@97 51 self:RegisterEvent('PLAYER_REGEN_DISABLED')
Nenue@99 52 self:RegisterEvent('PLAYER_ENTERING_WORLD')
Nick@108 53 self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data
Nick@108 54 Veneer:AddHandler(self, self.anchorPoint, 2)
Nenue@97 55 SLASH_VENEER_AP1 = "/vap"
Nenue@97 56 SLASH_VENEER_AP2 = "/veneerap"
Nenue@98 57 SlashCmdList.VENEER_AP = function(arg)
Nenue@98 58 if arg == 'fishing' then
Nenue@98 59 if VeneerData.ArtifactPower.EnableFishing then
Nenue@98 60 VeneerData.ArtifactPower.EnableFishing = nil
Nenue@98 61 else
Nenue@98 62 VeneerData.ArtifactPower.EnableFishing = true
Nenue@98 63 end
Nenue@98 64 self:Print('Show Underlight Angler:', (VeneerData.ArtifactPower.EnableFishing and 'ON' or 'OFF'))
Nenue@98 65 self:Update()
Nick@108 66 elseif arg == 'reset' then
Nick@108 67 if self.db then
Nick@108 68 table.wipe(self.db.cache)
Nick@108 69 table.wipe(self.db.fishingCache)
Nick@108 70 end
Nick@108 71 self:Print('Cache data reset.')
Nick@108 72 self:Update()
Nenue@98 73 else
Nenue@98 74 self:Show()
Nenue@98 75 end
Nenue@97 76 end
Nenue@97 77
Nenue@97 78 self.tooltip = CreateFrame('GameTooltip', TOOLTIP_NAME, self, 'GameTooltipTemplate')
Nenue@99 79 tinsert(UISpecialFrames, self:GetName())
Nenue@99 80
Nenue@97 81
Nenue@97 82 end
Nick@108 83 local ShortNumberString = function (value)
Nick@108 84 if value >= 100000 then
Nick@108 85 return tostring(floor(value/1000)) .. 'k'
Nick@108 86 elseif value >= 1000 then
Nick@108 87 return tostring(floor(value/100)/10) .. 'k'
Nick@108 88 else
Nick@108 89 return value
Nick@108 90 end
Nick@108 91 end
Nenue@97 92
Nenue@102 93
Nenue@102 94 local IsBagnonOpen = function()
Nenue@102 95 return ((BagnonFramebank and BagnonFramebank:IsShown()) or (BagnonFrameinventory and BagnonFrameinventory:IsShown()))
Nenue@102 96 end
Nenue@99 97 local addonCompatibility = {
Nenue@99 98 ['Bagnon'] = {
Nenue@99 99 BagFrames = {'BagnonFrameinventory'},
Nenue@99 100 BankFrames = {'BagnonFramebank'},
Nenue@102 101 FrameMethods = {
Nenue@103 102 ['Hide'] = IsBagnonOpen,
Nenue@103 103 ['Show'] = IsBagnonOpen
Nenue@102 104 },
Nenue@103 105 PostHooks = {},
Nenue@99 106 MethodClass = 'Bagnon',
Nenue@102 107 MethodHooks = {'BANK_OPENED', 'BANKFRAME_CLOSED'},
Nenue@102 108
Nenue@99 109 }
Nenue@97 110 }
Nenue@97 111
Nenue@103 112
Nenue@103 113
Nenue@103 114 local queued_hooks = {}
Nenue@103 115 local function CreateHook(...)
Nenue@103 116 if select('#', ...) >= 2 then
Nenue@103 117 tinsert(queued_hooks, {...})
Nenue@103 118 end
Nenue@103 119 if not InCombatLockdown() then
Nenue@103 120 local info = tremove(queued_hooks)
Nenue@103 121 while info do
Nenue@103 122 print('hooking', unpack(info))
Nenue@103 123 hooksecurefunc(unpack(info))
Nenue@103 124 info = tremove(queued_hooks)
Nenue@103 125 end
Nenue@103 126
Nenue@103 127 end
Nenue@103 128 end
Nenue@103 129
Nenue@102 130 local function AddFrameHooks(frame, args)
Nenue@102 131 for funcName, func in pairs(args.FrameMethods) do
Nenue@102 132 print('binding', frame:GetName(), funcName, 'to', tostring(func))
Nenue@103 133 CreateHook(frame, funcName, function()
Nenue@103 134 VeneerArtifactPower:TryToShow()
Nenue@103 135 end)
Nenue@102 136 end
Nenue@102 137 end
Nenue@102 138 local PENDING_HOOKS = {}
Nenue@102 139
Nenue@102 140 local function RegisterInventoryFrame(name, listType, args)
Nenue@102 141 print('register', name, 'as inventory frame type =', (listType == BAG_FRAMES) and 'bags' or 'bank')
Nenue@102 142 tinsert(FRAME_LIST, name)
Nenue@102 143 tinsert(listType, name)
Nenue@102 144 if _G[name] then
Nenue@102 145 AddFrameHooks(_G[name], args)
Nenue@102 146 else
Nenue@102 147 PENDING_HOOKS[name] = args
Nenue@102 148 end
Nenue@102 149 end
Nenue@102 150
Nenue@97 151 function ap:Setup()
Nenue@97 152 print(self:GetName()..':Setup()')
Nenue@97 153 local guid = UnitGUID('player')
Nenue@97 154 VeneerData.ArtifactPower = VeneerData.ArtifactPower or defaultSettings
Nenue@101 155 self.db = VeneerData.ArtifactPower
Nenue@101 156 self.db[guid] = self.db[guid] or {}
Nenue@101 157 self.db.cache = self.db.cache or {}
Nenue@101 158 self.db.fishingCache = self.db.fishingCache or {}
Nenue@101 159
Nenue@101 160 for i, data in pairs(self.cache) do
Nenue@101 161 -- bring in anything found before player data is active
Nenue@101 162 self.db.cache[i] = data
Nenue@101 163 end
Nenue@101 164 for i, data in pairs(self.fishingCache) do
Nenue@101 165 self.db.fishingCache[i] = data
Nenue@101 166 end
Nenue@101 167
Nenue@101 168
Nenue@101 169 self.profile = self.db[guid]
Nick@108 170 self.profile.cache = self.profile.cache or {}
Nick@108 171 self.profile.cache.bagItems = self.profile.cache.bagItems or {}
Nick@108 172 self.profile.cache.bags = self.profile.cache.bags or {}
Nick@108 173 self.profile.cache.fishing = self.profile.cache.fishing or {}
Nick@108 174 self.profile.cache.items = self.profile.cache.items or {}
Nenue@97 175 self.profile.bagslots = self.profile.bagslots or {}
Nenue@97 176 self.profile.artifacts = self.profile.artifacts or {}
Nenue@97 177 self.updateSummary = true
Nick@108 178 self.cache = self.profile.cache
Nenue@97 179
Nenue@101 180 VeneerArtifactPowerTimer:SetScript('OnUpdate', function()
Nenue@101 181 self:OnUpdate()
Nenue@101 182 end)
Nenue@101 183
Nenue@99 184 local DoTryToShow = function()
Nenue@99 185 self:TryToShow()
Nenue@99 186 end
Nenue@103 187 CreateHook("OpenBackpack", DoTryToShow)
Nenue@103 188 CreateHook("CloseBackpack", DoTryToShow)
Nenue@99 189
Nenue@97 190 -- Bagnon compatibility
Nenue@97 191 -- todo: ArkInventory, Elv, etc
Nenue@99 192 for addon, args in pairs(addonCompatibility) do
Nenue@99 193 if IsAddOnLoaded(addon) then
Nenue@102 194
Nenue@99 195 for _, name in ipairs(args.BagFrames) do
Nenue@102 196 RegisterInventoryFrame(name, BAG_FRAMES, args)
Nenue@99 197 end
Nenue@99 198 for _, name in ipairs(args.BankFrames) do
Nenue@102 199 RegisterInventoryFrame(name, BANK_FRAMES, args)
Nenue@99 200 end
Nenue@102 201
Nenue@102 202 -- should only specify non-secure functions in this table
Nenue@99 203 for _, name in ipairs(args.PostHooks) do
Nenue@99 204 local oFunc = _G[name]
Nenue@103 205 print('hook entry', name, tostring(oFunc))
Nenue@103 206 CreateHook(name, function(...)
Nenue@103 207 print('|cFFFF0088' .. name .. '|r', ..., 'original', tostring(oFunc))
Nenue@99 208 oFunc(...)
Nenue@99 209 self:TryToShow()
Nenue@103 210 end)
Nenue@99 211 end
Nenue@99 212 local frame = _G[args.MethodClass]
Nenue@99 213 if frame then
Nenue@103 214 print()
Nenue@99 215 for _, name in ipairs(args.MethodHooks) do
Nenue@103 216 CreateHook(frame, name, DoTryToShow)
Nenue@99 217 end
Nenue@97 218 end
Nenue@97 219 end
Nenue@97 220 end
Nenue@101 221
Nenue@101 222 if self.db.firstUse then
Nenue@101 223 self.db.firstUse = nil
Nenue@101 224
Nenue@101 225 end
Nenue@99 226 end
Nenue@97 227
Nenue@97 228 local UNDERLIGHT_ANGLER_ID = 133755
Nenue@97 229
Nenue@97 230 function ap:QueueBag(containerID)
Nenue@97 231 containerID = tonumber(containerID)
Nenue@97 232 if not containerID then
Nenue@97 233 return
Nenue@97 234 end
Nenue@97 235
Nenue@97 236 if not tContains(BAGS_TO_SCAN, containerID) then
Nenue@97 237 print(' queueing', containerID, type(containerID), #BAGS_TO_SCAN , 'in line')
Nenue@97 238 BAGS_TO_SCAN[#BAGS_TO_SCAN + 1] = containerID
Nenue@97 239 end
Nenue@97 240 end
Nenue@97 241
Nenue@99 242 function ap:Reanchor()
Nenue@99 243 if Veneer then
Nenue@99 244 Veneer:DynamicReanchor()
Nenue@99 245 end
Nenue@99 246 end
Nenue@99 247
Nenue@97 248 function ap:OnShow()
Nenue@99 249 print('|cFFFFFF00OnShow()|r')
Nenue@102 250
Nenue@102 251 for name, args in pairs(PENDING_HOOKS) do
Nenue@102 252 if _G[name] then
Nenue@102 253 AddFrameHooks(_G[name], args)
Nenue@102 254 PENDING_HOOKS[name] = nil
Nenue@102 255 end
Nenue@102 256 end
Nenue@102 257
Nenue@102 258
Nenue@97 259 self.enabled = true
Nenue@99 260 self:ScanAllBags()
Nenue@99 261 self:Reanchor()
Nenue@97 262 end
Nenue@97 263 function ap:OnHide()
Nenue@99 264 print('|cFF88FF00OnHide()|r')
Nenue@99 265 self:Reanchor()
Nenue@97 266 end
Nenue@97 267 function ap:OnEnter()
Nenue@97 268
Nenue@97 269 GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
Nenue@97 270
Nenue@99 271
Nenue@97 272 GameTooltip:AddLine(self.bagAP)
Nenue@97 273 GameTooltip:AddLine(self.bankAP)
Nenue@97 274
Nenue@97 275 end
Nenue@97 276
Nenue@99 277 function ap:TryToShow()
Nenue@99 278
Nenue@99 279 print('|cFFFFFF00TryToShow()')
Nenue@99 280
Nenue@99 281 if not InCombatLockdown() then
Nenue@99 282 for _, name in ipairs(FRAME_LIST) do
Nenue@103 283 print('test:', name, (_G[name] and _G[name]:IsShown()))
Nenue@99 284 if _G[name] and _G[name]:IsShown() then
Nenue@99 285 if self:IsShown() then
Nenue@99 286 self:Update()
Nenue@99 287 else
Nenue@99 288 self:Show()
Nenue@99 289 end
Nenue@99 290 return
Nenue@99 291 end
Nenue@99 292 end
Nenue@99 293 end
Nenue@99 294
Nenue@99 295
Nenue@99 296 self:Hide()
Nenue@99 297 end
Nenue@99 298
Nenue@99 299
Nenue@97 300 function ap:OnEvent(event, ...)
Nenue@99 301 print('|cFF00FF88OnEvent()', event, ...)
Nenue@99 302 if event == 'PLAYER_ENTERING_WORLD' then
Nenue@99 303 self:TryToShow()
Nenue@99 304 elseif event == 'BAG_UPDATE' then
Nenue@97 305 local containerID = ...
Nick@108 306
Nick@108 307
Nenue@97 308 self:QueueBag(containerID)
Nick@108 309 elseif event == 'ITEM_LOCK_CHANGED' then
Nick@108 310
Nick@108 311 local containerID, slotID = ...
Nick@108 312
Nick@108 313 if self.cache.bags[containerID] and self.cache.bags[containerID][slotID] then
Nick@108 314 self.cache.bags[containerID][slotID] = nil
Nick@108 315 self.cache.fishing[containerID][slotID] = nil
Nick@108 316 end
Nick@108 317
Nick@108 318
Nenue@97 319 elseif event == 'PLAYER_BANKSLOTS_CHANGED' then
Nenue@99 320 self:ScanAllBags()
Nenue@97 321 elseif event == 'BAG_UPDATE_DELAYED' then
Nenue@99 322 if not self.firstHit then
Nenue@99 323 self.firstHit = true
Nenue@99 324 else
Nenue@99 325 self:ScanAllBags()
Nenue@99 326 end
Nenue@97 327 elseif event == 'BANKFRAME_OPENED' then
Nenue@97 328 self.bankAccess = true
Nenue@99 329 self:ScanAllBags()
Nenue@97 330 elseif event == 'BANKFRAME_CLOSED' then
Nenue@99 331 self.bankAccess = nil
Nenue@97 332 elseif event == 'ARTIFACT_UPDATE' then
Nenue@98 333 local newItem = ...
Nenue@98 334 if newItem then
Nenue@98 335 local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetArtifactInfo()
Nenue@98 336 self:SetArtifact(itemID, name, texture, currentXP, pointsSpent)
Nenue@98 337 self:ScanAllBags(self.bankAccess)
Nenue@98 338 end
Nenue@98 339 elseif event == 'ARTIFACT_XP_UPDATE' then
Nenue@98 340 local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetEquippedArtifactInfo()
Nenue@98 341 self:SetArtifact(itemID, name, texture, currentXP, pointsSpent)
Nenue@98 342 self:ScanAllBags(self.bankAccess)
Nenue@97 343 elseif event == 'PLAYER_REGEN_ENABLED' then
Nenue@103 344
Nenue@103 345 if self.queuedScan then
Nenue@103 346 self:ScanAllBags(self.backAccess)
Nenue@103 347 else
Nenue@103 348 self:TryToShow()
Nenue@97 349 end
Nenue@97 350
Nenue@103 351 if #queued_hooks >= 1 then
Nenue@103 352 CreateHook()
Nenue@103 353 end
Nenue@97 354 elseif event == 'PLAYER_REGEN_DISABLED' then
Nenue@97 355 self:Hide()
Nenue@97 356 end
Nenue@97 357 end
Nenue@97 358
Nenue@101 359 function ap:OnUpdate()
Nenue@101 360 if #self.scanQueue >= 1 then
Nenue@101 361 local scanInfo = tremove(self.scanQueue, 1)
Nenue@101 362
Nenue@101 363 end
Nenue@101 364 end
Nenue@101 365
Nenue@97 366 function ap:OnMouseDown()
Nenue@97 367 self.enabled = nil
Nenue@97 368 self:Hide()
Nenue@97 369 end
Nenue@97 370
Nenue@97 371 function ap:Update()
Nenue@97 372 if not self:IsShown() then
Nenue@99 373 print('|cFFFF4400Update()|r')
Nenue@97 374 return
Nenue@97 375 end
Nenue@97 376 print('|cFF00FFFFUpdate()|r')
Nenue@97 377
Nenue@97 378 local bankText, bagText
Nenue@101 379 if not self.profile.knowledgeMultiplier then
Nenue@101 380 bankText = '|cFF00FF00Shift-Right-Click an artifact weapon to start building data.'
Nenue@101 381 elseif not (self.bankAP and self.bagAP) then
Nenue@97 382 bankText = '|cFFFF0000Open bank frame to count all AP|r '
Nenue@97 383 else
Nenue@98 384 if (self.bagAP + self.bankAP) == 0 then
Nenue@99 385 bankText = '|cFFFF4400No Artifact Power tokens on hand|r'
Nenue@98 386 else
Nenue@98 387 if self.bagAP and (self.bagAP > 0) then
Nenue@98 388 bankText = '|cFFFFFFFF' .. tostring(self.bagAP) .. '|r'
Nenue@98 389 end
Nenue@98 390 if self.bankAP and (self.bankAP > 0) then
Nenue@98 391 bankText = (bankText and (bankText .. ' | ') or '') .. '|cFFFFFF00'..tostring(self.bankAP)..'|r'
Nenue@98 392 end
Nenue@98 393 end
Nenue@97 394 end
Nick@108 395 if self.fishingAP and self.fishingAP > 0 then
Nenue@99 396 bankText = (bankText and (bankText .. ' ') or '') .. '|cFF0088FF' .. tostring(self.fishingAP) .. ' fishing AP|r'
Nenue@99 397 end
Nenue@99 398
Nenue@97 399 self.SummaryHeader:SetText(bankText)
Nenue@97 400
Nenue@101 401 local numButtons = 0
Nick@108 402 local contentsHeight = 16 + self.SummaryHeader:GetHeight() + 64
Nick@108 403 local contentsWidth = 64
Nenue@101 404 if self.profile.knowledgeMultiplier then
Nenue@101 405 numButtons = self:UpdateArtifactButtons()
Nick@108 406
Nick@108 407 contentsWidth = 64*numButtons + 4 * (numButtons+1)
Nick@108 408
Nick@108 409 local itemsWidth, itemsHeight = self:UpdateItemButtons()
Nick@108 410 contentsHeight = contentsHeight + itemsHeight
Nick@108 411 contentsWidth = max(contentsWidth, itemsWidth)
Nenue@101 412 end
Nenue@101 413
Nenue@101 414
Nenue@101 415
Nick@108 416 self:SetWidth(contentsWidth)
Nick@108 417 self:SetHeight(contentsHeight)
Nenue@101 418 self:Reanchor()
Nenue@101 419 end
Nenue@101 420
Nenue@101 421 function ap:UpdateArtifactButtons()
Nenue@101 422
Nenue@97 423 -- Artifact icons, in no particular order
Nenue@99 424 self.equippedID = C_ArtifactUI.GetEquippedArtifactInfo()
Nenue@97 425 local numButtons = 0
Nenue@99 426 local lastFrame = self
Nenue@99 427 local fishingID, fishingData
Nenue@98 428 local index, button
Nenue@97 429 for itemID, artifact in pairs(self.profile.artifacts) do
Nenue@99 430 if (itemID == UNDERLIGHT_ANGLER_ID) then
Nenue@98 431 if VeneerData.ArtifactPower.EnableFishing then
Nenue@98 432 fishingID = itemID
Nenue@98 433 fishingData = artifact
Nenue@98 434 end
Nenue@97 435
Nenue@98 436 else
Nick@108 437 if artifact.level ~= 54 then
Nick@108 438 numButtons = numButtons + 1
Nick@108 439 button = self.Artifact[numButtons]
Nick@108 440 button.relativeFrame = lastFrame
Nick@108 441 lastFrame = button:SetButton(itemID, artifact, numButtons, (self.equippedID == itemID))
Nick@108 442 end
Nenue@97 443 end
Nenue@97 444
Nenue@98 445 end
Nenue@97 446
Nick@108 447 if fishingData and (self.fishingAP and self.fishingAP > 0) then
Nenue@98 448 numButtons = numButtons + 1
Nenue@99 449 local button = self.Artifact[numButtons]
Nenue@99 450 button.relativeFrame = lastFrame
Nenue@99 451 button:SetButton(fishingID, fishingData, numButtons, self.equippedID == fishingID)
Nenue@98 452 end
Nenue@97 453
Nenue@99 454 for i = numButtons+ 1, #self.Artifact do
Nenue@97 455 print('hide', i)
Nenue@97 456 self.Artifact[i]:Hide()
Nenue@97 457 end
Nenue@97 458
Nenue@101 459 return numButtons
Nenue@97 460 end
Nenue@97 461
Nenue@99 462
Nenue@99 463 function ap:UpdateItemButtons()
Nenue@99 464 print('|cFF00FFFFUpdateItemButtons()|r')
Nenue@99 465 local lastFrame, upFrame
Nenue@99 466 local numButtons = 0
Nenue@101 467 local buttonsHeight = 0
Nick@108 468 local buttonsWidth = 0
Nenue@99 469 for index, button in ipairs(self.Tokens) do
Nenue@99 470 if button.numItems >= 1 then
Nenue@99 471 if button.itemName then
Nenue@99 472 self:SetItemAction(button)
Nenue@99 473 end
Nenue@99 474
Nenue@99 475 button:ClearAllPoints()
Nenue@99 476 numButtons = numButtons + 1
Nenue@99 477 print(index, button:GetID(), button.Icon:GetTexture())
Nenue@99 478 if numButtons == 1 then
Nenue@101 479 button:SetPoint('TOPLEFT', self, 'TOPLEFT', 4, -76)
Nenue@99 480 upFrame = button
Nenue@101 481 buttonsHeight = 52
Nick@108 482 buttonsWidth = 50
Nenue@99 483 else
Nick@108 484 local col = mod(numButtons,8)
Nick@108 485 if col == 1 then
Nick@108 486 button:SetPoint('TOPLEFT', upFrame, 'BOTTOMLEFT', 0, -2)
Nick@108 487 upFrame = button
Nick@108 488 buttonsHeight = buttonsHeight + 52
Nick@108 489
Nick@108 490 else
Nick@108 491 button:SetPoint('TOPLEFT', lastFrame, 'TOPRIGHT', 2, 0)
Nick@108 492
Nick@108 493 end
Nick@108 494 buttonsWidth = max(buttonsWidth, col * 50)
Nenue@99 495 end
Nenue@99 496 button.Count:SetText(button.numItems)
Nenue@99 497 lastFrame = button
Nenue@99 498 button:Show()
Nenue@99 499 else
Nenue@99 500 button:Hide()
Nenue@99 501 end
Nenue@99 502 end
Nenue@99 503
Nenue@101 504
Nenue@101 505
Nick@108 506 return buttonsWidth, buttonsHeight
Nenue@99 507 end
Nenue@99 508
Nenue@99 509 function ap:SetItemAction(button, name)
Nenue@99 510 name = name or self.itemName
Nenue@99 511 if InCombatLockdown() then
Nenue@99 512 self.itemName = name
Nenue@99 513 return
Nenue@99 514 else
Nenue@99 515 button:SetAttribute('*type*','item')
Nenue@99 516 button:SetAttribute('*item*', name)
Nenue@99 517 end
Nenue@99 518 end
Nenue@99 519
Nenue@99 520 function ap:GetItemButton(itemID, texture, itemAP)
Nenue@99 521 print('|cFF00FFFFGetItemButton()|r', itemID, texture, itemAP)
Nenue@99 522 local button = self.ItemButtons[itemID]
Nenue@101 523
Nenue@99 524 if not button then
Nenue@99 525 button = CreateFrame('Button', 'VeneerAPToken'..itemID, self, 'VeneerItemButton')
Nenue@101 526 button.baseAP = itemAP
Nenue@101 527
Nenue@99 528 button:SetPushedTexture([[Interface\Buttons\UI-Quickslot-Depress]])
Nenue@99 529 button:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]],"ADD")
Nenue@99 530 button:SetID(itemID)
Nenue@99 531 button.numItems = 0
Nenue@99 532 button.Icon:SetTexture(texture)
Nenue@99 533 button:RegisterForClicks("AnyUp")
Nenue@99 534 self:SetItemAction(button, GetItemInfo(itemID))
Nenue@99 535
Nenue@99 536 print(' created')
Nenue@99 537 self.ItemButtons[itemID] = button
Nenue@99 538 self.numItems = self.numItems + 1
Nenue@99 539 end
Nenue@99 540
Nick@108 541 local itemAPtext = itemAP
Nenue@101 542 if itemAPtext >= 100000 then
Nenue@101 543 itemAPtext = floor(itemAPtext/1000) .. 'k'
Nenue@101 544 elseif itemAPtext >= 1000 then
Nenue@101 545 itemAPtext = (floor(itemAPtext/100)/10 ) .. 'k'
Nenue@101 546 end
Nenue@101 547 button.Label:SetText(itemAPtext)
Nenue@101 548
Nenue@99 549 button.numItems = button.numItems + 1
Nenue@99 550 return button
Nenue@99 551 end
Nenue@99 552
Nenue@101 553 function ap:GetItemAP(itemID, itemLink, bagData)
Nick@108 554 if not self.cache.items[itemID] then
Nenue@101 555
Nenue@101 556 print('doing tooltip scan')
Nenue@101 557 self.tooltip:SetOwner(self, 'ANCHOR_NONE')
Nenue@101 558 self.tooltip:SetHyperlink(itemLink)
Nenue@101 559 self.tooltip:Show()
Nenue@101 560 local numLines = self.tooltip:NumLines()
Nenue@101 561 if numLines >= 3 then
Nenue@101 562 local subText = _G[TOOLTIP_NAME .. 'TextLeft2']:GetText()
Nenue@101 563 if subText and subText:match(ARTIFACT_POWER) then
Nenue@101 564 for i = 3, numLines do
Nenue@101 565 local text = _G[TOOLTIP_NAME .. 'TextLeft'.. i]:GetText()
Nenue@101 566 if text and text:match(ARTIFACT_POWER) then
Nenue@101 567 text = text:gsub('[,%D]', '')
Nenue@101 568 print(itemLink, '-', tonumber(text))
Nenue@101 569 local itemAP = tonumber(text)
Nenue@101 570 if itemAP then
Nick@108 571 itemAP = itemAP
Nick@108 572 self.cache.items[itemID] = itemAP
Nenue@101 573 end
Nenue@101 574 end
Nenue@101 575 end
Nenue@101 576 end
Nenue@101 577 local fishingText = _G[TOOLTIP_NAME .. 'TextLeft3']:GetText()
Nenue@101 578 if fishingText and fishingText:match('fishing artifact') then
Nenue@101 579 local fishingAP = fishingText:match("%d+")
Nenue@101 580 fishingAP = tonumber(fishingAP)
Nenue@101 581 if fishingAP then
Nick@108 582 self.cache.items[itemID] = fishingAP
Nick@108 583 self.cache.fishing[itemID] = true
Nenue@101 584 end
Nenue@101 585 end
Nenue@101 586 else
Nenue@101 587
Nick@108 588 self.cache.items[itemID] = 0
Nenue@101 589 end
Nenue@101 590 end
Nick@108 591 return self.cache.items[itemID], self.cache.fishing[itemID]
Nenue@101 592 end
Nenue@101 593
Nenue@103 594 function ap:SetArtifact(itemID, name, texture, currentXP, pointsSpent)
Nenue@103 595 print('|cFF00FF00SetArtifact()|r')
Nenue@103 596 if not self.profile then
Nenue@103 597 return
Nenue@103 598 end
Nenue@103 599 local artifacts = self.profile.artifacts
Nenue@103 600
Nenue@103 601 local multi = C_ArtifactUI.GetArtifactKnowledgeMultiplier()
Nick@108 602 if multi and (self.profile.knowledgeMultiplier ~= multi) then
Nick@108 603 table.wipe(self.cache.items)
Nick@108 604 table.wipe(self.cache.fishing)
Nick@108 605 end
Nick@108 606
Nenue@103 607 self.profile.knowledgeMultiplier = multi or self.profile.knowledgeMultiplier
Nenue@103 608 print('multiplier:', multi)
Nenue@103 609
Nenue@103 610 if itemID then
Nenue@103 611
Nenue@103 612 self.currentEquipped = itemID
Nenue@103 613
Nenue@103 614 artifacts[itemID] = artifacts[itemID] or {}
Nenue@103 615 table.wipe(artifacts[itemID])
Nenue@103 616 local artifact = artifacts[itemID]
Nenue@103 617
Nenue@103 618 artifact.name = name
Nenue@103 619 artifact.texture = texture
Nenue@103 620 artifact.currentXP = currentXP
Nenue@103 621 artifact.level = pointsSpent
Nenue@103 622 local cost = C_ArtifactUI.GetCostForPointAtRank(pointsSpent)
Nick@108 623 artifact.currentCost = cost
Nenue@103 624
Nenue@103 625 local pointsAvailable = pointsSpent
Nenue@103 626 local actualCost = cost
Nenue@103 627 local actualXP = currentXP
Nenue@103 628 while actualXP >= actualCost do
Nenue@103 629 pointsAvailable = pointsAvailable + 1
Nenue@103 630 actualXP = actualXP - actualCost
Nenue@103 631 print(pointsAvailable, '-', actualCost, '=', actualXP)
Nenue@103 632 actualCost = C_ArtifactUI.GetCostForPointAtRank(pointsAvailable)
Nenue@103 633 end
Nenue@103 634 print('updating', itemID, name, currentXP, pointsSpent, pointsAvailable, actualXP)
Nenue@103 635 artifact.actualXP = actualXP
Nenue@103 636 artifact.actualLevel = pointsAvailable
Nenue@103 637 artifact.actualCost = actualCost
Nenue@103 638
Nenue@103 639 end
Nenue@103 640 end
Nenue@103 641
Nenue@97 642 function ap:ScanBag(id)
Nenue@97 643 print('|cFF00FFFFScanBag()|r', id, IsBagOpen(id), GetContainerNumSlots(id))
Nenue@97 644 local numSlots = GetContainerNumSlots(id)
Nenue@97 645 local requiresUpdate
Nenue@97 646 if numSlots == 0 then
Nenue@97 647 return nil
Nenue@97 648 end
Nenue@97 649
Nenue@97 650
Nenue@97 651 self.profile.bagslots[id] = self.profile.bagslots[id] or {}
Nenue@97 652 table.wipe(self.profile.bagslots[id])
Nenue@97 653 local bagData = self.profile.bagslots[id]
Nenue@97 654 bagData.totalAP = 0
Nenue@99 655 bagData.fishingAP = 0
Nenue@99 656 bagData.items = bagData.items or {}
Nenue@99 657 table.wipe(bagData.items)
Nenue@99 658
Nick@108 659 self.cache.bagItems[id] = self.cache.bagItems[id] or {}
Nick@108 660 self.cache.bags[id] = self.cache.bags[id] or {}
Nick@108 661 self.cache.fishing[id] = self.cache.fishing[id] or {}
Nick@108 662
Nenue@97 663 for slotID = 1, numSlots do
Nenue@97 664 local texture, count, locked, quality, readable, lootable, link = GetContainerItemInfo(id, slotID)
Nenue@101 665 if link then
Nenue@101 666 local itemID = GetContainerItemID(id, slotID)
Nenue@101 667 local name, _, quality, iLevel, reqLevel, class, subclass = GetItemInfo(link)
Nenue@97 668
Nenue@101 669 if class == 'Consumable' and subclass == 'Other' then
Nenue@102 670 --print(GetItemInfo(link))
Nick@108 671 local itemAP, isFishingAP
Nick@108 672 if self.cache.bags[id][slotID] and (self.cache.bagItems[id][slotID] == itemID) then
Nick@108 673 print('slot cache data', id, slotID)
Nick@108 674 itemAP = self.cache.bags[id][slotID]
Nick@108 675 else
Nick@108 676 itemAP, isFishingAP = self:GetItemAP(itemID, link)
Nick@108 677 self.cache.bagItems[id][slotID] = itemID
Nick@108 678 self.cache.bags[id][slotID] = itemAP
Nick@108 679 self.cache.fishing[id][slotID] = isFishingAP
Nick@108 680 end
Nick@108 681
Nick@108 682
Nenue@102 683 --print(itemAP, isFishingAP)
Nenue@102 684 if itemAP and (itemAP > 0) then
Nenue@102 685 local itemButton = self:GetItemButton(itemID, texture, itemAP)
Nenue@102 686
Nenue@101 687 if isFishingAP then
Nenue@101 688 bagData.fishingItems = (bagData.fishingItems or 0) + 1
Nenue@101 689 bagData.fishingAP = (bagData.fishingAP or 0) + itemAP
Nenue@101 690 else
Nick@108 691 itemAP = itemAP
Nenue@101 692 bagData.numItems = (bagData.numItems or 0) + 1
Nenue@101 693 bagData.totalAP = (bagData.totalAP or 0) + itemAP
Nenue@101 694 end
Nenue@101 695 bagData.items[itemID] = (bagData.items[itemID] or 0) + 1
Nenue@101 696 end
Nenue@101 697 elseif self.profile.artifacts[itemID] then
Nenue@101 698 print('artfiact weapon', itemID, link, id, slotID)
Nenue@101 699 self.profile.artifacts[itemID].containerID = id
Nenue@101 700 self.profile.artifacts[itemID].slotID = slotID
Nenue@101 701 end
Nenue@99 702
Nenue@97 703 end
Nenue@97 704
Nenue@97 705 end
Nenue@97 706
Nenue@97 707 end
Nenue@97 708
Nenue@98 709 local BAG_SLOTS = {0, 1, 2, 3, 4 }
Nenue@98 710 local BANK_SLOTS = {-1, 5, 6,7, 8, 9, 10, 11, 12}
Nenue@99 711 local ItemCounts = {}
Nenue@99 712 function ap:ScanAllBags()
Nenue@99 713 if InCombatLockdown() then
Nenue@99 714 self.queuedScan = true
Nenue@99 715 return
Nenue@99 716 end
Nenue@101 717 if not self.profile.knowledgeMultiplier then
Nenue@101 718 print('need to get knowledge level')
Nenue@101 719 return
Nenue@101 720 end
Nenue@101 721
Nenue@99 722 self.queuedScan = nil
Nenue@98 723
Nenue@101 724 print('|cFFFF0088ScanAllBags()|r', self.profile.knowledgeMultiplier)
Nenue@97 725
Nenue@99 726 for _, button in ipairs(self.Tokens) do
Nenue@99 727 button.numItems = 0
Nenue@99 728 end
Nenue@99 729
Nenue@99 730
Nenue@98 731 for _, bagID in ipairs(BAG_SLOTS) do
Nenue@98 732 self:ScanBag(bagID)
Nenue@97 733 end
Nenue@97 734
Nenue@99 735 if self.bankAccess then
Nenue@98 736 for _, bagID in ipairs(BANK_SLOTS) do
Nenue@98 737 self:ScanBag(bagID)
Nenue@98 738 end
Nenue@98 739 end
Nenue@98 740
Nenue@98 741 self.bankAP = 0
Nenue@98 742 self.bagAP = 0
Nenue@99 743 self.fishingAP = 0
Nenue@99 744
Nenue@99 745 table.wipe(ItemCounts)
Nenue@98 746 for id, bagData in pairs(self.profile.bagslots) do
Nenue@98 747 print(id, GetBagName(id), bagData.totalAP)
Nenue@98 748 id = tonumber(id)
Nenue@98 749 if bagData.totalAP then
Nenue@98 750 if (id == BANK_CONTAINER) or (id >= 5) then
Nenue@98 751 self.bankAP = self.bankAP + bagData.totalAP
Nenue@98 752 else
Nenue@98 753 self.bagAP = self.bagAP + bagData.totalAP
Nenue@97 754 end
Nenue@98 755 end
Nenue@99 756 if bagData.fishingAP then
Nenue@99 757 self.fishingAP = self.fishingAP + bagData.fishingAP
Nenue@99 758 end
Nenue@97 759
Nenue@97 760 end
Nenue@98 761 self.lastUpdate = GetTime()
Nenue@103 762 self.queuedScan = nil
Nenue@99 763 self:TryToShow()
Nenue@97 764 end
Nenue@97 765
Nenue@97 766 VeneerArtifactButtonMixin = {}
Nenue@98 767
Nenue@99 768 function VeneerArtifactButtonMixin:SetButton(itemID, artifact, index, equipped)
Nenue@99 769 print(itemID, index)
Nenue@98 770 print(artifact.name, artifact.texture, artifact.currentXP)
Nenue@98 771 self:SetID(itemID)
Nick@108 772 if not artifact.currentCost then
Nick@108 773 artifact.currentCost = artifact.cost
Nick@108 774 end
Nick@108 775
Nenue@98 776 for k,v in pairs(artifact) do
Nenue@98 777 --print('::',k,v)
Nenue@98 778 self[k] = v
Nenue@98 779 end
Nenue@98 780
Nenue@98 781 -- this can change between artifact parses
Nenue@98 782 local potentialPoints = self.actualLevel
Nenue@99 783 local totalAP = (itemID ~= UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self:GetParent().fishingAP or 0)
Nenue@99 784 print(totalAP)
Nenue@98 785 local potentialXP = self.actualXP + totalAP
Nenue@99 786
Nenue@98 787 self.potentialXP = potentialXP
Nenue@98 788 local potentialCost = C_ArtifactUI.GetCostForPointAtRank(potentialPoints)
Nenue@98 789 while potentialXP >= potentialCost do
Nenue@98 790 potentialXP = potentialXP - potentialCost
Nenue@98 791 potentialPoints = potentialPoints + 1
Nenue@98 792 print('inc estimate', potentialXP, potentialPoints)
Nenue@98 793 potentialCost = C_ArtifactUI.GetCostForPointAtRank(potentialPoints)
Nenue@98 794 end
Nenue@98 795 self.potentialCost = potentialCost
Nenue@98 796 self.potentialLevel = potentialPoints
Nenue@98 797 self.potentialAdjustedXP = potentialXP
Nenue@98 798
Nick@108 799 self.maxCost = self.currentCost
Nick@108 800 for i = self.level + 1, #POINT_COSTS do
Nick@108 801 self.maxCost = self.maxCost + POINT_COSTS[i]
Nick@108 802 end
Nenue@98 803
Nenue@99 804 if index ~= 1 then
Nenue@99 805 self:ClearAllPoints()
Nenue@99 806 self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPRIGHT', 4, 0)
Nenue@99 807 else
Nenue@99 808 self:ClearAllPoints()
Nenue@99 809 self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPLEFT', 4, -4)
Nenue@99 810 end
Nenue@98 811
Nenue@99 812 self.isEquipped = equipped
Nenue@98 813 self:Update()
Nenue@98 814 self:Show()
Nenue@98 815 return self
Nenue@98 816 end
Nenue@98 817
Nenue@97 818 function VeneerArtifactButtonMixin:Update()
Nenue@99 819 local r, g, b = 1, 1, 1
Nenue@99 820 local lR, lG, lB = 1, 1, 0
Nenue@99 821 local levelText = self.level
Nenue@99 822 local xpValue = self.currentXP
Nick@108 823 local costValue = self.currentCost
Nenue@97 824 if self.actualLevel ~= self.level then
Nenue@99 825 levelText, r,g,b = self.actualLevel, 0,1,0
Nenue@99 826 xpValue, costValue, lR, lG, lB = self.actualXP, self.actualCost, 0, 1, 0
Nenue@99 827 elseif self.potentialLevel ~= self.level then
Nenue@99 828 levelText, r, g, b = self.potentialLevel, 0,1,1
Nenue@99 829 xpValue, costValue, lR, lG, lB = self.potentialAdjustedXP, self.potentialCost, 0,1,0
Nenue@99 830
Nenue@97 831 end
Nenue@97 832
Nenue@99 833 self.Level:SetText(levelText)
Nenue@99 834 self.Level:SetTextColor(r, g, b)
Nick@108 835 self.CurrentXP:SetText(ShortNumberString( xpValue))
Nenue@99 836 self.CurrentXP:SetTextColor(lR, lG, lB)
Nenue@99 837
Nenue@97 838 if self.isEquipped then
Nenue@97 839 self:SetNormalTexture([[Interface\Buttons\ButtonHilight-Square]])
Nenue@97 840 self:GetNormalTexture():SetBlendMode('ADD')
Nenue@97 841 self:GetNormalTexture():SetVertexColor(0,1,0)
Nenue@97 842 else
Nenue@97 843 self:SetNormalTexture(nil, 'ADD')
Nenue@97 844 end
Nenue@97 845
Nick@108 846 local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1
Nenue@98 847 if self.level <= 53 then
Nenue@98 848 self.CurrentProgress.animateFrom = self.CurrentProgress:GetHeight() or 1
Nenue@98 849 self.CurrentProgress.animateTo = currentProgress * self:GetHeight()
Nenue@98 850 self.CurrentProgress:Show()
Nenue@101 851 self.ProgressLine:Show()
Nenue@98 852 else
Nenue@98 853 self.CurrentProgress:Hide()
Nenue@101 854 self.ProgressLine:Hide()
Nenue@98 855 end
Nenue@99 856
Nenue@98 857 if self.potentialXP > self.currentXP then
Nenue@99 858 local projectedProgress = (self.potentialAdjustedXP < self.potentialCost) and (self.potentialXP / self.potentialCost) or 1
Nenue@98 859 if (projectedProgress > currentProgress) then
Nenue@98 860 self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP')
Nenue@98 861 projectedProgress = projectedProgress - currentProgress
Nenue@98 862 else
Nenue@98 863 self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM')
Nenue@98 864 end
Nenue@99 865 print('show potential', currentProgress, projectedProgress)
Nenue@98 866 self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1
Nenue@98 867 self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight()
Nenue@101 868 self.AdjustedLine:Show()
Nenue@98 869 self.AdjustedProgress:Show()
Nenue@98 870 else
Nenue@98 871 self.AdjustedProgress:Hide()
Nenue@101 872 self.AdjustedLine:Hide()
Nenue@98 873 end
Nenue@97 874 self.Icon:SetTexture(self.texture)
Nenue@97 875 self:SetSize(64,64)
Nenue@97 876 end
Nenue@97 877
Nenue@98 878
Nenue@98 879 function VeneerArtifactButtonMixin:AnimateProgress(region)
Nenue@98 880 local cTime = GetTime()
Nenue@98 881 if not region.animateStart then
Nenue@98 882 region.animateStart = cTime
Nenue@98 883 end
Nenue@98 884 local progressTo, progressFrom = region.animateTo, region.animateFrom
Nenue@98 885 local elapsed = cTime - region.animateStart
Nenue@98 886 if elapsed >= .5 then
Nenue@98 887 region:SetHeight(progressTo)
Nenue@98 888 region.animateTo = nil
Nenue@98 889 region.animateStart = nil
Nenue@98 890 region.animateFrom = nil
Nenue@98 891 else
Nenue@98 892 local progress = elapsed / .5
Nenue@98 893 local height = (progressFrom + (progressTo - progressFrom) * progress)
Nenue@98 894 --print(self:GetName(), progressTo, progressFrom, (progressTo - progressFrom), ceil(progress*10)/10, ceil(height))
Nenue@98 895 region:SetHeight(height)
Nenue@98 896 end
Nenue@98 897 end
Nenue@98 898
Nenue@98 899 function VeneerArtifactButtonMixin:OnUpdate(sinceLast)
Nenue@98 900 if self.CurrentProgress.animateTo then
Nenue@98 901 self:AnimateProgress(self.CurrentProgress)
Nenue@98 902 end
Nenue@98 903
Nenue@98 904 if self.AdjustedProgress.animateTo then
Nenue@98 905 self:AnimateProgress(self.AdjustedProgress)
Nenue@98 906 end
Nenue@98 907 end
Nenue@98 908
Nenue@97 909 function VeneerArtifactButtonMixin:OnEnter()
Nenue@97 910 GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
Nenue@97 911 GameTooltip:SetText(self.name)
Nick@108 912 GameTooltip:AddLine(ShortNumberString(self.currentXP) .. ' / '..ShortNumberString(self.currentCost), 1, 1, 0)
Nenue@98 913 if self.potentialXP > self.currentXP then
Nick@108 914 GameTooltip:AddLine(ShortNumberString(self.potentialXP) .. ' potential XP', 0, 1, 1)
Nenue@99 915 if self.potentialAdjustedXP ~= self.potentialXP then
Nick@108 916 GameTooltip:AddLine(ShortNumberString(self.potentialAdjustedXP) .. ' / ' .. ShortNumberString(self.potentialCost).. ' after', 0, 1, 0)
Nenue@98 917 end
Nenue@97 918 end
Nenue@99 919 if self.actualLevel ~= self.level then
Nick@108 920 GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 1)
Nick@108 921 end
Nick@108 922 if self.currentXP < self.currentCost then
Nick@108 923 GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' needed')
Nenue@99 924 end
Nenue@99 925
Nenue@97 926 GameTooltip:Show()
Nenue@97 927 end
Nenue@97 928 function VeneerArtifactButtonMixin:OnLeave()
Nenue@97 929 if GameTooltip:IsOwned(self) then
Nenue@97 930 GameTooltip:Hide()
Nenue@97 931 end
Nenue@97 932 end
Nick@108 933 function VeneerArtifactButtonMixin:OnHide()
Nick@108 934
Nick@108 935 if GameTooltip:IsOwned(self) then
Nick@108 936 GameTooltip:Hide()
Nick@108 937 end
Nick@108 938 end
Nenue@97 939
Nenue@97 940 function VeneerArtifactButtonMixin:OnClick(button, down)
Nenue@97 941 if self.isEquipped then
Nenue@97 942 SocketInventoryItem(16)
Nenue@97 943 else
Nick@108 944 if IsShiftKeyDown() then
Nenue@97 945 SocketContainerItem(self.containerID, self.slotID)
Nick@108 946 else
Nick@108 947
Nick@108 948 end
Nenue@97 949 end
Nenue@97 950 end