Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if IsAddOnLoaded("ArkInventory") then
- function ArkInventoryItemButton_CIMIUpdateIcon(self)
- if not self or not self:GetParent() then return end
- if not CIMI_CheckOverlayIconEnabled(self) then
- self.CIMIIconTexture:SetShown(false)
- self:SetScript("OnUpdate", nil)
- return
- end
- self = self:GetParent()
- if ArkInventory.Frame_Item_GetDB(self) then
- CIMI_SetIcon(self.CanIMogItOverlay, ArkInventoryItemButton_CIMIUpdateIcon, CanIMogIt:GetTooltipText(ArkInventory.Frame_Item_GetDB(self).h))
- end
- end
- function CIMI_ArkInventoryAddFrame(self, event, addonName)
- if event ~= "PLAYER_LOGIN" and event ~= "BANKFRAME_OPENED" and not CIMIEvents[event] then return end
- -- Add to frames
- -- Bags
- for i=1,NUM_CONTAINER_FRAMES do
- for j=1,MAX_CONTAINER_ITEMS do
- local frame = _G["ARKINV_Frame1ScrollContainerBag"..i.."Item"..j]
- CIMI_AddToFrame(frame, ArkInventoryItemButton_CIMIUpdateIcon)
- end
- end
- -- Bank
- C_Timer.After(.5, function() CIMI_ArkInventoryAddBankFrame() end)
- end
- hooksecurefunc(CanIMogIt.frame, "HookItemOverlay", CIMI_ArkInventoryAddFrame)
- function CIMI_ArkInventoryEvents(self, event, ...)
- if not CIMIEvents[event] then return end
- -- Update event
- CIMI_ArkInventoryUpdate()
- end
- hooksecurefunc(CanIMogIt.frame, "ItemOverlayEvents", CIMI_ArkInventoryEvents)
- function CIMI_ArkInventoryUpdate()
- for i=1,NUM_CONTAINER_FRAMES do
- for j=1,MAX_CONTAINER_ITEMS do
- local frame = _G["ARKINV_Frame1ScrollContainerBag"..i.."Item"..j]
- if frame then
- C_Timer.After(.5, function() ArkInventoryItemButton_CIMIUpdateIcon(frame.CanIMogItOverlay) end)
- end
- end
- end
- for i=1,8 do
- for j=1,MAX_CONTAINER_ITEMS do
- local frame = _G["ARKINV_Frame3ScrollContainerBag"..i.."Item"..j]
- if frame then
- C_Timer.After(.5, function() ArkInventoryItemButton_CIMIUpdateIcon(frame.CanIMogItOverlay) end)
- end
- end
- end
- end
- -- If you change characters or open the bank/bags with ArkInventory
- local ArkInventoryChange_IsHooked = nil
- local function CIMI_ArkInventoryHook()
- if ArkInventoryChange_IsHooked == nil then
- ArkDewdrop30102Level0:HookScript("OnHide", function() CIMI_ArkInventoryUpdate(); C_Timer.After(.5, function() CIMI_ArkInventoryAddBankFrame() end) end)
- ArkInventoryChange_IsHooked = true
- end
- end
- ARKINV_Frame1TitleActionButton5:HookScript("OnClick", CIMI_ArkInventoryHook)
- ARKINV_Frame1TitleActionButton6:HookScript("OnClick", CIMI_ArkInventoryHook)
- function CIMI_ArkInventoryAddBankFrame()
- for i=1,8 do
- for j=1,MAX_CONTAINER_ITEMS do
- local frame = _G["ARKINV_Frame3ScrollContainerBag"..i.."Item"..j]
- CIMI_AddToFrame(frame, ArkInventoryItemButton_CIMIUpdateIcon)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement