diff --git a/src/Constants.lua b/src/Constants.lua new file mode 100644 index 0000000..780de75 --- /dev/null +++ b/src/Constants.lua @@ -0,0 +1,6 @@ +local ADDON_NAME, ADDON = ... + +-- Formatter types +ADDON.formats = { + MASONRY = 0, +} \ No newline at end of file diff --git a/src/DJBags.lua b/src/DJBags.lua new file mode 100644 index 0000000..eef532d --- /dev/null +++ b/src/DJBags.lua @@ -0,0 +1,68 @@ +local ADDON_NAME, ADDON = ... +local eventManager = ADDON.eventManager + +local core = {} + +function core:ADDON_LOADED(name) + if ADDON_NAME ~= name then return end + + eventManager:Remove('ADDON_LOADED', core) +end + +eventManager:Add('ADDON_LOADED', core) + +ToggleAllBags = function() + if DJBagsBag:IsVisible() then + DJBagsBag:Hide() + else + DJBagsBag:Show() + end +end + +local oldToggle = ToggleBag +ToggleBag = function(id) + if id < 5 and id > -1 then + if DJBagsBag:IsVisible() then + DJBagsBag:Hide() + else + DJBagsBag:Show() + end + else + oldToggle(id) + end +end + +ToggleBackpack = function() + if DJBagsBag:IsVisible() then + DJBagsBag:Hide() + else + DJBagsBag:Show() + end +end + +OpenAllBags = function() + DJBagsBag:Show() +end + +OpenBackpack = function() + DJBagsBag:Show() +end + +CloseAllBags = function() + DJBagsBag:Hide() +end + +CloseBackpack = function() + DJBagsBag:Hide() +end + +SLASH_DJBAGS1, SLASH_DJBAGS2, SLASH_DJBAGS3, SLASH_DJBAGS4 = '/djb', '/dj', '/djbags', '/db'; +function SlashCmdList.DJBAGS(msg, editbox) + DJBagsBank:SetSize(100, 100) + DJBagsBank:Show() +end + +SLASH_RL1 = '/rl'; +function SlashCmdList.RL(msg, editbox) + ReloadUI() +end \ No newline at end of file diff --git a/src/bag/Bag.lua b/src/bag/Bag.lua new file mode 100644 index 0000000..24dbff3 --- /dev/null +++ b/src/bag/Bag.lua @@ -0,0 +1,27 @@ +local ADDON_NAME, ADDON = ... + +local bag = {} +bag.__index = bag + +function DJBagsRegisterBagBagContainer(self, bags) + DJBagsRegisterBaseBagContainer(self, bags) + + for k, v in pairs(bag) do + self[k] = v + end +end + +function bag:ClearNewItems() + C_NewItems:ClearAll() + self:Refresh() +end + +function bag:BAG_UPDATE_DELAYED() + if self.mainBar.bagBar then + for _, bag in pairs(self.bags) do + if bag > 0 then + self.mainBar.bagBar['bag'..bag]:Update() + end + end + end +end \ No newline at end of file diff --git a/src/bag/Bag.xml b/src/bag/Bag.xml new file mode 100644 index 0000000..dc802d1 --- /dev/null +++ b/src/bag/Bag.xml @@ -0,0 +1,232 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file="src/bag/bag.lua"/> + + <Frame name="DJBagsBagBarTemplate" virtual="true" movable="true" enableMouse="true"> + <Size x="173" y="47" /> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1" /> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6" /> + <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> + </Backdrop> + <Frames> + <Button name="$parentBag1" parentKey="bag1" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" x="5" y="-5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, 1, ContainerIDToInventoryID(1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag2" parentKey="bag2" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, 2, ContainerIDToInventoryID(2)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag3" parentKey="bag3" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag2" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, 3, ContainerIDToInventoryID(3)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag4" parentKey="bag4" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag3" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, 4, ContainerIDToInventoryID(4)) + </OnLoad> + </Scripts> + </Button> + </Frames> + </Frame> + + <Frame name="DJBagsMainBarTemplate" virtual="true" movable="true" enableMouse="true"> + <Size x="345" y="25"/> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Frames> + <CheckButton name="$parentBagBtn" inherits="UIRadioButtonTemplate"> + <Anchors> + <Anchor point="RIGHT" relativePoint="RIGHT" relativeTo="$parent" x="-5"/> + </Anchors> + <Scripts> + <OnClick> + if self:GetParent().bagBar:IsVisible() then + self:GetParent().bagBar:Hide() + else + self:GetParent().bagBar:Show() + end + </OnClick> + </Scripts> + </CheckButton> + <Button name="$parentRestackBtn"> + <Size x="16" y="16"/> + <Anchors> + <Anchor point="RIGHT" relativeTo="$parentBagBtn" relativePoint="LEFT" x="-3"/> + </Anchors> + <NormalTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Disabled"/> + <PushedTexture file="Interface\Buttons\UI-GuildButton-OfficerNote-Up"/> + <HighlightTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Up" alphaMode="ADD"/> + <Scripts> + <OnEnter> + GameTooltip:SetOwner(self, 'TOPRIGHT') + GameTooltip:SetText(BAG_CLEANUP_BAGS) + GameTooltip:Show() + </OnEnter> + <OnLeave> + GameTooltip:Hide() + </OnLeave> + <OnClick> + -- PlaySound("UI_BagSorting_01"); + SortBags() + </OnClick> + </Scripts> + </Button> + <Button name="$parentClearButton"> + <Size x="25" y="25"/> + <Anchors> + <Anchor point="RIGHT" relativeTo="$parentRestackBtn" relativePoint="LEFT" x="-3"/> + </Anchors> + <NormalTexture file="Interface\Buttons\UI-RotationLeft-Button-Up"/> + <PushedTexture file="Interface\Buttons\UI-RotationLeft-Button-Down"/> + <HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD"> + <Size x="22" y="23"/> + <Anchors> + <Anchor point="CENTER" x="0" y="0"/> + </Anchors> + </HighlightTexture> + <Scripts> + <OnEnter> + GameTooltip:SetOwner(self, 'TOPRIGHT') + --GameTooltip:SetText(DJBags_LOCALE_CLEAR_NEW_ITEMS) + GameTooltip:Show() + </OnEnter> + <OnLeave> + GameTooltip:Hide() + </OnLeave> + <OnClick> + self:GetParent():GetParent():ClearNewItems() + </OnClick> + </Scripts> + </Button> + <EditBox name="$parentSearchBox" parentKey="search" inherits="BagSearchBoxTemplate" letters="15"> + <Size x="96" y="18"/> + <Anchors> + <Anchor point="RIGHT" relativeTo="$parentClearButton" relativePoint="LEFT" x="-3"/> + </Anchors> + </EditBox> + <Frame name="$parentMoney" parentKey="moneyFrame" inherits="SmallMoneyFrameTemplate" hidden="false"> + <Anchors> + <Anchor point="RIGHT" relativeTo="$parentSearchBox" relativePoint="LEFT"/> + </Anchors> + <Scripts> + <OnLoad> + SmallMoneyFrame_OnLoad(self); + MoneyFrame_SetType(self, "PLAYER"); + MoneyFrame_SetMaxDisplayWidth(self, 168); + </OnLoad> + </Scripts> + </Frame> + <Frame name="$parentCurrencyDisplay" frameStrata="DIALOG" toplevel="true" frameLevel="10"> + <Anchors> + <Anchor point="TOPLEFT"/> + <Anchor point="BOTTOMRIGHT" relativeTo="$parentSearchBox" relativePoint="BOTTOMLEFT"/> + </Anchors> + <Scripts> + <OnEnter> + local cnt = GetCurrencyListSize() + GameTooltip:SetOwner(self, "ANCHOR_NONE") + GameTooltip:SetPoint("BOTTOMLEFT", self, "TOPLEFT") + GameTooltip:SetText("Currency") + for index = 1, cnt do + local name, _, _, _, _, count, texture, _, _, _, _ = GetCurrencyListInfo(index) + if count ~= 0 and texture ~= nil then + GameTooltip:AddDoubleLine(name, count .. " |T" .. texture .. ":16|t", 1, 1, 1, 1, 1, 1) + end + end + GameTooltip:Show() + </OnEnter> + <OnLeave> + GameTooltip:Hide() + </OnLeave> + <OnMouseDown> + MoneyInputFrame_OpenPopup(self:GetParent().moneyFrame); + </OnMouseDown> + </Scripts> + </Frame> + <Frame name="$parentBagBar" parentKey="bagBar" inherits="DJBagsBagBarTemplate" hidden="true"> + <Anchors> + <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" y="-5"/> + </Anchors> + </Frame> + </Frames> + </Frame> + + <Frame name="DJBagsBag" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true" + hidden="true" parent="UIParent"> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Anchors> + <Anchor point="CENTER" /> + </Anchors> + <Frames> + <Frame name="$parentMainBar" parentKey="mainBar" inherits="DJBagsMainBarTemplate"> + <Anchors> + <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" x="0" y="-5"/> + </Anchors> + </Frame> + <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton"> + <Anchors> + <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/> + </Anchors> + <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" /> + <Scripts> + <OnLoad> + self:SetAlpha(0.2) + </OnLoad> + <OnEnter> + self:SetAlpha(1) + </OnEnter> + <OnLeave> + self:SetAlpha(0.2) + </OnLeave> + </Scripts> + </Button> + </Frames> + <Scripts> + <OnLoad> + DJBagsRegisterBagBagContainer(self, {0, 1, 2, 3, 4}) + </OnLoad> + <OnShow> + self:OnShow() + </OnShow> + <OnHide> + self:OnHide() + </OnHide> + </Scripts> + </Frame> +</Ui> \ No newline at end of file diff --git a/src/bagItem/BagItem.lua b/src/bagItem/BagItem.lua new file mode 100644 index 0000000..8cfcd9f --- /dev/null +++ b/src/bagItem/BagItem.lua @@ -0,0 +1,104 @@ +local NAME, ADDON = ... + +local item = {} + +function DJBagsBagItemLoad(button, slot, id) + for k, v in pairs(item) do + button[k] = v + end + + button:Init(id, slot) +end + +function item:Init(id, slot) + self:SetID(id) + self.slot = slot + + self:SetScript('OnDragStart', self.DragItem) + self:SetScript('OnReceiveDrag', self.PlaceOrPickup) + self:SetScript('OnClick', function (self, ...) + if self.buy then + -- PlaySound("igMainMenuOption"); + StaticPopup_Show("CONFIRM_BUY_BANK_SLOT") + else + self:PlaceOrPickup(...) + end + end) + self:SetScript('OnEnter', self.OnEnter) + self:SetScript('OnLeave', self.OnLeave) +end + +function item:Update() + local numBankSlots, full = GetNumBankSlots() + if self.slot - NUM_BAG_SLOTS > numBankSlots then + local cost = GetBankSlotCost(self.slot-1) + self:SetCost(cost) + return + end + PaperDollItemSlotButton_Update(self) + local slotcount = GetContainerNumSlots(self.slot) + if slotcount > 0 then + self.Count:SetText(tostring(slotcount)) + self.Count:Show() + else + self.Count:Hide() + end + self.buy = nil +end + +function item:UpdateLock() + PaperDollItemSlotButton_UpdateLock(self) +end + +function item:PlaceOrPickup() + local placed = PutItemInBag(self:GetID()) + if not placed then + PickupBagFromSlot(self:GetID()) + end +end + +function item:OnEnter() + if self:GetRight() >= (GetScreenWidth() / 2) then + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + else + GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') + end + + local hasItem, hasCooldown, repairCost, speciesID, level, breedQuality, maxHealth, power, speed, name = GameTooltip:SetInventoryItem("player", self:GetID()) + if(speciesID and speciesID > 0) then + BattlePetToolTip_Show(speciesID, level, breedQuality, maxHealth, power, speed, name) + CursorUpdate(self) + return; + end + + if (not IsInventoryItemProfessionBag("player", self:GetID())) then + for i = LE_BAG_FILTER_FLAG_EQUIPMENT, NUM_LE_BAG_FILTER_FLAGS do + if ( GetBankBagSlotFlag(self:GetID(), i) ) then + GameTooltip:AddLine(BAG_FILTER_ASSIGNED_TO:format(BAG_FILTER_LABELS[i])) + break; + end + end + end + + GameTooltip:Show() + CursorUpdate(self) + + ADDON.eventManager:Fire('DJBAGS_BAG_HOVER', self.slot, true) +end + +function item:SetCost(cost) + if cost > -1 then + self.IconBorder:Show() + self.IconBorder:SetVertexColor(1, 0, 0, 1) + self.Count:Show() + self.Count:SetText(cost/10000 .. "|TInterface\\MoneyFrame\\UI-GoldIcon:12:12:2:0|t") + self.buy = true + end +end + +function item:OnLeave() + GameTooltip_Hide() + ResetCursor() + + ADDON.eventManager:Fire('DJBAGS_BAG_HOVER', self.slot, false) +end \ No newline at end of file diff --git a/src/bagItem/BagItem.xml b/src/bagItem/BagItem.xml new file mode 100644 index 0000000..7be4f34 --- /dev/null +++ b/src/bagItem/BagItem.xml @@ -0,0 +1,3 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/bagItem/BagItem.lua"/> +</Ui> \ No newline at end of file diff --git a/src/bank/Bank.lua b/src/bank/Bank.lua new file mode 100644 index 0000000..b18ceea --- /dev/null +++ b/src/bank/Bank.lua @@ -0,0 +1,47 @@ +local ADDON_NAME, ADDON = ... + +local bank = {} +bank.__index = bank + +function DJBagsRegisterBankBagContainer(self, bags) + DJBagsRegisterBaseBagContainer(self, bags) + + for k, v in pairs(bank) do + self[k] = v + end + + ADDON.eventManager:Add('BANKFRAME_OPENED', self) + ADDON.eventManager:Add('BANKFRAME_CLOSED', self) + ADDON.eventManager:Add('PLAYERBANKSLOTS_CHANGED', self) + ADDON.eventManager:Add('PLAYERBANKBAGSLOTS_CHANGED', self) + + BankFrame:UnregisterAllEvents() + BankFrame:SetScript('OnShow', nil) +end + +function bank:BANKFRAME_OPENED() + if BankFrame.selectedTab == 1 then + self:Show() + DJBagsBag:Show() + end +end + +function bank:BANKFRAME_CLOSED() + self:Hide() +end + +function bank:PLAYERBANKSLOTS_CHANGED() + self:BAG_UPDATE(BANK_CONTAINER) +end + +function bank:BAG_UPDATE_DELAYED() + for _, bag in pairs(self.bags) do + if bag ~= BANK_CONTAINER then + DJBagsBankBar['bag' .. bag - NUM_BAG_SLOTS]:Update() + end + end +end + +function bank:PLAYERBANKBAGSLOTS_CHANGED() + self:BAG_UPDATE_DELAYED() +end \ No newline at end of file diff --git a/src/bank/Bank.xml b/src/bank/Bank.xml new file mode 100644 index 0000000..0365be4 --- /dev/null +++ b/src/bank/Bank.xml @@ -0,0 +1,249 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> + <Script file="src/bank/BankFrame.lua"/> + <Script file="src/bank/Bank.lua"/> + <Script file="src/bank/Reagent.lua"/> + + <Frame name="DJBagsBankBar" parent="UIParent" movable="true" enableMouse="true" hidden="true"> + <Size x="299" y="77" /> + <Anchors> + <Anchor point="TOPLEFT" x="150" y="-100" /> + </Anchors> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Frames> + <Button name="$parentBag1" parentKey="bag1" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" x="5" y="-5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 1, BankButtonIDToInvSlotID(1, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag2" parentKey="bag2" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 2, BankButtonIDToInvSlotID(2, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag3" parentKey="bag3" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag2" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 3, BankButtonIDToInvSlotID(3, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag4" parentKey="bag4" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag3" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 4, BankButtonIDToInvSlotID(4, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag5" parentKey="bag5" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag4" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 5, BankButtonIDToInvSlotID(5, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag6" parentKey="bag6" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag5" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 6, BankButtonIDToInvSlotID(6, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentBag7" parentKey="bag7" inherits="ItemButtonTemplate"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag6" relativePoint="TOPRIGHT" x="5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 7, BankButtonIDToInvSlotID(7, 1)) + </OnLoad> + </Scripts> + </Button> + <Button name="$parentRestackButton"> + <Size x="16" y="16" /> + <Anchors> + <Anchor point="TOPRIGHT" relativeTo="$parentBag7" relativePoint="BOTTOMRIGHT" y="-9.5" /> + </Anchors> + <NormalTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Disabled" /> + <PushedTexture file="Interface\Buttons\UI-GuildButton-OfficerNote-Up" /> + <HighlightTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Up" alphaMode="ADD" /> + <Scripts> + <OnEnter> + GameTooltip:SetOwner(self, 'TOPRIGHT') + GameTooltip:SetText(BAG_CLEANUP_BANK) + GameTooltip:Show() + </OnEnter> + <OnLeave> + GameTooltip:Hide() + </OnLeave> + <OnClick> + SortBankBags() + SortReagentBankBags() + </OnClick> + </Scripts> + </Button> + <Button name="$parentDepositReagent" inherits="UIPanelButtonTemplate" text="REAGENTBANK_DEPOSIT"> + <Size x="150" y="25" /> + <Anchors> + <Anchor point="RIGHT" relativeTo="$parentRestackButton" relativePoint="LEFT" x="-3" /> + </Anchors> + <Scripts> + <OnClick> + DepositReagentBank(); + </OnClick> + </Scripts> + </Button> + <EditBox name="$parentSearchBar" inherits="BagSearchBoxTemplate"> + <Size y="25" /> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="BOTTOMLEFT" x="5" y="-5"/> + <Anchor point="RIGHT" relativeTo="$parentDepositReagent" relativePoint="LEFT" x="-5" /> + </Anchors> + </EditBox> + <Button name="$parentTab1" inherits="TabButtonTemplate" text="BANK"> + <Anchors> + <Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="TOPLEFT" /> + </Anchors> + <Scripts> + <OnLoad> + PanelTemplates_TabResize(self, 0); + self.HighlightTexture:SetWidth(self:GetTextWidth() + 31); + self.tab = 1 + </OnLoad> + <OnClick> + DJBagsBankTab_OnClick(self) + </OnClick> + </Scripts> + </Button> + <Button name="$parentTab2" inherits="TabButtonTemplate" text="REAGENT_BANK"> + <Anchors> + <Anchor point="BOTTOMLEFT" relativeTo="$parentTab1" relativePoint="BOTTOMRIGHT" /> + </Anchors> + <Scripts> + <OnLoad> + PanelTemplates_TabResize(self, 0); + self.HighlightTexture:SetWidth(self:GetTextWidth() + 31); + self.tab = 2 + </OnLoad> + <OnClick> + DJBagsBankTab_OnClick(self) + </OnClick> + </Scripts> + </Button> + <Frame name="DJBagsBank" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true" + hidden="true" parent="DJBagsBankBar"> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" y="-5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsRegisterBankBagContainer(self, {BANK_CONTAINER, 5, 6, 7, 8, 9, 10, 11}) + </OnLoad> + <OnShow> + self:OnShow() + </OnShow> + <OnHide> + self:OnHide() + </OnHide> + </Scripts> + </Frame> + <Frame name="DJBagsReagents" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true" + hidden="true" parent="DJBagsBankBar"> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" y="-5" /> + </Anchors> + <Scripts> + <OnLoad> + DJBagsRegisterReagentBagContainer(self, {REAGENTBANK_CONTAINER}) + </OnLoad> + <OnShow> + self:OnShow() + </OnShow> + <OnHide> + self:OnHide() + </OnHide> + </Scripts> + </Frame> + <Button name="$parentReagentButton" parent="DJBagsReagentContainer" parentKey="reagentButton" inherits="UIPanelButtonTemplate" text="BANKSLOTPURCHASE" hidden="true"> + <Size x="100" y="25"/> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="DJBagsReagentContainer" relativePoint="TOPLEFT" x="5" y="-5" /> + </Anchors> + <Scripts> + <OnClick> + -- PlaySound("igMainMenuOption"); + StaticPopup_Show("CONFIRM_BUY_REAGENTBANK_TAB"); + </OnClick> + </Scripts> + </Button> + <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton"> + <Anchors> + <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/> + </Anchors> + <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" /> + <Scripts> + <OnLoad> + self:SetAlpha(0.2) + </OnLoad> + <OnEnter> + self:SetAlpha(1) + </OnEnter> + <OnLeave> + self:SetAlpha(0.2) + </OnLeave> + </Scripts> + </Button> + </Frames> + <Scripts> + <OnLoad> + PanelTemplates_SetNumTabs(self, 2) + DJBagsRegisterBankFrame(self) + </OnLoad> + <OnHide> + CloseBankFrame() + StaticPopup_Hide("CONFIRM_BUY_BANK_SLOT") + </OnHide> + </Scripts> + </Frame> +</Ui> \ No newline at end of file diff --git a/src/bank/BankFrame.lua b/src/bank/BankFrame.lua new file mode 100644 index 0000000..6189703 --- /dev/null +++ b/src/bank/BankFrame.lua @@ -0,0 +1,45 @@ +local ADDON_NAME, ADDON = ... + +local bankFrame = {} +bankFrame.__index = bankFrame + +function DJBagsRegisterBankFrame(self, bags) + for k, v in pairs(bankFrame) do + self[k] = v + end + + ADDON.eventManager:Add('BANKFRAME_OPENED', self) + ADDON.eventManager:Add('BANKFRAME_CLOSED', self) + ADDON.eventManager:Add('BAG_UPDATE_DELAYED', self) + + table.insert(UISpecialFrames, self:GetName()) + self:RegisterForDrag("LeftButton") + self:SetScript("OnDragStart", function(self, ...) + self:StartMoving() + end) + self:SetScript("OnDragStop", function(self, ...) + self:StopMovingOrSizing(...) + end) + self:SetUserPlaced(true) +end + +function DJBagsBankTab_OnClick(tab) + PanelTemplates_SetTab(DJBagsBankBar, tab.tab) + if tab.tab == 1 then + DJBagsBank:Show() + DJBagsReagents:Hide() + BankFrame.selectedTab = 1 + else + DJBagsBank:Hide() + DJBagsReagents:Show() + BankFrame.selectedTab = 2 + end +end + +function bankFrame:BANKFRAME_OPENED() + self:Show() +end + +function bankFrame:BANKFRAME_CLOSED() + self:Hide() +end \ No newline at end of file diff --git a/src/bank/Reagent.lua b/src/bank/Reagent.lua new file mode 100644 index 0000000..d543a37 --- /dev/null +++ b/src/bank/Reagent.lua @@ -0,0 +1,30 @@ +local ADDON_NAME, ADDON = ... + +local bank = {} +bank.__index = bank + +function DJBagsRegisterReagentBagContainer(self, bags) + DJBagsRegisterBaseBagContainer(self, bags) + + for k, v in pairs(bank) do + self[k] = v + end + + ADDON.eventManager:Add('BANKFRAME_OPENED', self) + ADDON.eventManager:Add('BANKFRAME_CLOSED', self) + ADDON.eventManager:Add('PLAYERREAGENTBANKSLOTS_CHANGED', self) +end + +function bank:BANKFRAME_OPENED() + if BankFrame.selectedTab == 2 then + self:Show() + end +end + +function bank:BANKFRAME_CLOSED() + self:Hide() +end + +function bank:PLAYERREAGENTBANKSLOTS_CHANGED() + self:BAG_UPDATE(REAGENTBANK_CONTAINER) +end \ No newline at end of file diff --git a/src/base/Base.xml b/src/base/Base.xml new file mode 100644 index 0000000..5520fbb --- /dev/null +++ b/src/base/Base.xml @@ -0,0 +1,3 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/base/BaseBag.lua"/> +</Ui> \ No newline at end of file diff --git a/src/base/BaseBag.lua b/src/base/BaseBag.lua new file mode 100644 index 0000000..b9fac1b --- /dev/null +++ b/src/base/BaseBag.lua @@ -0,0 +1,175 @@ +local ADDON_NAME, ADDON = ... + +local bag = {} +bag.__index = bag + +local settings = { + padding = 5, + containerSpacing = 5, + itemSpacing = 5, + maxColumns = 10, +} + +local function MakeMoveable(self) + if self:GetParent() == UIParent then + table.insert(UISpecialFrames, self:GetName()) + end + self:RegisterForDrag("LeftButton") + self:SetScript("OnDragStart", function(self, ...) + if self:GetParent() == UIParent then + self:StartMoving() + elseif self:GetParent():IsMovable() then + self:GetParent():StartMoving(...) + end + end) + self:SetScript("OnDragStop", function(self, ...) + if self:GetParent() == UIParent then + self:StopMovingOrSizing(...) + elseif self:GetParent():IsMovable() then + self:GetParent():StopMovingOrSizing(...) + end + end) + if self:GetParent() == UIParent then + self:SetUserPlaced(true) + end +end + +local function GetKeyBasedBagList(bags) + local out = {} + for _, v in pairs(bags) do + out[v] = true + end + return out +end + +local function CreateBagContainers(self) + local out = {} + for _, bag in pairs(self.bags) do + out[bag] = CreateFrame("Frame", "DJBagsBagContainer_" .. bag, self) + out[bag]:SetAllPoints() + out[bag]:SetID(bag) + out[bag].items = {} + end + return out +end + +local function CreateTitleContainer(self, item) + if not self.titleContainers[item.type] then + self.titleContainers[item.type] = CreateFrame('Frame', string.format('DJBagsTitleContainer_%s_%s', self:GetName(), item.type), self, 'DJBagsTitleContainerTemplate') + self.titleContainers[item.type].name:SetText(item.type) + MakeMoveable(self.titleContainers[item.type]) + end +end + +local function GetAllItems(self, bags) + local updateOccured = false + for _, bag in pairs(bags) do + local bagSlots = GetContainerNumSlots(bag) + local container = self.containers[bag] + for slot = 1, bagSlots do + if not container.items[slot] then + container.items[slot] = ADDON:NewItem(container, slot) + tinsert(self.items, container.items[slot]) + end + local item = container.items[slot] + local idBefore = item.id + item:Update() + item.type = ADDON.categoryManager:GetTitle(item) + CreateTitleContainer(self, item) + if idBefore ~= item.id and item.id ~= nil then + updateOccured = true + end + end + end + if updateOccured then + self:Format() + end + return updateOccured +end + +function DJBagsRegisterBaseBagContainer(frame, bags) + for k, v in pairs(bag) do + frame[k] = v + end + + frame:OnLoad(bags) +end + +function bag:OnLoad(bags) + self.bags = bags + self.bagsByKey = GetKeyBasedBagList(bags) + self.items = {} + self.containers = CreateBagContainers(self) + self.titleContainers = {} + self.settings = settings -- TODO get this from user defined settings... + self.Format = ADDON.formatter[ADDON.formats.MASONRY] + + ADDON.eventManager:Add('PLAYER_ENTERING_WORLD', self) + + MakeMoveable(self) +end + +function bag:OnShow() + self:Refresh() + self:BAG_UPDATE_DELAYED() + + ADDON.eventManager:Add('INVENTORY_SEARCH_UPDATE', self) + ADDON.eventManager:Add('BAG_UPDATE_COOLDOWN', self) + ADDON.eventManager:Add('ITEM_LOCK_CHANGED', self) + ADDON.eventManager:Add('BAG_UPDATE_DELAYED', self) + ADDON.eventManager:Add('DJBAGS_BAG_HOVER', self) -- some hover stuff... +end + +function bag:OnHide() + ADDON.eventManager:Remove('INVENTORY_SEARCH_UPDATE', self) + ADDON.eventManager:Remove('BAG_UPDATE_COOLDOWN', self) + ADDON.eventManager:Remove('ITEM_LOCK_CHANGED', self) + ADDON.eventManager:Remove('BAG_UPDATE_DELAYED', self) + ADDON.eventManager:Remove('DJBAGS_BAG_HOVER', self) +end + +function bag:Refresh() + if not GetAllItems(self, self.bags) then + self:Format() + end +end + +function bag:PLAYER_ENTERING_WORLD() + ADDON.eventManager:Add('BAG_UPDATE', self) +end + +function bag:BAG_UPDATE(bag) + if self.bagsByKey[bag] then + GetAllItems(self, { bag }) + end +end + +function bag:INVENTORY_SEARCH_UPDATE() + for _, item in pairs(self.items) do + item:UpdateSearch() + end +end + +function bag:BAG_UPDATE_COOLDOWN() + for _, item in pairs(self.items) do + item:UpdateCooldown() + end +end + +function bag:ITEM_LOCK_CHANGED(bag, slot) + if bag then + if self.bagsByKey[bag] and slot then + self.containers[bag].items[slot]:UpdateLock() + end + end +end + +function bag:BAG_UPDATE_DELAYED() +end + +function bag:DJBAGS_BAG_HOVER(bagId, locked) + for _, item in pairs(self.items) do + local lock = (item:GetParent():GetID() ~= bagId) and locked + item:UpdateLock(lock) + end +end \ No newline at end of file diff --git a/src/category/ArtifactPower.lua b/src/category/ArtifactPower.lua new file mode 100644 index 0000000..bb40165 --- /dev/null +++ b/src/category/ArtifactPower.lua @@ -0,0 +1,7 @@ +local ADDON_NAME, ADDON = ... + +DJBags_AddCategoryFilter(function(bag, slot) + if DJBagsTooltip:IsItemArtifactPower(bag, slot) then + return ARTIFACT_POWER + end +end) \ No newline at end of file diff --git a/src/category/Category.xml b/src/category/Category.xml new file mode 100644 index 0000000..bae5cca --- /dev/null +++ b/src/category/Category.xml @@ -0,0 +1,4 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/category/CategoryManager.lua"/> + <Script file="src/category/ArtifactPower.lua"/> +</Ui> \ No newline at end of file diff --git a/src/category/CategoryManager.lua b/src/category/CategoryManager.lua new file mode 100644 index 0000000..8d8d8c9 --- /dev/null +++ b/src/category/CategoryManager.lua @@ -0,0 +1,47 @@ +local ADDON_NAME, ADDON = ... + +ADDON.categoryManager = {} +local categoryManager = ADDON.categoryManager +categoryManager.__index = categoryManager +categoryManager.filters = {} + +function DJBags_AddCategoryFilter(filter, name) + assert(filter, 'Filter is required') + + if not name then + table.insert(categoryManager.filters, filter) + else + categoryManager.filters[name] = filter + end +end + +function categoryManager:GetTitle(item) + local bag = item:GetParent():GetID() + local slot = item:GetID() + + if item.id then + local isInSet, setName = GetContainerItemEquipmentSetInfo(bag, slot) + + if item.quality == LE_ITEM_QUALITY_POOR then + return BAG_FILTER_JUNK + end + + if isInSet then + return setName + end + + if bag >= 0 and bag <= NUM_BAG_SLOTS and C_NewItems.IsNewItem(bag, slot) then + return NEW + end + + for k, v in pairs(self.filters) do + local output = v(bag, slot) + if output then + return output + end + end + + return item.class + end + return EMPTY +end \ No newline at end of file diff --git a/src/event/Event.xml b/src/event/Event.xml new file mode 100644 index 0000000..a168684 --- /dev/null +++ b/src/event/Event.xml @@ -0,0 +1,4 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/event/EventManager.lua"/> + <Script file="src/event/Events.lua"/> +</Ui> \ No newline at end of file diff --git a/src/event/EventManager.lua b/src/event/EventManager.lua new file mode 100644 index 0000000..af3c1a2 --- /dev/null +++ b/src/event/EventManager.lua @@ -0,0 +1,56 @@ +local ADDON_NAME, ADDON = ... + +local eventManager = CreateFrame('FRAME') +ADDON.eventManager = eventManager +eventManager.events = {} + +eventManager:SetScript('OnEvent', function(self, event, ...) + self:Fire(event, ...) +end) + +function eventManager:Add(event, object) + assert(event, 'Event required') + assert(object, 'Object required') + assert(object[event], 'Object requires event method ' .. event) + + if not self.events[event] then + self.events[event] = {} + self:RegisterEvent(event) + end + + self.events[event][object] = true +end + +function eventManager:Fire(event, ...) + assert(event, 'No event to look for') + -- assert(self.events[event], 'No object registered for event ' .. event) Rather change this to a warning + + if self.events[event] then + for object in pairs(self.events[event]) do + object[event](object, ...) + end + end +end + +local function Count(table) + local cnt = 0; + + for _ in pairs(table) do + cnt = cnt + 1 + end + + return cnt +end + +function eventManager:Remove(event, object) + assert(event, 'Event required') + assert(object, 'Object required') + + self.events[event][object] = nil + + if next(self.events[event]) == nil and Count(self.events[event]) == 0 then + self.events[event] = nil + + self:UnregisterEvent(event) + end +end diff --git a/src/event/Events.lua b/src/event/Events.lua new file mode 100644 index 0000000..4f5c4d9 --- /dev/null +++ b/src/event/Events.lua @@ -0,0 +1,8 @@ +local ADDON_NAME, ADDON = ... + +ADDON.events = {} +local events = ADDON.events +events.__index = events + +-- Cleanup +events.ITEMS_CLEARED = 'EVENT_DJBAGS_ITEMS_CLEARED' \ No newline at end of file diff --git a/src/format/Format.xml b/src/format/Format.xml new file mode 100644 index 0000000..0e87a12 --- /dev/null +++ b/src/format/Format.xml @@ -0,0 +1,3 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/format/Masonry.lua"/> +</Ui> \ No newline at end of file diff --git a/src/format/Masonry.lua b/src/format/Masonry.lua new file mode 100644 index 0000000..ab4ac65 --- /dev/null +++ b/src/format/Masonry.lua @@ -0,0 +1,114 @@ +local ADDON_NAME, ADDON = ... + +ADDON.formatter = ADDON.formatter or {} + +local typeSorter = function(A, B) + if A == EMPTY then + return false + elseif B == EMPTY then + return true + elseif A == NEW then + return true + elseif B == NEW then + return false + elseif A == BAG_FILTER_JUNK then + return true + elseif B == BAG_FILTER_JUNK then + return false + else + return A < B + end +end + +local itemSorter = function(A, B) + if A.type == B.type then + if A.quality == B.quality then + if A.ilevel == B.ilevel then + if A.name == B.name then + return A.count > B.count + end + return A.name < B.name + end + return A.ilevel > B.ilevel + end + return A.quality > B.quality + end + return typeSorter(A.type, B.type) +end + +ADDON.formatter[ADDON.formats.MASONRY] = function(bag) + table.sort(bag.items, itemSorter) + for _, container in pairs(bag.titleContainers) do + container:Hide() + end + local padding = bag.settings.padding + local containerSpacing = bag.settings.containerSpacing + local itemSpacing = bag.settings.itemSpacing + local maxCols = bag.settings.maxColumns + + -- Format the containers + local containers = {} + local cnt, x, y, currentType, container, prevItem + for _, item in pairs(bag.items) do + item:Hide() + if item.type ~= currentType then + currentType = item.type + container = bag.titleContainers[currentType] + cnt = 0 + x = padding + y = padding + padding + container.name:GetHeight() + tinsert(containers, container) + end + + if not (item.type == EMPTY) or cnt == 0 then + item:ClearAllPoints() + item:SetPoint('TOPLEFT', container, 'TOPLEFT', x, -y) + item:Show() + if item.type == EMPTY then + item.count = 1 + end + prevItem = item + + x = x + itemSpacing + item:GetWidth() + cnt = cnt + 1 + if cnt % maxCols == 0 then + x = padding + y = y + itemSpacing + item:GetHeight() + end + else + prevItem:IncrementCount() + end + + local cols = item.type == EMPTY and 1 or math.min(cnt, maxCols) + local rows = item.type == EMPTY and 1 or math.ceil(cnt / maxCols) + local width = padding * 2 + cols * item:GetWidth() + (cols - 1) * itemSpacing + local height = padding * 3 + container.name:GetHeight() + rows * item:GetHeight() + (rows - 1) * itemSpacing + container:SetSize(width, height) + container.cols = cols + end + + x = padding + y = padding + cnt = 0 + local prevHeight = 0 + local mW = 0 + local mH = 0 + for _, container in pairs(containers) do + if cnt + container.cols > maxCols then + y = y + prevHeight + containerSpacing + x = padding + mH = math.max(mH, y + padding - containerSpacing) + cnt = 0 + end + + container:ClearAllPoints() + container:SetPoint('TOPLEFT', x, -y) + container:Show() + + x = x + container:GetWidth() + containerSpacing + mW = math.max(mW, x + padding - containerSpacing) + prevHeight = container:GetHeight() + cnt = cnt + container.cols + end + bag:SetSize(mW, mH + prevHeight + padding) +end \ No newline at end of file diff --git a/src/item/Item.lua b/src/item/Item.lua new file mode 100644 index 0000000..28afc54 --- /dev/null +++ b/src/item/Item.lua @@ -0,0 +1,238 @@ +local ADDON_NAME, ADDON = ... + +local item = {} +item.__index = item + +-- can I mog it config +local itemMogitFunc = nil +if CIMI_AddToFrame then + itemMogitFunc = function(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 + local bag, slot = self:GetParent():GetParent():GetID(), self:GetParent():GetID() + CIMI_SetIcon(self, itemMogitFunc, CanIMogIt:GetTooltipText(nil, bag, slot)) + end +end + +local function InitItem(self, bag, slot) + self:SetID(slot) + + self.quest = _G[self:GetName() .. "IconQuestTexture"] + self.cooldown = _G[self:GetName() .. "Cooldown"] + self.itemLevel = self:CreateFontString(self:GetName() .. 'ItemLevel', 'ARTWORK', 'NumberFontNormal') + self.itemLevel:SetPoint('BOTTOMRIGHT', 2, 2) + + if MSQ then + local myGroup = MSQ:Group(ADDON_NAME) + myGroup:AddButton(self, { + Button = self, + Border = self.IconBorder, + Icon = self.icon or _G[self:GetName() .. "IconTexture"], + }) + end + + self:HookScript('OnClick', self.OnClick) + + -- hook into can i mog it + if CIMI_AddToFrame then + CIMI_AddToFrame(self, itemMogitFunc) + end +end + +function ADDON:NewItem(parent, slot) + local bag = parent:GetID() + assert(bag and type(bag) == 'number', 'Parent is required to be a bag with ID set the bag number') + assert(slot and type(slot) == 'number', 'Slot required as integer value') + + local object = CreateFrame('Button', string.format('DJBagsItem_%d_%d', bag, slot), parent, + bag == BANK_CONTAINER and 'BankItemButtonGenericTemplate' or + bag == REAGENTBANK_CONTAINER and 'ReagentBankItemButtonGenericTemplate' or + 'ContainerFrameItemButtonTemplate') + + for k, v in pairs(item) do + object[k] = v + end + + InitItem(object, bag, slot) + + return object +end + +function item:OnClick(button) + if self.id then + end +end + +local function UpdateQuest(self, isQuestItem, questId, isActive) + if (questId and not isActive) then + self.quest:SetTexture(TEXTURE_ITEM_QUEST_BANG) + self.quest:Show() + elseif (questId or isQuestItem) then + self.quest:SetTexture(TEXTURE_ITEM_QUEST_BORDER) + self.quest:Show() + else + self.quest:Hide() + end +end + +local function UpdateNewItemAnimations(self, isNewItem, isBattlePayItem, quality) + if (isNewItem) then + if (isBattlePayItem) then + self.NewItemTexture:Hide() + self.BattlepayItemTexture:Show() + else + if (quality and NEW_ITEM_ATLAS_BY_QUALITY[quality]) then + self.NewItemTexture:SetAtlas(NEW_ITEM_ATLAS_BY_QUALITY[quality]); + else + self.NewItemTexture:SetAtlas("bags-glow-white"); + end + self.BattlepayItemTexture:Hide(); + self.NewItemTexture:Show(); + end + if (not self.flashAnim:IsPlaying() and not self.newitemglowAnim:IsPlaying()) then + self.flashAnim:Play(); + self.newitemglowAnim:Play(); + end + else + self.BattlepayItemTexture:Hide(); + self.NewItemTexture:Hide(); + if (self.flashAnim:IsPlaying() or self.newitemglowAnim:IsPlaying()) then + self.flashAnim:Stop(); + self.newitemglowAnim:Stop(); + end + end +end + +local function UpdateFiltered(self, filtered, shouldDoRelicChecks, itemID) + if (filtered) then + self.searchOverlay:Show(); + else + self.searchOverlay:Hide(); + if shouldDoRelicChecks then + ContainerFrame_ConsiderItemButtonForRelicTutorial(self, itemID); + end + end +end + +local function UpdateILevel(self, equipable, quality, level) + if equipable then + if quality and quality >= LE_ITEM_QUALITY_COMMON then + self.itemLevel:SetVertexColor(BAG_ITEM_QUALITY_COLORS[quality].r, BAG_ITEM_QUALITY_COLORS[quality].g, BAG_ITEM_QUALITY_COLORS[quality].b) + else + self.itemLevel:SetVertexColor(1, 1, 1, 1) + end + self.itemLevel:SetText(level) + self.itemLevel:Show() + else + self.itemLevel:Hide() + end +end + +local function UpdateCooldown(self) + if not GetContainerItemID(self:GetParent():GetID(), self:GetID()) then + self.cooldown:Hide() + return + end + + local start, duration, enable = GetContainerItemCooldown(self:GetParent():GetID(), self:GetID()); + CooldownFrame_Set(self.cooldown, start, duration, enable); + if (duration > 0 and enable == 0) then + SetItemButtonTextureVertexColor(self, 0.4, 0.4, 0.4); + else + SetItemButtonTextureVertexColor(self, 1, 1, 1); + end +end + +function item:Update() + local texture, count, locked, quality, _, _, link, filtered, _, id = GetContainerItemInfo(self:GetParent():GetID(), self:GetID()) + local equipable = IsEquippableItem(id) + + local name, level, classId, class, subClass + if id then + name, _, _, level, _, class, subClass, _, _, _, _, classId = GetItemInfo(id) + end + local isEquipment = equipable or classId == LE_ITEM_CLASS_ARMOR or classId == LE_ITEM_CLASS_WEAPON + local bag = self:GetParent():GetID() + + self.id = id + self.name = name or '' + self.quality = quality or 0 + self.ilevel = level or 0 + self.link = link + self.classId = classId + self.class = class + self.subClass = subClass + self.count = id and (count or 1) or (self.count or 1) + self.hasItem = nil + + if isEquipment then + level = DJBagsTooltip:GetItemLevel(bag, self:GetID()) or level + elseif classId == LE_ITEM_CLASS_CONTAINER then + -- TODO set count to number of slots + end + + UpdateILevel(self, equipable, quality, level) + if bag == BANK_CONTAINER or bag == REAGENTBANK_CONTAINER then + BankFrameItemButton_Update(self) + else + local isQuestItem, questId, isActive = GetContainerItemQuestInfo(bag, self:GetID()) + local isNewItem = C_NewItems.IsNewItem(bag, self:GetID()) + local isBattlePayItem = IsBattlePayItem(bag, self:GetID()) + local shouldDoRelicChecks = not BagHelpBox:IsShown() and not GetCVarBitfield("closedInfoFrames", LE_FRAME_TUTORIAL_ARTIFACT_RELIC_MATCH) + + self.hasItem = true + + if quality and MSQ then + if quality >= LE_ITEM_QUALITY_COMMON and BAG_ITEM_QUALITY_COLORS[quality] then + self.IconBorder:Show(); + self.IconBorder:SetVertexColor(BAG_ITEM_QUALITY_COLORS[quality].r, BAG_ITEM_QUALITY_COLORS[quality].g, BAG_ITEM_QUALITY_COLORS[quality].b); + else + self.IconBorder:Hide(); + end + else + self.IconBorder:Hide(); + end + + SetItemButtonTexture(self, texture) + SetItemButtonQuality(self, quality, id) + SetItemButtonCount(self, count) + SetItemButtonDesaturated(self, locked) + UpdateQuest(self, isQuestItem, questId, isActive) + UpdateNewItemAnimations(self, isNewItem, isBattlePayItem, quality) + UpdateFiltered(self, filtered, shouldDoRelicChecks, id) + UpdateCooldown(self) + end +end + +function item:UpdateCooldown() + UpdateCooldown(self) +end + +function item:UpdateSearch() + local _, _, _, _, _, _, _, filtered, _, id = GetContainerItemInfo(self:GetParent():GetID(), self:GetID()) + local shouldDoRelicChecks = not BagHelpBox:IsShown() and not GetCVarBitfield("closedInfoFrames", LE_FRAME_TUTORIAL_ARTIFACT_RELIC_MATCH) + self:SetFiltered(filtered, shouldDoRelicChecks) +end + +function item:UpdateLock(locked) + local locked = locked or select(3, GetContainerItemInfo(self:GetParent():GetID(), self:GetID())) + SetItemButtonDesaturated(self, locked); +end + +function item:SetFiltered(filtered, shouldDoRelicChecks) + UpdateFiltered(self, filtered, shouldDoRelicChecks, self.id) +end + +function item:IncrementCount(count) + if self.count == 0 then + self.count = 1 + end + count = count == 0 and 1 or count or 1 + + self.count = self.count + count + SetItemButtonCount(self, self.count) +end \ No newline at end of file diff --git a/src/item/Item.xml b/src/item/Item.xml new file mode 100644 index 0000000..10e973c --- /dev/null +++ b/src/item/Item.xml @@ -0,0 +1,3 @@ +<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> + <Script file="src/item/Item.lua"/> +</Ui> \ No newline at end of file diff --git a/src/lua/cache/cache.lua b/src/lua/cache/cache.lua deleted file mode 100644 index 427e277..0000000 --- a/src/lua/cache/cache.lua +++ /dev/null @@ -1,32 +0,0 @@ -local NAME, ADDON = ... - -ADDON.cache = {} -ADDON.cache.__index = ADDON.cache - -local cache = ADDON.cache -cache.items = {} -cache.bagContainers = {} -cache.bankContainers = {} -cache.reagentContainers = {} - -function cache:GetItem(bag, slot) - self.items[bag] = self.items[bag] or {} - self.items[bag][slot] = self.items[bag][slot] or ADDON:NewItem(bag, slot) - return self.items[bag][slot] -end - -function cache:GetItemContainer(bag, name) - if bag == BANK_CONTAINER or bag > NUM_BAG_SLOTS then - self.bankContainers[name] = self.bankContainers[name] or ADDON:NewItemContainer(name) - DJBagsBankContainer:AddItem(self.bankContainers[name]) - return self.bankContainers[name] - elseif bag == REAGENTBANK_CONTAINER then - self.reagentContainers[name] = self.reagentContainers[name] or ADDON:NewItemContainer(name) - DJBagsReagentContainer:AddItem(self.reagentContainers[name]) - return self.reagentContainers[name] - else - self.bagContainers[name] = self.bagContainers[name] or ADDON:NewItemContainer(name) - DJBagsBagContainer:AddItem(self.bagContainers[name]) - return self.bagContainers[name] - end -end \ No newline at end of file diff --git a/src/lua/constants/contstants.lua b/src/lua/constants/contstants.lua deleted file mode 100644 index 2c8e570..0000000 --- a/src/lua/constants/contstants.lua +++ /dev/null @@ -1,149 +0,0 @@ -local NAME, ADDON = ... - ---region Types - -DJBags_TYPE_CONTAINER = 'container' -DJBags_TYPE_ITEM_CONTAINER = 'itemContainer' -DJBags_TYPE_SUB_CLASS = 'djbags_sub_classes' -DJBags_TYPE_MAIN = 'djbags_main_settings' -DJBags_TYPE_MAIN_BAR = 'djbags_main_bar' -DJBags_TYPE_BANK_BAR = 'djbags_bank_bar' - -DJBags_FORMATTER_MASONRY = 1 -DJBags_FORMATTER_BOX = 2 - ---endregion - ---region Settings - -DJBags_SETTING_BACKGROUND_COLOR = 'djbags_background_color' -DJBags_SETTING_BORDER_COLOR = 'djbags_border_color' -DJBags_SETTING_TEXT_COLOR = 'djbags_text_color' -DJBags_SETTING_PADDING = 'djbags_padding' -DJBags_SETTING_SPACING = 'djbags_spacing' -DJBags_SETTING_SCALE = 'djbags_scale' -DJBags_SETTING_CLEAR_NEW_ITEMS = 'djbags_clear_new_items' -DJBags_SETTING_FORMATTER = 'djbags_formatter' -DJBags_SETTING_FORMATTER_VERT = 'djbags_formatter_vert' -DJBags_SETTING_FORMATTER_MAX_ITEMS = 'djbags_formatter_max_items' -DJBags_SETTING_FORMATTER_MAX_HEIGHT = 'djbags_formatter_max_height' -DJBags_SETTING_FORMATTER_BOX_COLS = 'djbags_formatter_box_cols' -DJBags_SETTING_TRUNCATE_SUB_CLASS = 'djbags_truncate_sub_class' -DJBags_SETTING_TEXT_SIZE = 'djbags_truncate_text_size' -DJBags_SETTING_STACK_ALL = 'djbags_stack_all_items' -DJBags_SETTING_SELL_JUNK = 'djbags_auto_sell_junk' -DJBags_SETTING_DEPOSIT_REAGENT = 'djbags_auto_deposit_reagents' -DJBags_SETTING_BOE = 'djbags_class_boe' -DJBags_SETTING_BOA = 'djbags_class_boa' - ---endregion - ---region Locale - -local localeText= {} -localeText['enUS'] = function() - DJBags_LOCALE_MAIN_SETTINGS = 'Main Settings:' - DJBags_LOCALE_ITEM_CONTAINER_SETTINGS = 'Item Container Settings:' - DJBags_LOCALE_CONTAINER_SETTINGS = 'Category Container Settings:' - DJBags_LOCALE_SUB_CLASS_SETTINGS = 'Sub Class Settings:' - DJBags_LOCALE_MAIN_BAR_SETTINGS = 'Main Bar Settings:' - DJBags_LOCALE_BANK_BAR_SETTINGS = 'Bank Bar Settings:' - DJBags_LOCALE_FORMAT_SETTINGS = 'Format Settings:' - DJBags_LOCALE_SETTINGS = 'DJBags Settings:' - DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items' - DJBags_LOCALE_BACKGROUND_COLOR = 'Background color' - DJBags_LOCALE_BORDER_COLOR = 'Border color' - DJBags_LOCALE_TEXT_COLOR = 'Text color' - DJBags_LOCALE_PADDING = 'Padding' - DJBags_LOCALE_SPACING = 'Spacing' - DJBags_LOCALE_SCALE = 'Scale' - DJBags_LOCALE_TEXT_SIZE = 'Text size' - DJBags_LOCALE_STACK_ALL = 'Stack all items' - DJBags_LOCALE_SELL_JUNK = 'Auto sell junk' - DJBags_LOCALE_DEPOSIT_REAGENT = 'Auto deposit reagents' - DJBags_LOCALE_MASONRY = 'Masonry' - DJBags_LOCALE_BOX = 'Box' - DJBags_LOCALE_CATEGORY_DIALOG_TITLE = 'Set category for: %s' - DJBags_LOCALE_GLOBAL = 'Global' - DJBags_LOCALE_BOE = 'BoE' - DJBags_LOCALE_BOA = 'BoA' - DJBags_LOCALE_VERTICAL = 'Vertical' - DJBags_LOCALE_MAX_ITEMS = 'Max items' - DJBags_LOCALE_MAX_HEIGHT = 'Max height' - DJBags_LOCALE_SOLD_JUNK = 'Sold junk for: %s' - DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' -end - -localeText['deDE'] = function() - DJBags_LOCALE_MAIN_SETTINGS = 'Allgemein:' - DJBags_LOCALE_ITEM_CONTAINER_SETTINGS = 'Gegenstandsbehälter:' - DJBags_LOCALE_CONTAINER_SETTINGS = 'Kategoriebehälter:' - DJBags_LOCALE_SUB_CLASS_SETTINGS = 'Untergliederung:' - DJBags_LOCALE_MAIN_BAR_SETTINGS = 'Hauptleiste:' - DJBags_LOCALE_BANK_BAR_SETTINGS = 'Bankleiste:' - DJBags_LOCALE_FORMAT_SETTINGS = 'Format:' - DJBags_LOCALE_SETTINGS = 'DJBags-Einstellungen:' - DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Neue Gegenstände leeren' - DJBags_LOCALE_BACKGROUND_COLOR = 'Hintergrundfarbe' - DJBags_LOCALE_BORDER_COLOR = 'Rahmenfarbe' - DJBags_LOCALE_TEXT_COLOR = 'Schriftfarbe' - DJBags_LOCALE_PADDING = 'Einrückung' - DJBags_LOCALE_SPACING = 'Abstand' - DJBags_LOCALE_SCALE = 'Skalierung' - DJBags_LOCALE_TEXT_SIZE = 'Schriftgröße' - DJBags_LOCALE_STACK_ALL = 'Alle Gegenstände stapeln' - DJBags_LOCALE_SELL_JUNK = 'Schrott autom. verkaufen' - DJBags_LOCALE_DEPOSIT_REAGENT = 'Material automatisch einlagern' - DJBags_LOCALE_MASONRY = 'Mauerwerk' - DJBags_LOCALE_BOX = 'Kiste' - DJBags_LOCALE_CATEGORY_DIALOG_TITLE = 'Kategorie festlegen für: %s' - DJBags_LOCALE_GLOBAL = 'Global' - DJBags_LOCALE_BOE = 'Beim Anlegen gebunden' - DJBags_LOCALE_BOA = 'Battle.net-Accountgebunden' - DJBags_LOCALE_VERTICAL = 'Vertikal' - DJBags_LOCALE_MAX_ITEMS = 'Max. Gegenstände' - DJBags_LOCALE_MAX_HEIGHT = 'Max. Höhe' - DJBags_LOCALE_SOLD_JUNK = 'Schrott verkauft für: %s' - DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' -end - -localeText['zhTW'] = function() - DJBags_LOCALE_MAIN_SETTINGS = '主設定:' - DJBags_LOCALE_ITEM_CONTAINER_SETTINGS = '分類外觀設定:' - DJBags_LOCALE_CONTAINER_SETTINGS = '背包外觀設定:' - DJBags_LOCALE_SUB_CLASS_SETTINGS = '子分類設定:' - DJBags_LOCALE_MAIN_BAR_SETTINGS = '主要功能列設定:' - DJBags_LOCALE_BANK_BAR_SETTINGS = '銀行功能列設定:' - DJBags_LOCALE_FORMAT_SETTINGS = '排列方式設定:' - DJBags_LOCALE_SETTINGS = 'DJBags 背包設定:' - DJBags_LOCALE_CLEAR_NEW_ITEMS = '清理新物品' - DJBags_LOCALE_BACKGROUND_COLOR = '背景顏色' - DJBags_LOCALE_BORDER_COLOR = '邊框顏色' - DJBags_LOCALE_TEXT_COLOR = '文字顏色' - DJBags_LOCALE_PADDING = '內距' - DJBags_LOCALE_SPACING = '間距' - DJBags_LOCALE_SCALE = '縮放大小' - DJBags_LOCALE_TEXT_SIZE = '文字大小' - DJBags_LOCALE_STACK_ALL = '堆疊所有物品' - DJBags_LOCALE_SELL_JUNK = '自動賣垃圾' - DJBags_LOCALE_DEPOSIT_REAGENT = '自動存放材料' - DJBags_LOCALE_MASONRY = '磚牆' - DJBags_LOCALE_BOX = '方盒' - DJBags_LOCALE_CATEGORY_DIALOG_TITLE = '設定分類: %s' - DJBags_LOCALE_GLOBAL = '全部' - DJBags_LOCALE_BOE = '裝備綁定' - DJBags_LOCALE_BOA = '帳號綁定' - DJBags_LOCALE_VERTICAL = '垂直' - DJBags_LOCALE_MAX_ITEMS = '分類寬度最多物品數目' - DJBags_LOCALE_MAX_HEIGHT = '最大高度' - DJBags_LOCALE_SOLD_JUNK = '賣出垃圾獲得: %s' - DJBags_LOCALE_CLEAR_NEW_ITEMS = 'Clear new items on close' -end - -if localeText[GetLocale()] then - localeText[GetLocale()]() -else - localeText['enUS']() -end - ---endregion diff --git a/src/lua/controller/bag.lua b/src/lua/controller/bag.lua deleted file mode 100644 index 6ad4fe3..0000000 --- a/src/lua/controller/bag.lua +++ /dev/null @@ -1,172 +0,0 @@ -local NAME, ADDON = ... - -ADDON.bagController = {} -ADDON.bagController.__index = ADDON.bagController - -local controller = ADDON.bagController - -function controller:Init() - ADDON.events:Add('MERCHANT_SHOW', self) -end - -function DJBagsBagContainer_OnShow() - DJBagsBagContainer.mainBar:Show() - ADDON.events:Add('INVENTORY_SEARCH_UPDATE', controller) - ADDON.events:Add('BAG_UPDATE', controller) - ADDON.events:Add('BAG_UPDATE_COOLDOWN', controller) - ADDON.events:Add('ITEM_LOCK_CHANGED', controller) - ADDON.events:Add('BAG_UPDATE_DELAYED', controller) - ADDON.events:Add('DJBAGS_BAG_HOVER', controller) -end - -function DJBagsBagContainer_OnHide() - ADDON.events:Remove('INVENTORY_SEARCH_UPDATE', controller) - ADDON.events:Remove('BAG_UPDATE', controller) - ADDON.events:Remove('BAG_UPDATE_COOLDOWN', controller) - ADDON.events:Remove('ITEM_LOCK_CHANGED', controller) - ADDON.events:Remove('BAG_UPDATE_DELAYED', controller) - ADDON.events:Remove('DJBAGS_BAG_HOVER', controller) - - if ADDON.settings:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_CLEAR_NEW_ITEMS] then - C_NewItems:ClearAll() - end -end - -function DJDBagsBagsButton_OnClick(self) - if self:GetChecked() then - controller:ShowBagBar() - else - controller:HideBagBar() - end -end - -function controller:Update() - ADDON:UpdateBags({0, 1, 2, 3, 4}) - DJBagsBagContainer:Arrange() -end - -function controller:Toggle() - if DJBagsBagContainer:IsVisible() then - self:Close() - else - self:Open() - end -end - -function controller:Open() - self:Update() - DJBagsBagContainer:Show() -end - -function controller:Close() - DJBagsBagContainer:Hide() -end - -function controller:OnItemsCleared() - if DJBagsBagContainer:IsVisible() then - self:Update() - end -end - -function controller:BAG_UPDATE(bag) - ADDON:UpdateBags({bag}) - DJBagsBagContainer:Arrange() -end - -function controller:MERCHANT_SHOW() - if ADDON.settings:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_SELL_JUNK] then - local price = 0 - for bag = 0, NUM_BAG_SLOTS do - for slot = 1 , GetContainerNumSlots(bag) do - if select(4, GetContainerItemInfo(bag, slot)) == LE_ITEM_QUALITY_POOR then - ShowMerchantSellCursor(1) - UseContainerItem(bag, slot) - price = price + select(11, GetItemInfo(GetContainerItemID(bag, slot))) - end - end - end - ResetCursor() - if price ~= 0 then - DEFAULT_CHAT_FRAME:AddMessage(string.format(DJBags_LOCALE_SOLD_JUNK, GetCoinTextureString(price))) - end - end -end - -function controller:INVENTORY_SEARCH_UPDATE() - for bag = 0, NUM_BAG_SLOTS do - for slot = 1, GetContainerNumSlots(bag) do - ADDON.cache:GetItem(bag, slot):UpdateSearch() - end - end -end - -function controller:BAG_UPDATE_COOLDOWN() - for bag = 0, NUM_BAG_SLOTS do - for slot = 1, GetContainerNumSlots(bag) do - ADDON.cache:GetItem(bag, slot):UpdateCooldown() - end - end -end - -function controller:ITEM_LOCK_CHANGED(bag, slot) - if bag then - if bag >= 0 and bag <= NUM_BAG_SLOTS and slot then - ADDON.cache:GetItem(bag, slot):UpdateLock() - end - if DJBagsBagContainer.mainBar.bagBar and DJBagsBagContainer.mainBar.bagBar.bags[bag] then - DJBagsBagContainer.mainBar.bagBar.bags[bag]:UpdateLock() - end - end -end - -function controller:DJBAGS_BAG_HOVER(bag, locked) - if bag and bag >= 0 and bag <= NUM_BAG_SLOTS then - for bagSlot = 0, NUM_BAG_SLOTS do - if bagSlot ~= bag then - for slot = 1, GetContainerNumSlots(bagSlot) do - ADDON.cache:GetItem(bagSlot, slot):SetFiltered(locked) - end - end - end - end -end - -function controller:BAG_UPDATE_DELAYED() - if DJBagsBagContainer.mainBar.bagBar then - for _, bagItem in pairs(DJBagsBagContainer.mainBar.bagBar.bags) do - bagItem:Update() - end - end -end - -function controller:ShowBagBar() - self:GetBagBar():Show() -end - -function controller:HideBagBar() - self:GetBagBar():Hide() -end - -function controller:GetBagBar() - if not DJBagsBagContainer.mainBar.bagBar then - local bagBar = CreateFrame('Frame', 'DJBagsBagBar', DJBagsBagContainer.mainBar, 'DJBagsContainerTemplate') - bagBar.bags = {} - - local prevBag - for bag = 1, NUM_BAG_SLOTS do - local bagItem = ADDON:NewBagItem('DJBagsBag_' .. bag, bag, GetInventorySlotInfo("Bag" .. (bag-1) .. "Slot")) - bagItem:SetParent(bagBar.container) - bagItem:SetPoint('TOPRIGHT', prevBag or bagBar.container, prevBag and 'TOPLEFT' or 'TOPRIGHT', prevBag and -5 or 0, 0) - bagItem:Update() - bagItem:Show() - prevBag = bagItem - bagBar.bags[bagItem:GetID()] = bagItem - end - - bagBar:SetSize((prevBag:GetWidth() + 5) * NUM_BAG_SLOTS - 5 + bagBar.padding * 2, prevBag:GetHeight() + bagBar.padding * 2) - bagBar:SetPoint('TOPRIGHT', DJBagsBagContainer.mainBar, 'BOTTOMRIGHT', 0, -5) - - DJBagsBagContainer.mainBar.bagBar = bagBar - end - return DJBagsBagContainer.mainBar.bagBar -end \ No newline at end of file diff --git a/src/lua/controller/bank.lua b/src/lua/controller/bank.lua deleted file mode 100644 index bc72f52..0000000 --- a/src/lua/controller/bank.lua +++ /dev/null @@ -1,183 +0,0 @@ -local NAME, ADDON = ... - -ADDON.bankController = {} -ADDON.bankController.__index = ADDON.bankController - -local controller = ADDON.bankController - - -function controller:Init() - ADDON.events:Add('BANKFRAME_OPENED', self) - ADDON.events:Add('BANKFRAME_CLOSED', self) - BankFrame:UnregisterAllEvents() - BankFrame:SetScript('OnShow', nil) -end - -function DJBagsBankBar_OnShow(self) - BankFrame:Show() - BankFrame.selectedTab = 1 - PanelTemplates_SetTab(self, 1) - DJBagsBankContainer:Show() - DJBagsReagentContainer:Hide() - self:Update() - controller:Register() - controller:Update() - controller:DepositReagents() -end - -function DJBagsBankBar_OnHide(self) - BankFrame:Hide() - controller:UnRegister() - CloseBankFrame() - StaticPopup_Hide("CONFIRM_BUY_BANK_SLOT"); -end - -function DJBagsBankTab_OnClick(tab) - PlaySound("igMainMenuOpen") - PanelTemplates_SetTab(DJBagsBankBar, tab.tab) - if tab.tab == 1 then - DJBagsBankContainer:Show() - DJBagsReagentContainer:Hide() - BankFrame.selectedTab = 1 - else - DJBagsBankContainer:Hide() - DJBagsReagentContainer:Show() - BankFrame.selectedTab = 2 - end -end - -function controller:DepositReagents() - if ADDON.settings:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_DEPOSIT_REAGENT] then - PlaySound("igMainMenuOption"); - DepositReagentBank(); - end -end - -function controller:Update() - ADDON:UpdateBags({-1, 5, 6, 7, 8, 9, 10, 11, -3}) - DJBagsBankContainer:Arrange() - self:ArrangeReagents() -end - -function controller:OnItemsCleared() - if DJBagsBankBar:IsVisible() then - self:Update() - end -end - -function controller:ArrangeReagents() - if IsReagentBankUnlocked() then - DJBagsReagentContainer.reagentButton:Hide() - DJBagsReagentContainer:Arrange() - else - DJBagsReagentContainer:SetSize(110, 35) - DJBagsReagentContainer.reagentButton:Show() - end -end - -function controller:BANKFRAME_OPENED() - DJBagsBankBar:Show() -end - -function controller:BANKFRAME_CLOSED() - DJBagsBankBar:Hide() -end - -function controller:Register() - ADDON.events:Add('PLAYERBANKSLOTS_CHANGED', self) - ADDON.events:Add('BAG_UPDATE', self) - ADDON.events:Add('INVENTORY_SEARCH_UPDATE', self) - ADDON.events:Add('BAG_UPDATE_COOLDOWN', self) - ADDON.events:Add('ITEM_LOCK_CHANGED', self) - ADDON.events:Add('PLAYERREAGENTBANKSLOTS_CHANGED', self) - ADDON.events:Add('PLAYERBANKBAGSLOTS_CHANGED', self) - ADDON.events:Add('REAGENTBANK_PURCHASED', self) - ADDON.events:Add('BAG_UPDATE_DELAYED', self) -end - -function controller:UnRegister() - ADDON.events:Remove('PLAYERBANKSLOTS_CHANGED', self) - ADDON.events:Remove('BAG_UPDATE', self) - ADDON.events:Remove('INVENTORY_SEARCH_UPDATE', self) - ADDON.events:Remove('BAG_UPDATE_COOLDOWN', self) - ADDON.events:Remove('ITEM_LOCK_CHANGED', self) - ADDON.events:Remove('PLAYERREAGENTBANKSLOTS_CHANGED', self) - ADDON.events:Remove('PLAYERBANKBAGSLOTS_CHANGED', self) - ADDON.events:Remove('REAGENTBANK_PURCHASED', self) - ADDON.events:Remove('BAG_UPDATE_DELAYED', self) -end - -function controller:PLAYERBANKSLOTS_CHANGED() - ADDON:UpdateBags({BANK_CONTAINER}) - DJBagsBankContainer:Arrange() -end - -function controller:BAG_UPDATE(bag) - if bag > NUM_BAG_SLOTS then - ADDON:UpdateBags({bag}) - DJBagsBankContainer:Arrange() - end -end - -function controller:INVENTORY_SEARCH_UPDATE() - local function updateSearch(bag) - for slot = 1, GetContainerNumSlots(bag) do - ADDON.cache:GetItem(bag, slot):UpdateSearch() - end - end - - updateSearch(-3) - updateSearch(-1) - updateSearch(5) - updateSearch(6) - updateSearch(7) - updateSearch(8) - updateSearch(9) - updateSearch(10) - updateSearch(11) -end - -function controller:BAG_UPDATE_COOLDOWN() - local function updateCooldown(bag) - for slot = 1, GetContainerNumSlots(bag) do - ADDON.cache:GetItem(bag, slot):UpdateCooldown() - end - end - - updateCooldown(-3) - updateCooldown(-1) - updateCooldown(5) - updateCooldown(6) - updateCooldown(7) - updateCooldown(8) - updateCooldown(9) - updateCooldown(10) - updateCooldown(11) -end - -function controller:ITEM_LOCK_CHANGED(bag, slot) - if (bag ~= BANK_CONTAINER and bag ~= REAGENTBANK_CONTAINER and bag <= NUM_BAG_SLOTS) or not slot then return end - - if bag == BANK_CONTAINER and slot > NUM_BANKGENERIC_SLOTS then - _G[DJBagsBankBar:GetName() .. 'Bag' .. slot-NUM_BANKGENERIC_SLOTS]:UpdateLock() - else - ADDON.cache:GetItem(bag, slot):UpdateLock() - end -end - -function controller:PLAYERREAGENTBANKSLOTS_CHANGED() - ADDON:UpdateBags({REAGENTBANK_CONTAINER}) - self:ArrangeReagents() -end - -function controller:PLAYERBANKBAGSLOTS_CHANGED() - DJBagsBankBar:Update() -end - -function controller:REAGENTBANK_PURCHASED() - self:PLAYERREAGENTBANKSLOTS_CHANGED() -end - -function controller:BAG_UPDATE_DELAYED() - DJBagsBankBar:Update() -end \ No newline at end of file diff --git a/src/lua/core.lua b/src/lua/core.lua deleted file mode 100644 index f421a5e..0000000 --- a/src/lua/core.lua +++ /dev/null @@ -1,64 +0,0 @@ -local NAME, ADDON = ... - -local core = {} - -function core:ADDON_LOADED(name) - if name ~= NAME then return end - - ADDON.settings:Init() - ADDON.bagController:Init() - ADDON.bankController:Init() - - ADDON.events:Remove('ADDON_LOADED', self) -end - -ADDON.events:Add('ADDON_LOADED', core) - ---region Bag commands - -function DJBags_ItemsCleared() - ADDON.bagController:OnItemsCleared() - ADDON.bankController:OnItemsCleared() -end - -ToggleAllBags = function() - ADDON.bagController:Toggle() -end - -ToggleBag = function(id) - if id < 5 and id > -1 then - ADDON.bagController:Toggle() - end -end - -ToggleBackpack = function() - ADDON.bagController:Toggle() -end - -OpenAllBags = function() - ADDON.bagController:Open() -end - -OpenBackpack = function() - ADDON.bagController:Open() -end - -CloseAllBags = function() - ADDON.bagController:Close() -end - -CloseBackpack = function() - ADDON.bagController:Close() -end - ---endregion - -SLASH_DJBAGS1, SLASH_DJBAGS2, SLASH_DJBAGS3, SLASH_DJBAGS4 = '/djb', '/dj', '/djbags', '/db'; -function SlashCmdList.DJBAGS(msg, editbox) - DJBagsSettingsContainer:Show() -end - -SLASH_RL1 = '/rl'; -function SlashCmdList.RL(msg, editbox) - ReloadUI() -end \ No newline at end of file diff --git a/src/lua/element/bagItem.lua b/src/lua/element/bagItem.lua deleted file mode 100644 index 6fec9a1..0000000 --- a/src/lua/element/bagItem.lua +++ /dev/null @@ -1,108 +0,0 @@ -local NAME, ADDON = ... - -local item = {} - -function ADDON:NewBagItem(name, slot, id) - local frame = CreateFrame('Button', name, UIParent, 'ItemButtonTemplate') - - ADDON:CreateAddon(frame, item, id, slot) - - return frame -end - -function DJBagsBagItemLoad(button, slot, id) - ADDON:CreateAddon(button, item, id, slot) -end - -function item:Init(id, slot) - self:SetID(id) - self.slot = slot - - self:SetScript('OnDragStart', self.DragItem) - self:SetScript('OnReceiveDrag', self.PlaceOrPickup) - self:SetScript('OnClick', function (self, ...) - if self.buy then - PlaySound("igMainMenuOption"); - StaticPopup_Show("CONFIRM_BUY_BANK_SLOT"); - else - self:PlaceOrPickup(...) - end - end) - self:SetScript('OnEnter', self.OnEnter) - self:SetScript('OnLeave', self.OnLeave) -end - -function item:Update() - local numBankSlots, full = GetNumBankSlots() - if self.slot - NUM_BAG_SLOTS > numBankSlots then - local cost = GetBankSlotCost(self.slot-1) - self:SetCost(cost) - return - end - PaperDollItemSlotButton_Update(self) - local slotcount = GetContainerNumSlots(self.slot) - if slotcount > 0 then - self.Count:SetText(tostring(slotcount)) - self.Count:Show() - else - self.Count:Hide() - end - self.buy = nil -end - -function item:UpdateLock() - PaperDollItemSlotButton_UpdateLock(self) -end - -function item:PlaceOrPickup() - local placed = PutItemInBag(self:GetID()) - if not placed then - PickupBagFromSlot(self:GetID()) - end -end - -function item:OnEnter() - if self:GetRight() >= (GetScreenWidth() / 2) then - GameTooltip:SetOwner(self, 'ANCHOR_LEFT') - else - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') - end - - local hasItem, hasCooldown, repairCost, speciesID, level, breedQuality, maxHealth, power, speed, name = GameTooltip:SetInventoryItem("player", self:GetID()); - if(speciesID and speciesID > 0) then - BattlePetToolTip_Show(speciesID, level, breedQuality, maxHealth, power, speed, name); - CursorUpdate(self); - return; - end - - if (not IsInventoryItemProfessionBag("player", self:GetID())) then - for i = LE_BAG_FILTER_FLAG_EQUIPMENT, NUM_LE_BAG_FILTER_FLAGS do - if ( GetBankBagSlotFlag(self:GetID(), i) ) then - GameTooltip:AddLine(BAG_FILTER_ASSIGNED_TO:format(BAG_FILTER_LABELS[i])); - break; - end - end - end - - GameTooltip:Show(); - CursorUpdate(self); - - ADDON.events:Fire('DJBAGS_BAG_HOVER', self.slot, true) -end - -function item:SetCost(cost) - if cost > -1 then - self.IconBorder:Show() - self.IconBorder:SetVertexColor(1, 0, 0, 1) - self.Count:Show() - self.Count:SetText(cost/10000 .. "|TInterface\\MoneyFrame\\UI-GoldIcon:12:12:2:0|t") - self.buy = true - end -end - -function item:OnLeave() - GameTooltip_Hide(); - ResetCursor(); - - ADDON.events:Fire('DJBAGS_BAG_HOVER', self.slot, false) -end \ No newline at end of file diff --git a/src/lua/element/bankBar.lua b/src/lua/element/bankBar.lua deleted file mode 100644 index d279fd0..0000000 --- a/src/lua/element/bankBar.lua +++ /dev/null @@ -1,41 +0,0 @@ -local NAME, ADDON = ... - -local container = {} - -function DJBagsBankBarLoad(self) - ADDON:CreateAddon(self, container) -end - -function container:Init() - self.__type = DJBags_TYPE_BANK_BAR - - table.insert(UISpecialFrames, self:GetName()) - self:RegisterForDrag("LeftButton") - self:SetScript("OnDragStart", self.StartMoving) - self:SetScript("OnDragStop", self.StopMovingOrSizing) - - self:SetColors( - {0, 0, 0, 0.6}, - {0.3, 0.3, 0.3, 1} - ) -end - -function container:Update() - for i = 1, 7 do - _G[self:GetName() .. 'Bag' .. i]:Update() - end -end - -function container:UpdateFromSettings() - local settings = ADDON.settings:GetSettings(self.__type) - - self:SetColors( - settings[DJBags_SETTING_BACKGROUND_COLOR], - settings[DJBags_SETTING_BORDER_COLOR] - ) -end - -function container:SetColors(background, border) - self:SetBackdropColor(unpack(background)) - self:SetBackdropBorderColor(unpack(border)) -end diff --git a/src/lua/element/container.lua b/src/lua/element/container.lua deleted file mode 100644 index ce9e008..0000000 --- a/src/lua/element/container.lua +++ /dev/null @@ -1,89 +0,0 @@ -local NAME, ADDON = ... - - -local container = {} - -function DJBagsContainerLoad(self) - ADDON:CreateAddon(self, container) -end - -function container:Init() - self.__type = DJBags_TYPE_CONTAINER - - table.insert(UISpecialFrames, self:GetName()) - self:RegisterForDrag("LeftButton") - self:SetScript("OnDragStart", function(self, ...) - if self:GetParent() == UIParent then - self:StartMoving() - elseif self:GetParent():IsMovable() then - self:GetParent():StartMoving(...) - end - end) - self:SetScript("OnDragStop", function(self, ...) - if self:GetParent() == UIParent then - self:StopMovingOrSizing(...) - elseif self:GetParent():IsMovable() then - self:GetParent():StopMovingOrSizing(...) - end - end) - if self:GetParent() == UIParent then - self:SetUserPlaced(true) - end - - self:SetColors( - {0, 0, 0, 0.6}, - {0.3, 0.3, 0.3, 1} - ) - - self:SetPadding(5) - self:SetSpacing(5) - - self.items = {} -end - -function container:UpdateFromSettings() - local settings = ADDON.settings:GetSettings(self.__type) - - self:SetColors( - settings[DJBags_SETTING_BACKGROUND_COLOR], - settings[DJBags_SETTING_BORDER_COLOR] - ) - self:SetPadding(settings[DJBags_SETTING_PADDING]) - self:SetSpacing(settings[DJBags_SETTING_SPACING]) -end - -function container:SetPadding(padding) - self.container:ClearAllPoints() - self.padding = padding - - self.container:SetPoint('TOPLEFT', padding, -padding) - self.container:SetPoint('BOTTOMRIGHT', -padding, padding) -end - -function container:SetSpacing(spacing) - self.spacing = spacing -end - -function container:SetColors(background, border) - self:SetBackdropColor(unpack(background)) - self:SetBackdropBorderColor(unpack(border)) -end - -function container:AddItem(item) - self.items[item] = true - - if item:GetParent() ~= self.container then - item:SetParent(self.container) - end -end - -function container:Arrange(override) - ADDON.format[ADDON.settings:GetSettings(self.__type)[DJBags_SETTING_FORMATTER]]( - self, - ADDON.settings:GetSettings(self.__type)[DJBags_SETTING_FORMATTER_MAX_ITEMS], - ADDON.settings:GetSettings(self.__type)[DJBags_SETTING_FORMATTER_MAX_HEIGHT], - ADDON.settings:GetSettings(self.__type)[DJBags_SETTING_FORMATTER_BOX_COLS], - ADDON.settings:GetSettings(self.__type)[DJBags_SETTING_FORMATTER_VERT], - override == 2 - ) -end \ No newline at end of file diff --git a/src/lua/element/item.lua b/src/lua/element/item.lua deleted file mode 100644 index 55349ba..0000000 --- a/src/lua/element/item.lua +++ /dev/null @@ -1,301 +0,0 @@ -local NAME, ADDON = ... - -local item = {} - -function ADDON:NewItem(bag, slot) - local frame = CreateFrame('Frame', string.format('DJBagsItem_%d_%d', bag, slot)) - frame.button = CreateFrame('Button', string.format('DJBagsItemButton_%d_%d', bag, slot), frame, - bag == BANK_CONTAINER and 'BankItemButtonGenericTemplate' or - bag == REAGENTBANK_CONTAINER and 'ReagentBankItemButtonGenericTemplate' or - 'ContainerFrameItemButtonTemplate' - ) - - ADDON:CreateAddon(frame, item, bag, slot) - - return frame -end - -function item:Init(bag, slot) - self:SetID(bag) - self.button:SetID(slot) - - self.button:SetPoint('CENTER') - - self.button.quest = _G[self.button:GetName() .. "IconQuestTexture"] - self.button.cooldown = _G[self.button:GetName() .. "Cooldown"] - self.button.itemLevel = self.button:CreateFontString(self.button:GetName() .. 'ItemLevel', 'ARTWORK', 'NumberFontNormal') - self.button.itemLevel:SetPoint('TOPLEFT', 2, -2) - - self.button:Show() - self:SetSize(self.button:GetSize()) - - self.button:HookScript('OnClick', self.OnClick) -end - -function item:OnClick(button) - if self:GetParent().id and IsAltKeyDown() and button == 'LeftButton' then - DJBagsCategoryDialogLoad(self:GetParent().id, self:GetParent().name) - end -end - -function item:GetContainerName() - if self.id then - local isInSet, setName = GetContainerItemEquipmentSetInfo(self:GetID(), self.button:GetID()) - - if self.quality == LE_ITEM_QUALITY_POOR then - return BAG_FILTER_JUNK - end - - if isInSet then - return setName - end - - if self:GetID() >= 0 and self:GetID() <= NUM_BAG_SLOTS and C_NewItems.IsNewItem(self:GetID(), self.button:GetID()) then - return NEW - end - - local userDefinedList = ADDON.settings:GetUserDefinedList() - if userDefinedList[self.id] then - return userDefinedList[self.id] - end - - local globalDefinedList = ADDON.settings:GetGlobalUserDefinedList() - if globalDefinedList[self.id] then - return globalDefinedList[self.id] - end - - local subClassSplitList = ADDON.settings:GetSettings(DJBags_TYPE_SUB_CLASS) - if self.classId ~= LE_ITEM_CLASS_BATTLEPET then - if subClassSplitList[DJBags_SETTING_BOE] and DJBagsTooltip:IsItemBOE(self.link) then - return DJBags_LOCALE_BOE - end - if subClassSplitList[DJBags_SETTING_BOA] and DJBagsTooltip:IsItemBOA(self.link) then - return DJBags_LOCALE_BOA - end - end - - if subClassSplitList[self.classId] then - return self.class .. (self.subClass == BAG_FILTER_JUNK and '' or '_' .. self.subClass) - end - - return self.class - end - return EMPTY -end - ---region Update Magic - -local function UpdateQuest(self, isQuestItem, questId, isActive) - if (questId and not isActive) then - self.button.quest:SetTexture(TEXTURE_ITEM_QUEST_BANG) - self.button.quest:Show() - elseif (questId or isQuestItem) then - self.button.quest:SetTexture(TEXTURE_ITEM_QUEST_BORDER) - self.button.quest:Show() - else - self.button.quest:Hide() - end -end - -local function UpdateNewItemAnimations(self, isNewItem, isBattlePayItem, quality) - if (isNewItem) then - if (isBattlePayItem) then - self.button.NewItemTexture:Hide() - self.button.BattlepayItemTexture:Show() - else - if (quality and NEW_ITEM_ATLAS_BY_QUALITY[quality]) then - self.button.NewItemTexture:SetAtlas(NEW_ITEM_ATLAS_BY_QUALITY[quality]); - else - self.button.NewItemTexture:SetAtlas("bags-glow-white"); - end - self.button.BattlepayItemTexture:Hide(); - self.button.NewItemTexture:Show(); - end - if (not self.button.flashAnim:IsPlaying() and not self.button.newitemglowAnim:IsPlaying()) then - self.button.flashAnim:Play(); - self.button.newitemglowAnim:Play(); - end - else - self.button.BattlepayItemTexture:Hide(); - self.button.NewItemTexture:Hide(); - if (self.button.flashAnim:IsPlaying() or self.button.newitemglowAnim:IsPlaying()) then - self.button.flashAnim:Stop(); - self.button.newitemglowAnim:Stop(); - end - end -end - -local function UpdateFiltered(self, filtered, shouldDoRelicChecks, itemID) - if (filtered) then - self.button.searchOverlay:Show(); - else - self.button.searchOverlay:Hide(); - if shouldDoRelicChecks then - ContainerFrame_ConsiderItemButtonForRelicTutorial(self.button, itemID); - end - end -end - -local function UpdateILevel(self, equipable, quality, level) - if equipable then - if quality and quality >= LE_ITEM_QUALITY_COMMON then - self.button.itemLevel:SetVertexColor(BAG_ITEM_QUALITY_COLORS[quality].r, BAG_ITEM_QUALITY_COLORS[quality].g, BAG_ITEM_QUALITY_COLORS[quality].b) - else - self.button.itemLevel:SetVertexColor(1, 1, 1, 1) - end - self.button.itemLevel:SetText(level) - self.button.itemLevel:Show() - else - self.button.itemLevel:Hide() - end -end - -local function UpdateCooldown(self) - if not GetContainerItemID(self:GetID(), self.button:GetID()) then - self.button.cooldown:Hide() - return - end - - local start, duration, enable = GetContainerItemCooldown(self:GetID(), self.button:GetID()); - CooldownFrame_Set(self.button.cooldown, start, duration, enable); - if (duration > 0 and enable == 0) then - SetItemButtonTextureVertexColor(self.button, 0.4, 0.4, 0.4); - else - SetItemButtonTextureVertexColor(self.button, 1, 1, 1); - end -end - -function item:Update() - local texture, count, locked, quality, _, _, link, filtered, _, id = GetContainerItemInfo(self:GetID(), self.button:GetID()) - local equipable = IsEquippableItem(id) - - local name, level, classId, class, subClass - if id then - name, _, _, level, _, class, subClass, _, _, _, _, classId = GetItemInfo(id) - end - local isEquipment = equipable or classId == LE_ITEM_CLASS_ARMOR or classId == LE_ITEM_CLASS_WEAPON - - self.id = id - self.name = name or '' - self.quality = quality or 0 - self.ilevel = level or 0 - self.link = link - self.classId = classId - self.class = class - self.subClass = subClass - self.count = count or 1 - self.button.hasItem = nil - - if isEquipment then - level = DJBagsTooltip:GetItemLevel(link) or level - elseif classId == LE_ITEM_CLASS_CONTAINER then - -- TODO set count to number of slots - end - - UpdateILevel(self, equipable, quality, level) - if ADDON:IsBankBag(self:GetID()) then - BankFrameItemButton_Update(self.button) - else - local isQuestItem, questId, isActive = GetContainerItemQuestInfo(self:GetID(), self.button:GetID()) - local isNewItem = C_NewItems.IsNewItem(self:GetID(), self.button:GetID()) - local isBattlePayItem = IsBattlePayItem(self:GetID(), self.button:GetID()) - local shouldDoRelicChecks = not BagHelpBox:IsShown() and not GetCVarBitfield("closedInfoFrames", LE_FRAME_TUTORIAL_ARTIFACT_RELIC_MATCH) - - self.button.hasItem = true - - SetItemButtonTexture(self.button, texture) - SetItemButtonQuality(self.button, quality, id) - SetItemButtonCount(self.button, count) - SetItemButtonDesaturated(self.button, locked) - UpdateQuest(self, isQuestItem, questId, isActive) - UpdateNewItemAnimations(self, isNewItem, isBattlePayItem, quality) - UpdateFiltered(self, filtered, shouldDoRelicChecks, id) - UpdateCooldown(self) - end -end - -function item:UpdateCooldown() - UpdateCooldown(self) -end - -function item:UpdateSearch() - local _, _, _, _, _, _, _, filtered, _, id = GetContainerItemInfo(self:GetID(), self.button:GetID()) - local shouldDoRelicChecks = not BagHelpBox:IsShown() and not GetCVarBitfield("closedInfoFrames", LE_FRAME_TUTORIAL_ARTIFACT_RELIC_MATCH) - self:SetFiltered(filtered, shouldDoRelicChecks) -end - -function item:UpdateLock() - local locked = select(3, GetContainerItemInfo(self:GetID(), self.button:GetID())) - SetItemButtonDesaturated(self.button, locked); -end - -function item:SetFiltered(filtered, shouldDoRelicChecks) - UpdateFiltered(self, filtered, shouldDoRelicChecks, self.id) -end - -function item:SetItemCount(count) - SetItemButtonCount(self.button, count) -end - ---endregion - ---region Override UI code - -function ContainerFrameItemButton_OnEnter(self) - GameTooltip:SetOwner(self, "ANCHOR_NONE") - - local newItemTexture = self.NewItemTexture - local battlepayItemTexture = self.BattlepayItemTexture - local flash = self.flashAnim - local newItemGlowAnim = self.newitemglowAnim - - newItemTexture:Hide() - battlepayItemTexture:Hide() - - if (flash:IsPlaying() or newItemGlowAnim:IsPlaying()) then - flash:Stop() - newItemGlowAnim:Stop() - end - - local showSell - local _, repairCost, speciesID, level, breedQuality, maxHealth, power, speed, name = GameTooltip:SetBagItem(self:GetParent():GetID(), self:GetID()) - if(speciesID and speciesID > 0) then - ContainerFrameItemButton_CalculateItemTooltipAnchors(self, GameTooltip) - BattlePetToolTip_Show(speciesID, level, breedQuality, maxHealth, power, speed, name) - return; - else - if (BattlePetTooltip) then - BattlePetTooltip:Hide() - end - end - - local requiresCompareTooltipReanchor = ContainerFrameItemButton_CalculateItemTooltipAnchors(self, GameTooltip) - - if ( requiresCompareTooltipReanchor and (IsModifiedClick("COMPAREITEMS") or GetCVarBool("alwaysCompareItems")) ) then - GameTooltip_ShowCompareItem(GameTooltip) - end - - if ( InRepairMode() and (repairCost and repairCost > 0) ) then - GameTooltip:AddLine(REPAIR_COST, nil, nil, nil, true) - SetTooltipMoney(GameTooltip, repairCost) - GameTooltip:Show() - elseif ( MerchantFrame:IsShown() and MerchantFrame.selectedTab == 1 ) then - showSell = 1 - end - - if ( IsModifiedClick("DRESSUP") and self.hasItem ) then - ShowInspectCursor() - elseif ( showSell ) then - ShowContainerSellCursor(self:GetParent():GetID(),self:GetID()) - elseif ( self.readable ) then - ShowInspectCursor() - else - ResetCursor() - end - - if ArtifactFrame and self.hasItem then - ArtifactFrame:OnInventoryItemMouseEnter(self:GetParent():GetID(), self:GetID()) - end -end - ---endregion \ No newline at end of file diff --git a/src/lua/element/itemContainer.lua b/src/lua/element/itemContainer.lua deleted file mode 100644 index 2861e47..0000000 --- a/src/lua/element/itemContainer.lua +++ /dev/null @@ -1,99 +0,0 @@ -local NAME, ADDON = ... - - -local container = {} - -function ADDON:NewItemContainer(name, parent) - local frame = CreateFrame('Frame', 'DJBagsItemContainer_' .. name, parent or UIParent, 'DJBagsItemContainerTemplate') - - ADDON:CreateAddon(frame, container, name) - - return frame -end - -function container:Init(name) - self.__type = DJBags_TYPE_ITEM_CONTAINER - - if string.match(name, '%a*_%a*') then - local txt = string.match(name, '%a*_(%a*)') - self.name:SetText(txt) - else - self.name:SetText(name) - end - self.name:SetMaxLines(1) - self.name.text = name - self.items = {} - - self:UpdateFromSettings() - self.container:EnableMouse(false) -end - -function container:UpdateFromSettings() - local settings = ADDON.settings:GetSettings(self.__type) - - self:SetTitleSize(settings[DJBags_SETTING_TEXT_SIZE]) - self:SetColors( - settings[DJBags_SETTING_BACKGROUND_COLOR], - settings[DJBags_SETTING_BORDER_COLOR] - ) - self:SetTextColor(settings[DJBags_SETTING_TEXT_COLOR]) - self:SetPadding(settings[DJBags_SETTING_PADDING]) - self:SetSpacing(settings[DJBags_SETTING_SPACING]) -end - -function container:SetTitleSize(size) - local font, _, outline = self.name:GetFont() - self.name:SetFont(font, size, outline) - self.name:SetHeight(size) -end - -function container:SetPadding(padding) - self.container:ClearAllPoints() - self.padding = padding - - self.container:SetPoint('TOPLEFT', self.name, 'BOTTOMLEFT', padding, -5) - self.container:SetPoint('BOTTOMRIGHT', -padding, padding) -end - -function container:SetTextColor(color) - self.name:SetVertexColor(unpack(color)) -end - -function container:SetSize(width, height) - local index = getmetatable(self).__index - - height = height + self.name:GetHeight() + 10 - - index.SetSize(self, width, height) -end - -function container:AddItem(item) - self.items[item] = true - if item:GetParent() ~= self.container then - item:SetParent(self.container) - end - - self.arranged = nil -end - -function container:RemoveItem(item) - self.items[item] = nil - item:SetParent(nil) - - self.arranged = nil -end - -function container:IsEmpty() - return next(self.items) == nil -end - -function container:GetCount() - return ADDON:Count(self.items) -end - -function container:Arrange(max, vert, maxCnt, override, forceSize) - if override then - self.arrange = nil - end - ADDON:ArrangeItemContainer(self, max, vert, maxCnt, forceSize) -end \ No newline at end of file diff --git a/src/lua/element/mainBar.lua b/src/lua/element/mainBar.lua deleted file mode 100644 index 998f505..0000000 --- a/src/lua/element/mainBar.lua +++ /dev/null @@ -1,41 +0,0 @@ -local NAME, ADDON = ... - -local container = {} - -function DJBagsMainBarLoad(self) - ADDON:CreateAddon(self, container) -end - -function container:Init() - self.__type = DJBags_TYPE_MAIN_BAR - - table.insert(UISpecialFrames, self:GetName()) - self:RegisterForDrag("LeftButton") - self:SetScript("OnDragStart", function(self) - self:GetParent():StartMoving() - end) - self:SetScript("OnDragStop", function(self) - self:GetParent():StopMovingOrSizing() - end) - - self:SetColors( - {0, 0, 0, 0.6}, - {0.3, 0.3, 0.3, 1} - ) - - self:Show() -end - -function container:UpdateFromSettings() - local settings = ADDON.settings:GetSettings(self.__type) - - self:SetColors( - settings[DJBags_SETTING_BACKGROUND_COLOR], - settings[DJBags_SETTING_BORDER_COLOR] - ) -end - -function container:SetColors(background, border) - self:SetBackdropColor(unpack(background)) - self:SetBackdropBorderColor(unpack(border)) -end \ No newline at end of file diff --git a/src/lua/element/tooltip.lua b/src/lua/element/tooltip.lua deleted file mode 100644 index 8e5a168..0000000 --- a/src/lua/element/tooltip.lua +++ /dev/null @@ -1,49 +0,0 @@ -local NAME, ADDON = ... - -function DJBagsTooltip:GetItemLevel(link) - self:SetOwner(UIParent, "ANCHOR_NONE") - self:SetHyperlink(link) - - for i = 2, self:NumLines() do - local text = _G[self:GetName() .. "TextLeft"..i]:GetText() - local UPGRADE_LEVEL = gsub(ITEM_LEVEL," %d","") - - if text and text:find(UPGRADE_LEVEL) then - local itemLevel = string.match(text,"%d+") - - if itemLevel then - return tonumber(itemLevel) - end - end - end -end - -function DJBagsTooltip:IsItemBOE(link) - self:SetOwner(UIParent, "ANCHOR_NONE") - self:SetHyperlink(link) - - for i = 2, self:NumLines() do - local text = _G[self:GetName() .. "TextLeft"..i]:GetText() - - if text and text:find(ITEM_BIND_ON_EQUIP) then - return true - end - end - - return false -end - -function DJBagsTooltip:IsItemBOA(link) - self:SetOwner(UIParent, "ANCHOR_NONE") - self:SetHyperlink(link) - - for i = 2, self:NumLines() do - local text = _G[self:GetName() .. "TextLeft"..i]:GetText() - - if text and text:find(ITEM_BIND_TO_BNETACCOUNT) then - return true - end - end - - return false -end diff --git a/src/lua/events/events.lua b/src/lua/events/events.lua deleted file mode 100644 index cbf51ee..0000000 --- a/src/lua/events/events.lua +++ /dev/null @@ -1,41 +0,0 @@ -local NAME, ADDON = ... - -ADDON.events = CreateFrame('FRAME') - -local events = ADDON.events -events.list = {} - -events:SetScript('OnEvent', function(self, event, ...) - self:Fire(event, ...) -end) - -function events:Fire(event, ...) - if not event or not self.list[event] then return end - - for obj in pairs(self.list[event]) do - obj[event](obj, ...) - end -end - -function events:Add(event, obj) - if not event or not obj or not obj[event] then return end - - if not self.list[event] then - self.list[event] = {} - - self:RegisterEvent(event) - end - - self.list[event][obj] = true -end - -function events:Remove(event, obj) - if not event or not obj or not self.list[event] or not self.list[event][obj] then return end - - self.list[event][obj] = nil - - if next(self.list[event]) == nil and ADDON:Count(self.list[event]) == 0 then - self.list[event] = nil - self:UnregisterEvent(event) - end -end \ No newline at end of file diff --git a/src/lua/settings/settingsController.lua b/src/lua/settings/settingsController.lua deleted file mode 100644 index 6c3dfcc..0000000 --- a/src/lua/settings/settingsController.lua +++ /dev/null @@ -1,177 +0,0 @@ -local NAME, ADDON = ... - -function ADDON:PrintTable(tbl, lvl) - local prefix = '' - lvl = lvl or 0 - for _ = 1, lvl do - prefix = prefix .. ' ' - end - for k, v in pairs(tbl) do - print(prefix, k, v) - if (type(v) == 'table') then - ADDON:PrintTable(v, lvl + 1) - end - end -end - -ADDON.settings = {} -local settings = ADDON.settings - -function settings:Init() - self.realm = GetRealmName() - self.player = UnitName("player") - - DJBags_DB = DJBags_DB or {} - DJBags_DB[self.realm] = DJBags_DB[self.realm] or {} - DJBags_DB[self.realm][self.player] = DJBags_DB[self.realm][self.player] or {} - DJBags_DB[self.realm][self.player].userDefined = DJBags_DB[self.realm][self.player].userDefined or {} - DJBags_DB[self.realm][self.player].hiddenContainers = DJBags_DB[self.realm][self.player].hiddenContainers or {} - - DJBags_DB.userDefined = DJBags_DB.userDefined or {} - - self.default = { - [DJBags_TYPE_MAIN] = { - [DJBags_SETTING_STACK_ALL] = false, - [DJBags_SETTING_SELL_JUNK] = false, - [DJBags_SETTING_DEPOSIT_REAGENT] = false, - [DJBags_SETTING_SCALE] = 1, - [DJBags_SETTING_CLEAR_NEW_ITEMS] = false, - }, - [DJBags_TYPE_CONTAINER] = { - [DJBags_SETTING_BACKGROUND_COLOR] = {0, 0, 0, 0.6}, - [DJBags_SETTING_BORDER_COLOR] = {0.3, 0.3, 0.3, 1}, - [DJBags_SETTING_PADDING] = 5, - [DJBags_SETTING_SPACING] = 5, - [DJBags_SETTING_FORMATTER] = DJBags_FORMATTER_MASONRY, - [DJBags_SETTING_FORMATTER_VERT] = false, - [DJBags_SETTING_FORMATTER_MAX_ITEMS] = 12, - [DJBags_SETTING_FORMATTER_MAX_HEIGHT] = 50, - [DJBags_SETTING_FORMATTER_BOX_COLS] = 4, - [DJBags_SETTING_TRUNCATE_SUB_CLASS] = true, - }, - [DJBags_TYPE_ITEM_CONTAINER] = { - [DJBags_SETTING_BACKGROUND_COLOR] = {0, 0, 0, 0.6}, - [DJBags_SETTING_BORDER_COLOR] = {0.3, 0.3, 0.3, 1}, - [DJBags_SETTING_TEXT_COLOR] = {1, 1, 1, 1}, - [DJBags_SETTING_TEXT_SIZE] = 12, - [DJBags_SETTING_PADDING] = 3, - [DJBags_SETTING_SPACING] = 3, - }, - [DJBags_TYPE_SUB_CLASS] = { - [LE_ITEM_CLASS_ARMOR] = false, - [LE_ITEM_CLASS_CONSUMABLE] = true, - [LE_ITEM_CLASS_GEM] = false, - [LE_ITEM_CLASS_GLYPH] = false, - [LE_ITEM_CLASS_ITEM_ENHANCEMENT] = false, - [LE_ITEM_CLASS_MISCELLANEOUS] = true, - [LE_ITEM_CLASS_RECIPE] = false, - [LE_ITEM_CLASS_TRADEGOODS] = true, - [LE_ITEM_CLASS_WEAPON] = false, - [DJBags_SETTING_BOE] = false, - [DJBags_SETTING_BOA] = false, - }, - [DJBags_TYPE_MAIN_BAR] = { - [DJBags_SETTING_BACKGROUND_COLOR] = {0, 0, 0, 0.6}, - [DJBags_SETTING_BORDER_COLOR] = {0.3, 0.3, 0.3, 1}, - }, - [DJBags_TYPE_BANK_BAR] = { - [DJBags_SETTING_BACKGROUND_COLOR] = {0, 0, 0, 0.6}, - [DJBags_SETTING_BORDER_COLOR] = {0.3, 0.3, 0.3, 1}, - } - } - - self:Update() -end - -function settings:Update(force) - self:UpdateBag(DJBagsBagContainer, ADDON.bagController, ADDON.cache.bagContainers, force) - self:UpdateBag(DJBagsBankContainer, ADDON.bankController, ADDON.cache.bankContainers, force) - self:UpdateBag(DJBagsReagentContainer, ADDON.bankController, ADDON.cache.reagentContainers, force) - self:UpdateBar(DJBagsBagContainer.mainBar) - self:UpdateBar(DJBagsBankBar) - - local scale = self:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_SCALE] - DJBagsBagContainer:SetScale(scale) - DJBagsBankBar:SetScale(scale) -end - -function settings:UpdateBar(bar) - bar:UpdateFromSettings() -end - -function settings:UpdateBag(bag, controller, list, force) - bag:UpdateFromSettings() - for _, container in pairs(list) do - container:UpdateFromSettings() - end - - if bag:IsVisible() and force == 1 then - bag:Arrange(true) - elseif bag:IsVisible() and force == 2 then - controller:Update() - end -end - -function settings:IsContainerHidden(container) - return DJBags_DB[self.realm][self.player].hiddenContainers[container] -end - -function settings:SetContainerHidden(container) - DJBags_DB[self.realm][self.player].hiddenContainers[container] = true -end - -function settings:SetContainerVisible(container) - DJBags_DB[self.realm][self.player].hiddenContainers[container] = nil -end - -function settings:GetSettings(type) - local settings = DJBags_DB[self.realm][self.player][type] or {} - self:MigrateSettings(settings, self.default[type]or {}) - - return settings -end - -function settings:SetSettings(type, setting, out, force) - DJBags_DB[self.realm][self.player][type] = DJBags_DB[self.realm][self.player][type] or {} - DJBags_DB[self.realm][self.player][type][setting] = out - - self:Update(force) -end - -function settings:GetUserDefinedList() - return DJBags_DB[self.realm][self.player].userDefined -end - -function settings:AddUserDefinedItem(id, name) - DJBags_DB[self.realm][self.player].userDefined[id] = name - self:Update(2) -end - -function settings:GetGlobalUserDefinedList() - return DJBags_DB.userDefined -end - -function settings:AddGlobalDefinedItem(id, name) - DJBags_DB.userDefined[id] = name - self:Update(2) -end - -function settings:ClearUserDefinedItem(id) - DJBags_DB[self.realm][self.player].userDefined[id] = nil - DJBags_DB.userDefined[id] = nil - self:Update(2) -end - -function settings:MigrateSettings(table, default) - for k, v in pairs(default) do - if table[k] ~= nil then - if type(v) ~= type(table[k]) then - table[k] = v - elseif type(v) == 'table' then - self:MigrateSettings(table[k], v) - end - else - table[k] = v - end - end -end \ No newline at end of file diff --git a/src/lua/settings/settingsElements.lua b/src/lua/settings/settingsElements.lua deleted file mode 100644 index 3608de4..0000000 --- a/src/lua/settings/settingsElements.lua +++ /dev/null @@ -1,174 +0,0 @@ -local NAME, ADDON = ... - -local function round(num, idp) - local mult = 10^(idp or 0) - return math.floor(num * mult + 0.5) / mult -end - -function DJBagsInitSettingsSlider(slider, name, min, max, step, type, setting, noDeciaml) - local value = ADDON.settings:GetSettings(type)[setting] - - _G[slider:GetName() .. 'Text']:SetText(tostring(name) .. ' - ' .. value) - _G[slider:GetName() .. 'Low']:SetText(tostring(min)) - _G[slider:GetName() .. 'High']:SetText(tostring(max)) - slider:SetMinMaxValues(min, max) - slider.type = type - slider.setting = setting - slider.name = name - slider.noDecimal = noDeciaml - - local onChange = slider:GetScript('OnValueChanged') - slider:SetScript('OnValueChanged', nil) - slider:SetValue(value) - slider:SetValueStep(step) - slider:SetScript('OnValueChanged', onChange) -end - -function DJBagsSettingsSlider_OnChange(self, value) - _G[self:GetName() .. 'Text']:SetText(tostring(self.name) .. ' - ' .. round(value, self.noDecimal and 0 or 1)) - value = self.noDecimal and round(value, 0) or value - ADDON.settings:SetSettings(self.type, self.setting, value, 1) -end - -function DJBagsInitSettingsColorPicker(picker, type, setting) - picker.type = type - picker.setting = setting - - picker:SetBackdropColor(unpack(ADDON.settings:GetSettings(type)[setting])) -end - -function DJBagsSettingsColorPicker_OnClick(self) - local r, g, b, a = self:GetBackdropColor() - - local function callback(restore) - local newR, newG, newB, newA = r, g, b, a; - if not restore then - newA, newR, newG, newB = OpacitySliderFrame:GetValue(), ColorPickerFrame:GetColorRGB(); - end - - local out = { newR, newG, newB, newA } - self:SetBackdropColor(unpack(out)) - - ADDON.settings:SetSettings(self.type, self.setting, out) - end - - ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = callback, callback, callback; - ColorPickerFrame:SetColorRGB(r, g, b, a); - ColorPickerFrame.hasOpacity, ColorPickerFrame.opacity = (a ~= nil), a; - ColorPickerFrame.previousValues = { r, g, b, a }; - ShowUIPanel(ColorPickerFrame) -end - -function DJBagsInitSettingsCheckBox(checkbox, name, type, setting, arrangeType) - checkbox.type = type - checkbox.setting = setting - checkbox.arrangeType = arrangeType - - _G[checkbox:GetName() .. "Text"]:SetText(name) - - checkbox:SetChecked(ADDON.settings:GetSettings(type)[setting]) -end - -function DJBagsSettingsCheckBox_OnChange(checkbox, checked) - ADDON.settings:SetSettings(checkbox.type, checkbox.setting, checked, checkbox.arrangeType) -end - -function DJBagsCategoryDialogLoad(id, name) - DJBagsCategoryDialog:Show() - DJBagsCategoryDialog.name:SetText(string.format(DJBags_LOCALE_CATEGORY_DIALOG_TITLE, name)) - DJBagsCategoryDialog.id = id - - local userDefined = ADDON.settings:GetUserDefinedList() - local globalDefined = ADDON.settings:GetGlobalUserDefinedList() - local current = userDefined[id] or globalDefined[id] - - if current then - DJBagsCategoryDialog.edit:SetText(current) - DJBagsCategoryDialog.global:SetChecked(userDefined[id] == nil) - else - DJBagsCategoryDialog.edit:SetText('') - DJBagsCategoryDialog.global:SetChecked(false) - end - DJBagsCategoryDialog.edit:SetFocus() - - UIDropDownMenu_Initialize(DJBagsCategoryDialog.dropdown, function(self, level) - local unique = {} - for _, v in pairs(ADDON.settings:GetUserDefinedList()) do - unique[v] = true - end - for _, v in pairs(ADDON.settings:GetGlobalUserDefinedList()) do - unique[v] = true - end - - if next(unique) ~= nil then - local info - for k, _ in pairs(unique) do - info = UIDropDownMenu_CreateInfo() - info.text = k - info.value = k - info.func = DJBagsCategoryDialog_DropDownClick - UIDropDownMenu_AddButton(info, level) - end - end - end) -end - -function DJBagsCategoryDialog_DropDownClick(self) - UIDropDownMenu_SetSelectedID(DJBagsCategoryDialog.dropdown, self:GetID()) - DJBagsCategoryDialog.edit:SetText(self.value) -end - -function DJBagsCategoryDialog_Done() - local global = DJBagsCategoryDialog.global:GetChecked() - local text = DJBagsCategoryDialog.edit:GetText() - if text and text ~= '' then - if global then - ADDON.settings:AddGlobalDefinedItem(DJBagsCategoryDialog.id, text) - else - ADDON.settings:AddUserDefinedItem(DJBagsCategoryDialog.id, text) - end - DJBagsCategoryDialog:Hide() - end -end - -function DJBagsCategoryDialog_Clear() - ADDON.settings:ClearUserDefinedItem(DJBagsCategoryDialog.id) - DJBagsCategoryDialog:Hide() -end - -function DJBagsFormatSettings_OnLoad(self) - local type = ADDON.settings:GetSettings(DJBags_TYPE_CONTAINER)[DJBags_SETTING_FORMATTER] - function self:ShowContainer(type) - if type == 1 then - self.masonry:Show() - self.box:Hide() - else - self.masonry:Hide() - self.box:Show() - end - end - self:ShowContainer(type) - - UIDropDownMenu_Initialize(self.dropdown, function(_, level) - local unique = { - DJBags_LOCALE_MASONRY, - DJBags_LOCALE_BOX - } - - local cnt = 0 - local info - for _, k in pairs(unique) do - cnt = cnt + 1 - info = UIDropDownMenu_CreateInfo() - info.text = k - info.value = cnt - info.func = function(item) - ADDON.settings:SetSettings(DJBags_TYPE_CONTAINER, DJBags_SETTING_FORMATTER, item.value, 2) - self:ShowContainer(item.value) - UIDropDownMenu_SetSelectedID(self.dropdown, item.value) - end - UIDropDownMenu_AddButton(info, level) - end - end) - UIDropDownMenu_SetSelectedID(self.dropdown, type) -end \ No newline at end of file diff --git a/src/lua/tools/boxFormatter.lua b/src/lua/tools/boxFormatter.lua deleted file mode 100644 index 410aa03..0000000 --- a/src/lua/tools/boxFormatter.lua +++ /dev/null @@ -1,50 +0,0 @@ -local NAME, ADDON = ... - -ADDON.format = ADDON.format or {} - -local sorter = function(A, B) - if A.name.text == EMPTY then - return true - elseif B.name.text == EMPTY then - return false - elseif A.name.text == NEW then - return false - elseif B.name.text == NEW then - return true - elseif A.name.text == BAG_FILTER_JUNK then - return false - elseif B.name.text == BAG_FILTER_JUNK then - return true - else - return A.name.text > B.name.text - end -end - -ADDON.format[DJBags_FORMATTER_BOX] = function(frame, _, maxHeight, cols, _, override) - local x = 0 - local y = 0 - local width = 0 - local height = 0 - - for item in ADDON:PairsByKey(frame.items, sorter) do - if item:IsEmpty() or ADDON.settings:IsContainerHidden(item.name.text) then - item:Hide() - else - item:ClearAllPoints() - item:Arrange(cols, nil, (item.name:GetText() == EMPTY and 1), override, true) - item:Show() - if (y + item:GetHeight() + frame.spacing) > (maxHeight / 100 * GetScreenHeight()) then - y = 0 - x = x - item:GetWidth() - frame.spacing - end - - item:SetPoint('BOTTOMRIGHT', x, y) - - height = math.max(height, y + item:GetHeight() + frame.padding * 2) - width = math.max(width, -x + item:GetWidth() + frame.padding * 2) - y = y + frame.spacing + item:GetHeight() - end - end - - frame:SetSize(width, height) -end \ No newline at end of file diff --git a/src/lua/tools/itemFormatter.lua b/src/lua/tools/itemFormatter.lua deleted file mode 100644 index a9893dc..0000000 --- a/src/lua/tools/itemFormatter.lua +++ /dev/null @@ -1,79 +0,0 @@ -local NAME, ADDON = ... - -local itemSorter = function (A, B) - if A.quality == B.quality then - if A.ilevel == B.ilevel then - if A.name == B.name then - return A.count > B.count - end - return A.name < B.name - end - return A.ilevel > B.ilevel - end - return A.quality > B.quality -end - -local function alreadySorted(frame, max, vert) - if frame.arranged and frame.max == max and frame.vert == vert then - return true - end - return false -end - -function ADDON:ArrangeItemContainer(frame, max, vert, maxCnt, force) - if frame:IsEmpty() or alreadySorted(frame, max, vert) then return end - - local itemCount = 0 - local cnt = 0 - - local items = {} - for item in ADDON:PairsByKey(frame.items, itemSorter) do - tinsert(items, item) - end - - local index = 1 - while (index <= #items) do - local item = items[index] - local nItem = items[index + 1] - local totalCnt = 0 - local mustStackAll = ADDON.settings:GetSettings(DJBags_TYPE_MAIN)[DJBags_SETTING_STACK_ALL] - while mustStackAll and nItem and nItem.id == item.id do - totalCnt = totalCnt + nItem.count - index = index + 1 - nItem:Hide() - nItem = items[index+1] - end - if totalCnt > 0 then - item:SetItemCount(item.count + totalCnt) - end - - if maxCnt and cnt >= maxCnt then - item:Hide() - else - item:Show() - local row = cnt % max - local col = math.floor(cnt / max) - - local colPos = (frame.spacing + item:GetWidth()) * col - local rowPos = (frame.spacing + item:GetWidth()) * row - - item:SetPoint('TOPLEFT', vert and colPos or rowPos, -(vert and rowPos or colPos)) - - cnt = cnt + 1 - if maxCnt and cnt == maxCnt then - item:SetItemCount(frame:GetCount() - cnt + 1) - end - itemCount = itemCount + 1 - end - index = index + 1 - end - - local colSize = math.ceil(itemCount / max) * (next(frame.items):GetWidth() + frame.spacing) - frame.spacing - local numCols = force and max or (maxCnt and maxCnt or (itemCount < max and itemCount or max)) - local rowSize = numCols * (frame.spacing + next(frame.items):GetWidth()) - frame.spacing - - frame:SetSize( - (vert and colSize or rowSize) + frame.padding * 2, - (vert and rowSize or colSize) + frame.padding * 2 - ) -end \ No newline at end of file diff --git a/src/lua/tools/masonryFormatter.lua b/src/lua/tools/masonryFormatter.lua deleted file mode 100644 index 3d9d560..0000000 --- a/src/lua/tools/masonryFormatter.lua +++ /dev/null @@ -1,71 +0,0 @@ -local NAME, ADDON = ... - -ADDON.format = ADDON.format or {} - -local sorter = function(A, B) - if A.name.text == EMPTY then - return false - elseif B.name.text == EMPTY then - return true - elseif A.name.text == NEW then - return true - elseif B.name.text == NEW then - return false - elseif A.name.text == BAG_FILTER_JUNK then - return true - elseif B.name.text == BAG_FILTER_JUNK then - return false - else - return A.name.text < B.name.text - end -end - -ADDON.format[DJBags_FORMATTER_MASONRY] = function(frame, maxItems, _, _, vert, override) - local h = 0 - local x = 0 - local mH = 0 - local mW = 0 - local cnt = 0 - local lastH = 0 - - for v in ADDON:PairsByKey(frame.items, function(A, B) - local ans = sorter(A, B) - if vert then - return not ans - end - return ans - end) do - if v:IsEmpty() or ADDON.settings:IsContainerHidden(v.name.text) then - v:Hide() - else - v:Show() - local numItems = v.name:GetText() == EMPTY and 1 or v:GetCount() - - if cnt ~= 0 and (cnt + numItems) > maxItems then - x = 0 - h = h + mH + frame.spacing - cnt = 0 - mH = 0 - end - - if numItems > maxItems then - v:Arrange(maxItems, vert, nil, override) - else - v:Arrange(numItems, vert, (v.name:GetText() == EMPTY and 1), override) - end - - v:ClearAllPoints() - v:SetPoint(vert and 'BOTTOMRIGHT' or 'TOPLEFT', vert and -h or x, vert and x or -h) - - mH = math.max(mH, vert and v:GetWidth() or v:GetHeight()) - mW = math.max(mW, x + (vert and v:GetHeight() or v:GetWidth())) - x = x + frame.spacing + (vert and v:GetHeight() or v:GetWidth()) - - cnt = cnt + numItems - lastH = vert and v:GetWidth() or v:GetHeight() - end - end - - frame:SetSize((vert and (h + lastH) or mW) + frame.padding * 2, - (vert and mW or (h + lastH)) + frame.padding * 2) -end \ No newline at end of file diff --git a/src/lua/utils/utils.lua b/src/lua/utils/utils.lua deleted file mode 100644 index 8cbd68f..0000000 --- a/src/lua/utils/utils.lua +++ /dev/null @@ -1,71 +0,0 @@ -local NAME, ADDON = ... - -function ADDON:IsBankBag(id) - if id == BANK_CONTAINER or id == REAGENTBANK_CONTAINER then - return true - end - return false -end - -function ADDON:CreateAddon(obj, tbl, ...) - for k, v in pairs(tbl) do - obj[k] = v - end - - if obj.Init then - obj:Init(...) - end -end - -function ADDON:Count(table) - local cnt = 0; - - for _ in pairs(table) do - cnt = cnt + 1 - end - - return cnt -end - -function ADDON:PairsByKey(tbl, sorter) - local keys = {} - for k in pairs(tbl) do - tinsert(keys, k) - end - table.sort(keys, sorter) - local index = 0 - return function() - index = index + 1 - return keys[index], tbl[keys[index]] - end -end - -function ADDON:UpdateBags(bags) - for _, bag in pairs(bags) do - local bagSlots = GetContainerNumSlots(bag) - - if ADDON.cache.items[bag] and bagSlots < ADDON:Count(ADDON.cache.items[bag]) then - for index = bagSlots + 1, ADDON:Count(ADDON.cache.items[bag]) do - local item = ADDON.cache:GetItem(bag, index) - local parent = item:GetParent() and item:GetParent():GetParent() - if parent and parent.RemoveItem then - parent:RemoveItem(item) - end - item:Hide() - end - end - - for slot = 1, bagSlots do - local item = ADDON.cache:GetItem(bag, slot) - item:Update() - local newParent = ADDON.cache:GetItemContainer(bag, item:GetContainerName()) - - local currentParent = item:GetParent() and item:GetParent():GetParent() - if currentParent and currentParent.RemoveItem then - currentParent:RemoveItem(item) - end - - newParent:AddItem(item) - end - end -end \ No newline at end of file diff --git a/src/manifest.xml b/src/manifest.xml index 86f1ef1..6db6df5 100644 --- a/src/manifest.xml +++ b/src/manifest.xml @@ -1,53 +1,15 @@ <Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd"> - <!-- Constants --> - <Script file="src/lua/constants/contstants.lua" /> - - <!-- Utils --> - <Script file="src/lua/cache/cache.lua" /> - <Script file="src/lua/utils/utils.lua" /> - - <!-- Events --> - <Script file="src/lua/events/events.lua" /> - - <!-- Elements--> - <Include file="src/xml/element/tooltip.xml" /> - <Script file="src/lua/element/tooltip.lua" /> - <Script file="src/lua/element/bagItem.lua" /> - <Script file="src/lua/element/item.lua" /> - <Include file="src/xml/element/itemContainer.xml" /> - <Script file="src/lua/element/itemContainer.lua" /> - <Script file="src/lua/element/mainBar.lua" /> - <Include file="src/xml/element/mainBar.xml" /> - <Script file="src/lua/element/container.lua" /> - <Include file="src/xml/element/container.xml" /> - <Script file="src/lua/element/bankBar.lua" /> - <Include file="src/xml/element/bankBar.xml" /> - - <!-- Formatters --> - <Script file="src/lua/tools/itemFormatter.lua" /> - <Script file="src/lua/tools/masonryFormatter.lua" /> - <Script file="src/lua/tools/boxFormatter.lua" /> - - <!-- Controller --> - <Script file="src/lua/controller/bag.lua" /> - <Script file="src/lua/controller/bank.lua" /> - - <!-- Settings --> - <Script file="src/lua/settings/settingsController.lua" /> - <Script file="src/lua/settings/settingsElements.lua" /> - <Include file="src/xml/settings/colorPicker.xml" /> - <Include file="src/xml/settings/slider.xml" /> - <Include file="src/xml/settings/checkBox.xml" /> - <Include file="src/xml/settings/itemContainerSettings.xml" /> - <Include file="src/xml/settings/containerSettings.xml" /> - <Include file="src/xml/settings/subClassSettings.xml" /> - <Include file="src/xml/settings/toggleSettings.xml" /> - <Include file="src/xml/settings/mainBarSettings.xml" /> - <Include file="src/xml/settings/bankBarSettings.xml" /> - <Include file="src/xml/settings/formatterSettings.xml" /> - <Include file="src/xml/settings/settingsContainer.xml" /> - <Include file="src/xml/settings/categoryDialog.xml" /> - - <!-- Core (Load last) --> - <Script file="src/lua/core.lua"/> + <Script file="src/Constants.lua"/> + <Include file="src/contants/Contants.xml"/> + <Include file="src/event/Event.xml"/> + <Include file="src/tooltip/Tooltip.xml"/> + <Include file="src/category/Category.xml"/> + <Include file="src/format/Format.xml"/> + <Include file="src/item/Item.xml"/> + <Include file="src/bagItem/BagItem.xml"/> + <Include file="src/titleContainer/TitleContainer.xml"/> + <Include file="src/base/Base.xml"/> + <Include file="src/bag/Bag.xml"/> + <Include file="src/bank/Bank.xml"/> + <Script file="src/DJBags.lua"/> </Ui> \ No newline at end of file diff --git a/src/titleContainer/TitleContainer.xml b/src/titleContainer/TitleContainer.xml new file mode 100644 index 0000000..193aa6d --- /dev/null +++ b/src/titleContainer/TitleContainer.xml @@ -0,0 +1,55 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Frame name="DJBagsTitleContainerTemplate" virtual="true"> + <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> + <EdgeSize> + <AbsValue val="1"/> + </EdgeSize> + <Color r="0" g="0" b="0" a="0.6"/> + <BorderColor r="0.3" g="0.3" b="0.3" a="1"/> + </Backdrop> + <Layers> + <Layer level="OVERLAY"> + <FontString name="$parentName" parentKey="name" inherits="GameFontHighlight"> + <Anchors> + <Anchor point="TOPLEFT"> + <Offset> + <AbsDimension x="0" y="-5"/> + </Offset> + </Anchor> + <Anchor point="TOPRIGHT"> + <Offset> + <AbsDimension x="0" y="-5"/> + </Offset> + </Anchor> + </Anchors> + </FontString> + </Layer> + </Layers> + <Frames> + <Frame name="$parentTextHover"> + <Anchors> + <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="TOPLEFT"/> + <Anchor point="BOTTOMRIGHT" relativeTo="$parentName" relativePoint="BOTTOMRIGHT"/> + </Anchors> + <Scripts> + <OnEnter> + if self:GetParent().name:IsTruncated() or self:GetParent().name:GetText() ~= self:GetParent().name.text then + GameTooltip:SetOwner(self, 'ANCHOR_CURSOR') + GameTooltip:SetText(self:GetParent().name.text) + GameTooltip:Show() + end + </OnEnter> + <OnLeave> + GameTooltip:Hide() + </OnLeave> + </Scripts> + </Frame> + </Frames> + <Scripts> + <OnLoad> + self.name:SetMaxLines(1) + self.name:SetWordWrap(false) + </OnLoad> + </Scripts> + </Frame> +</Ui> \ No newline at end of file diff --git a/src/tooltip/Tooltip.lua b/src/tooltip/Tooltip.lua new file mode 100644 index 0000000..361618d --- /dev/null +++ b/src/tooltip/Tooltip.lua @@ -0,0 +1,64 @@ +local ADDON_NAME, ADDON = ... + +function DJBagsTooltip:GetItemLevel(bag, slot) + self:SetOwner(UIParent, "ANCHOR_NONE") + self:SetBagItem(bag, slot) + + for i = 2, self:NumLines() do + local text = _G[self:GetName() .. "TextLeft" .. i]:GetText() + local UPGRADE_LEVEL = gsub(ITEM_LEVEL, " %d", "") + + if text and text:find(UPGRADE_LEVEL) then + local itemLevel = string.match(text, "%d+") + + if itemLevel then + return tonumber(itemLevel) + end + end + end +end + +function DJBagsTooltip:IsItemBOE(bag, slot) + self:SetOwner(UIParent, "ANCHOR_NONE") + self:SetBagItem(bag, slot) + + for i = 2, self:NumLines() do + local text = _G[self:GetName() .. "TextLeft" .. i]:GetText() + + if text and text:find(ITEM_BIND_ON_EQUIP) then + return true + end + end + + return false +end + +function DJBagsTooltip:IsItemBOA(bag, slot) + self:SetOwner(UIParent, "ANCHOR_NONE") + self:SetBagItem(bag, slot) + + for i = 2, self:NumLines() do + local text = _G[self:GetName() .. "TextLeft" .. i]:GetText() + + if text and text:find(ITEM_BIND_TO_BNETACCOUNT) then + return true + end + end + + return false +end + +function DJBagsTooltip:IsItemArtifactPower(bag, slot) + self:SetOwner(UIParent, "ANCHOR_NONE") + self:SetBagItem(bag, slot) + + for i = 2, self:NumLines() do + local text = _G[self:GetName() .. "TextLeft" .. i]:GetText() + + if text and text:find(ARTIFACT_POWER) then + return true + end + end + + return false +end \ No newline at end of file diff --git a/src/tooltip/Tooltip.xml b/src/tooltip/Tooltip.xml new file mode 100644 index 0000000..82f0836 --- /dev/null +++ b/src/tooltip/Tooltip.xml @@ -0,0 +1,4 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <GameTooltip name="DJBagsTooltip" inherits="GameTooltipTemplate"/> + <Script file="src/tooltip/Tooltip.lua"/> +</Ui> \ No newline at end of file diff --git a/src/xml/element/bankBar.xml b/src/xml/element/bankBar.xml deleted file mode 100644 index b0f63d3..0000000 --- a/src/xml/element/bankBar.xml +++ /dev/null @@ -1,210 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsBankBar" parent="UIParent" movable="true" enableMouse="true" hidden="true"> - <Size x="299" y="77" /> - <Anchors> - <Anchor point="TOPLEFT" x="150" y="-100" /> - </Anchors> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - </Backdrop> - <Frames> - <Button name="$parentBag1" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" x="5" y="-5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 1, BankButtonIDToInvSlotID(1, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag2" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 2, BankButtonIDToInvSlotID(2, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag3" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag2" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 3, BankButtonIDToInvSlotID(3, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag4" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag3" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 4, BankButtonIDToInvSlotID(4, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag5" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag4" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 5, BankButtonIDToInvSlotID(5, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag6" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag5" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 6, BankButtonIDToInvSlotID(6, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentBag7" inherits="ItemButtonTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag6" relativePoint="TOPRIGHT" x="5" /> - </Anchors> - <Scripts> - <OnLoad> - DJBagsBagItemLoad(self, NUM_BAG_SLOTS + 7, BankButtonIDToInvSlotID(7, 1)) - </OnLoad> - </Scripts> - </Button> - <Button name="$parentRestackButton"> - <Size x="16" y="16" /> - <Anchors> - <Anchor point="TOPRIGHT" relativeTo="$parentBag7" relativePoint="BOTTOMRIGHT" y="-9.5" /> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Disabled" /> - <PushedTexture file="Interface\Buttons\UI-GuildButton-OfficerNote-Up" /> - <HighlightTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Up" alphaMode="ADD" /> - <Scripts> - <OnEnter> - GameTooltip:SetOwner(self, 'TOPRIGHT') - GameTooltip:SetText(BAG_CLEANUP_BANK) - GameTooltip:Show() - </OnEnter> - <OnLeave> - GameTooltip:Hide() - </OnLeave> - <OnClick> - PlaySound("UI_BagSorting_01"); - SortBankBags() - SortReagentBankBags() - </OnClick> - </Scripts> - </Button> - <Button name="$parentDepositReagent" inherits="UIPanelButtonTemplate" text="REAGENTBANK_DEPOSIT"> - <Size x="150" y="25" /> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentRestackButton" relativePoint="LEFT" x="-3" /> - </Anchors> - <Scripts> - <OnClick> - PlaySound("igMainMenuOption"); - DepositReagentBank(); - </OnClick> - </Scripts> - </Button> - <EditBox name="$parentSearchBar" inherits="BagSearchBoxTemplate"> - <Size y="25" /> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="BOTTOMLEFT" x="5" y="-5"/> - <Anchor point="RIGHT" relativeTo="$parentDepositReagent" relativePoint="LEFT" x="-5" /> - </Anchors> - </EditBox> - <Button name="$parentTab1" inherits="TabButtonTemplate" text="BANK"> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="TOPLEFT" /> - </Anchors> - <Scripts> - <OnLoad> - PanelTemplates_TabResize(self, 0); - self.HighlightTexture:SetWidth(self:GetTextWidth() + 31); - self.tab = 1 - </OnLoad> - <OnClick> - DJBagsBankTab_OnClick(self) - </OnClick> - </Scripts> - </Button> - <Button name="$parentTab2" inherits="TabButtonTemplate" text="REAGENT_BANK"> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="$parentTab1" relativePoint="BOTTOMRIGHT" /> - </Anchors> - <Scripts> - <OnLoad> - PanelTemplates_TabResize(self, 0); - self.HighlightTexture:SetWidth(self:GetTextWidth() + 31); - self.tab = 2 - </OnLoad> - <OnClick> - DJBagsBankTab_OnClick(self) - </OnClick> - </Scripts> - </Button> - - <Frame name="DJBagsBankContainer" parent="DJBagsBankBar" inherits="DJBagsContainerTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" y="-5" /> - </Anchors> - </Frame> - <Frame name="DJBagsReagentContainer" parent="DJBagsBankBar" inherits="DJBagsContainerTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" y="-5" /> - </Anchors> - </Frame> - <Button name="$parentReagentButton" parent="DJBagsReagentContainer" parentKey="reagentButton" inherits="UIPanelButtonTemplate" text="BANKSLOTPURCHASE" hidden="true"> - <Size x="100" y="25"/> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="DJBagsReagentContainer" relativePoint="TOPLEFT" x="5" y="-5" /> - </Anchors> - <Scripts> - <OnClick> - PlaySound("igMainMenuOption"); - StaticPopup_Show("CONFIRM_BUY_REAGENTBANK_TAB"); - </OnClick> - </Scripts> - </Button> - <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton"> - <Anchors> - <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" /> - <Scripts> - <OnLoad> - self:SetAlpha(0.2) - </OnLoad> - <OnEnter> - self:SetAlpha(1) - </OnEnter> - <OnLeave> - self:SetAlpha(0.2) - </OnLeave> - </Scripts> - </Button> - </Frames> - <Scripts> - <OnLoad> - PanelTemplates_SetNumTabs(self, 2) - DJBagsBankBarLoad(self) - </OnLoad> - <OnShow> - DJBagsBankBar_OnShow(self) - </OnShow> - <OnHide> - DJBagsBankBar_OnHide(self) - </OnHide> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/element/container.xml b/src/xml/element/container.xml deleted file mode 100644 index a7704d6..0000000 --- a/src/xml/element/container.xml +++ /dev/null @@ -1,56 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsContainerTemplate" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true" hidden="true" virtual="true"> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Frames> - <Frame name="$parentContainer" parentKey="container" /> - </Frames> - <Scripts> - <OnLoad> - DJBagsContainerLoad(self) - </OnLoad> - </Scripts> - </Frame> - <Frame name="DJBagsBagContainer" parent="UIParent" inherits="DJBagsContainerTemplate"> - <Anchors> - <Anchor point="BOTTOMRIGHT" x="-150" y="150" /> - </Anchors> - <Frames> - <Frame name="$parentMainBar" parentKey="mainBar" inherits="DJBagsMainBarTemplate"> - <Anchors> - <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" x="0" y="-5"/> - </Anchors> - </Frame> - <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton"> - <Anchors> - <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" /> - <Scripts> - <OnLoad> - self:SetAlpha(0.2) - </OnLoad> - <OnEnter> - self:SetAlpha(1) - </OnEnter> - <OnLeave> - self:SetAlpha(0.2) - </OnLeave> - </Scripts> - </Button> - </Frames> - <Scripts> - <OnShow> - DJBagsBagContainer_OnShow(self) - </OnShow> - <OnHide> - DJBagsBagContainer_OnHide(self) - </OnHide> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/element/itemContainer.xml b/src/xml/element/itemContainer.xml deleted file mode 100644 index c6ed28c..0000000 --- a/src/xml/element/itemContainer.xml +++ /dev/null @@ -1,54 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsItemContainerTemplate" inherits="DJBagsContainerTemplate" virtual="true"> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" parentKey="name" inherits="GameFontHighlight"> - <Anchors> - <Anchor point="TOPLEFT"> - <Offset> - <AbsDimension x="0" y="-5"/> - </Offset> - </Anchor> - <Anchor point="TOPRIGHT"> - <Offset> - <AbsDimension x="0" y="-5"/> - </Offset> - </Anchor> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Frame name="$parentTextHover"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="TOPLEFT" /> - <Anchor point="BOTTOMRIGHT" relativeTo="$parentName" relativePoint="BOTTOMRIGHT" /> - </Anchors> - <Scripts> - <OnEnter> - if self:GetParent().name:IsTruncated() or self:GetParent().name:GetText() ~= self:GetParent().name.text then - GameTooltip:SetOwner(self, 'ANCHOR_CURSOR') - GameTooltip:SetText(self:GetParent().name.text) - GameTooltip:Show() - end - </OnEnter> - <OnLeave> - GameTooltip:Hide() - </OnLeave> - <OnMouseUp> - if IsAltKeyDown() and button == 'RightButton' then - DJBagsSettingsContainer:Open() - end - </OnMouseUp> - </Scripts> - </Frame> - </Frames> - <Scripts> - <OnMouseUp> - if IsAltKeyDown() and button == 'RightButton' then - DJBagsSettingsContainer:Open() - end - </OnMouseUp> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/element/mainBar.xml b/src/xml/element/mainBar.xml deleted file mode 100644 index 95ae4be..0000000 --- a/src/xml/element/mainBar.xml +++ /dev/null @@ -1,123 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsMainBarTemplate" virtual="true" movable="true" enableMouse="true"> - <Size x="325" y="25" /> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - </Backdrop> - <Frames> - <CheckButton name="$parentBagBtn" inherits="UIRadioButtonTemplate"> - <Anchors> - <Anchor point="RIGHT" relativePoint="RIGHT" relativeTo="$parent" x="-5"/> - </Anchors> - <Scripts> - <OnClick> - DJDBagsBagsButton_OnClick(self) - </OnClick> - </Scripts> - </CheckButton> - <Button name="$parentRestackBtn"> - <Size x="16" y="16" /> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentBagBtn" relativePoint="LEFT" x="-3" /> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Disabled" /> - <PushedTexture file="Interface\Buttons\UI-GuildButton-OfficerNote-Up" /> - <HighlightTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Up" alphaMode="ADD" /> - <Scripts> - <OnEnter> - GameTooltip:SetOwner(self, 'TOPRIGHT') - GameTooltip:SetText(BAG_CLEANUP_BAGS) - GameTooltip:Show() - </OnEnter> - <OnLeave> - GameTooltip:Hide() - </OnLeave> - <OnClick> - PlaySound("UI_BagSorting_01"); - SortBags() - </OnClick> - </Scripts> - </Button> - <Button name="$parentClearButton"> - <Size x="25" y="25" /> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentRestackBtn" relativePoint="LEFT" x="-3" /> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-RotationLeft-Button-Up" /> - <PushedTexture file="Interface\Buttons\UI-RotationLeft-Button-Down" /> - <HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD"> - <Size x="22" y="23"/> - <Anchors> - <Anchor point="CENTER" x="0" y="0"/> - </Anchors> - </HighlightTexture> - <Scripts> - <OnEnter> - GameTooltip:SetOwner(self, 'TOPRIGHT') - GameTooltip:SetText(DJBags_LOCALE_CLEAR_NEW_ITEMS) - GameTooltip:Show() - </OnEnter> - <OnLeave> - GameTooltip:Hide() - </OnLeave> - <OnClick> - C_NewItems:ClearAll() - DJBags_ItemsCleared() - </OnClick> - </Scripts> - </Button> - <EditBox name="$parentSearchBox" parentKey="search" inherits="BagSearchBoxTemplate" letters="15"> - <Size x="96" y="18"/> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentClearButton" relativePoint="LEFT" x="-3" /> - </Anchors> - </EditBox> - <Frame name="$parentMoney" parentKey="moneyFrame" inherits="SmallMoneyFrameTemplate" hidden="false"> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentSearchBox" relativePoint="LEFT"/> - </Anchors> - <Scripts> - <OnLoad> - SmallMoneyFrame_OnLoad(self); - MoneyFrame_SetType(self, "PLAYER"); - MoneyFrame_SetMaxDisplayWidth(self, 168); - </OnLoad> - </Scripts> - </Frame> - <Frame name="$parentCurrencyDisplay" frameStrata="DIALOG" toplevel="true" frameLevel="10"> - <Anchors> - <Anchor point="TOPLEFT" /> - <Anchor point="BOTTOMRIGHT" relativeTo="$parentSearchBox" relativePoint="BOTTOMLEFT" /> - </Anchors> - <Scripts> - <OnEnter> - local cnt = GetCurrencyListSize() - GameTooltip:SetOwner(self, "ANCHOR_NONE") - GameTooltip:SetPoint("BOTTOMLEFT", self, "TOPLEFT") - GameTooltip:SetText("Currency") - for index = 1, cnt do - local name, _, _, _, _, count, texture, _, _, _, _ = GetCurrencyListInfo(index) - if count ~= 0 and texture ~= nil then - GameTooltip:AddDoubleLine(name, count .. " |T" .. texture .. ":16|t", 1, 1, 1, 1, 1, 1) - end - end - GameTooltip:Show() - </OnEnter> - <OnLeave> - GameTooltip:Hide() - </OnLeave> - <OnMouseDown> - MoneyInputFrame_OpenPopup(self:GetParent().moneyFrame); - </OnMouseDown> - </Scripts> - </Frame> - </Frames> - <Scripts> - <OnLoad> - DJBagsMainBarLoad(self) - </OnLoad> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/element/tooltip.xml b/src/xml/element/tooltip.xml deleted file mode 100644 index 1c3c3f7..0000000 --- a/src/xml/element/tooltip.xml +++ /dev/null @@ -1,3 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <GameTooltip name="DJBagsTooltip" inherits="GameTooltipTemplate" /> -</Ui> diff --git a/src/xml/settings/bankBarSettings.xml b/src/xml/settings/bankBarSettings.xml deleted file mode 100644 index deb7405..0000000 --- a/src/xml/settings/bankBarSettings.xml +++ /dev/null @@ -1,44 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsBankBarSettings" hidden="false" virtual="true"> - <Size x="500" y="65"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_BANK_BAR_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Button name="$parentBackgroundColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BACKGROUND_COLOR"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-15" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_BANK_BAR, DJBags_SETTING_BACKGROUND_COLOR) - </OnShow> - </Scripts> - </Button> - <Button name="$parentBorderColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BORDER_COLOR"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="RIGHT" x="5" y="0" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_BANK_BAR, DJBags_SETTING_BORDER_COLOR) - </OnShow> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> diff --git a/src/xml/settings/categoryDialog.xml b/src/xml/settings/categoryDialog.xml deleted file mode 100644 index d0c33ec..0000000 --- a/src/xml/settings/categoryDialog.xml +++ /dev/null @@ -1,98 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsCategoryDialog" parent="UIParent" inherits="DJBagsContainerTemplate" hidden="true"> - <Size x="450" y="90"/> - <Anchors> - <Anchor point="CENTER" /> - </Anchors> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" parentKey="name" inherits="GameFontNormal"> - <Anchors> - <Anchor point="TOP" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <EditBox name="$parentCategoryEdit" parentKey="edit"> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Size x="300" y="25" /> - <Anchors> - <Anchor point="TOPLEFT" x="5" y="-25" /> - </Anchors> - <FontString inherits="GameFontNormal" /> - <Scripts> - <OnLoad> - self:SetAutoFocus(false) - </OnLoad> - <OnEscapePressed> - self:ClearFocus() - </OnEscapePressed> - <OnEnterPressed> - DJBagsCategoryDialog_Done() - </OnEnterPressed> - </Scripts> - </EditBox> - <Button name="$parentDropDown" parentKey="dropdown" inherits="UIDropDownMenuTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentCategoryEdit" relativePoint="RIGHT" x="5" y="-3" /> - </Anchors> - <Scripts> - <OnLoad> - UIDropDownMenu_SetWidth(self, 100); - UIDropDownMenu_SetButtonWidth(self, 124) - UIDropDownMenu_JustifyText(self, "LEFT") - </OnLoad> - </Scripts> - </Button> - <Button name="$parentOK" inherits="UIPanelButtonTemplate" text="DONE"> - <Size x="75" y="25" /> - <Anchors> - <Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" x="-5" y="5" /> - </Anchors> - <Scripts> - <OnClick> - DJBagsCategoryDialog_Done() - </OnClick> - </Scripts> - </Button> - <Button name="$parentClear" inherits="UIPanelButtonTemplate" text="RESET"> - <Size x="75" y="25" /> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT" x="5" y="5" /> - </Anchors> - <Scripts> - <OnClick> - DJBagsCategoryDialog_Clear() - </OnClick> - </Scripts> - </Button> - <CheckButton name="$parentGlobal" parentKey="global" inherits="UICheckButtonTemplate"> - <Anchors> - <Anchor point="RIGHT" relativeTo="$parentOK" relativePoint="LEFT" x="-50" /> - </Anchors> - <Scripts> - <OnLoad> - _G[self:GetName() .. 'Text']:SetText(DJBags_LOCALE_GLOBAL) - </OnLoad> - </Scripts> - </CheckButton> - </Frames> - <Scripts> - <OnLoad> - table.insert(UISpecialFrames, self:GetName()) - self:RegisterForDrag("LeftButton") - self:SetScript("OnDragStart", self.StartMoving) - self:SetScript("OnDragStop", self.StopMovingOrSizing) - self:SetUserPlaced(true) - </OnLoad> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/settings/checkBox.xml b/src/xml/settings/checkBox.xml deleted file mode 100644 index 4e64ba5..0000000 --- a/src/xml/settings/checkBox.xml +++ /dev/null @@ -1,10 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <CheckButton name="DJBagsSettingsCheckBoxTemplate" inherits="UICheckButtonTemplate" virtual="true"> - <Scripts> - <OnClick> - DJBagsSettingsCheckBox_OnChange(self, self:GetChecked()) - </OnClick> - </Scripts> - </CheckButton> -</Ui> \ No newline at end of file diff --git a/src/xml/settings/colorPicker.xml b/src/xml/settings/colorPicker.xml deleted file mode 100644 index f03a809..0000000 --- a/src/xml/settings/colorPicker.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Button name="DJBagsColorPickerTemplate" virtual="true"> - <Size x="150" y="25"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1"/> - </EdgeSize> - </Backdrop> - <NormalFont style="GameFontHighlight"/> - <HighlightFont style="GameFontHighlight"/> - <DisabledFont style="GameFontDisable"/> - <Scripts> - <OnClick> - DJBagsSettingsColorPicker_OnClick(self) - </OnClick> - </Scripts> - </Button> -</Ui> \ No newline at end of file diff --git a/src/xml/settings/containerSettings.xml b/src/xml/settings/containerSettings.xml deleted file mode 100644 index 9999c87..0000000 --- a/src/xml/settings/containerSettings.xml +++ /dev/null @@ -1,73 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsContainerSettings" hidden="false" virtual="true"> - <Size x="500" y="175"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_CONTAINER_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Button name="$parentBackgroundColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BACKGROUND_COLOR"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-15" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_CONTAINER, DJBags_SETTING_BACKGROUND_COLOR) - </OnShow> - </Scripts> - </Button> - <Button name="$parentBorderColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BORDER_COLOR"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="RIGHT" x="5" y="0" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_CONTAINER, DJBags_SETTING_BORDER_COLOR) - </OnShow> - </Scripts> - </Button> - - <Slider name="$parentPaddingSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_PADDING, 2, 10, 1, DJBags_TYPE_CONTAINER, DJBags_SETTING_PADDING) - </OnShow> - </Scripts> - </Slider> - <Slider name="$parentSpacingSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentPaddingSlider" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_SPACING, 2, 10, 1, DJBags_TYPE_CONTAINER, DJBags_SETTING_SPACING) - </OnShow> - </Scripts> - </Slider> - </Frames> - </Frame> -</Ui> diff --git a/src/xml/settings/formatterSettings.xml b/src/xml/settings/formatterSettings.xml deleted file mode 100644 index 36be2e9..0000000 --- a/src/xml/settings/formatterSettings.xml +++ /dev/null @@ -1,109 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsFormatSettings" hidden="false" virtual="true"> - <Size x="500" y="160"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_FORMAT_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Button name="$parentDropDown" parentKey="dropdown" inherits="UIDropDownMenuTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" y="-5" /> - </Anchors> - <Scripts> - <OnLoad> - UIDropDownMenu_SetWidth(self, 100); - UIDropDownMenu_SetButtonWidth(self, 124) - UIDropDownMenu_JustifyText(self, "LEFT") - </OnLoad> - </Scripts> - </Button> - <Frame name="$parentMasonry" parentKey="masonry"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentDropDown" relativePoint="BOTTOMLEFT" y="-5" /> - <Anchor point="BOTTOMRIGHT" relativeTo="$parent" x="-5" y="5" /> - </Anchors> - <Frames> - <CheckButton name="$parentVertical" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOPLEFT" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_VERTICAL, DJBags_TYPE_CONTAINER, DJBags_SETTING_FORMATTER_VERT, 2) - </OnShow> - </Scripts> - </CheckButton> - <Slider name="$parentItemsSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentVertical" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_MAX_ITEMS, 5, 20, 1, DJBags_TYPE_CONTAINER, DJBags_SETTING_FORMATTER_MAX_ITEMS, true) - </OnShow> - </Scripts> - </Slider> - </Frames> - </Frame> - <Frame name="$parentBox" parentKey="box"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentDropDown" relativePoint="BOTTOMLEFT" y="-5" /> - <Anchor point="BOTTOMRIGHT" relativeTo="$parent" x="-5" y="5" /> - </Anchors> - <Frames> - <Slider name="$parentItemsSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" > - <Offset> - <AbsDimension x="0" y="-20"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_MAX_ITEMS, 5, 20, 1, DJBags_TYPE_CONTAINER, DJBags_SETTING_FORMATTER_BOX_COLS, true) - </OnShow> - </Scripts> - </Slider> - <Slider name="$parentHeightSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentItemsSlider" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_MAX_HEIGHT, 30, 100, 1, DJBags_TYPE_CONTAINER, DJBags_SETTING_FORMATTER_MAX_HEIGHT) - </OnShow> - </Scripts> - </Slider> - </Frames> - </Frame> - </Frames> - <Scripts> - <OnShow> - DJBagsFormatSettings_OnLoad(self) - </OnShow> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/settings/itemContainerSettings.xml b/src/xml/settings/itemContainerSettings.xml deleted file mode 100644 index 5380461..0000000 --- a/src/xml/settings/itemContainerSettings.xml +++ /dev/null @@ -1,97 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsItemContainerSettings" hidden="false" virtual="true"> - <Size x="500" y="220"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_ITEM_CONTAINER_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Button name="$parentBackgroundColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BACKGROUND_COLOR"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-15" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_BACKGROUND_COLOR) - </OnShow> - </Scripts> - </Button> - <Button name="$parentBorderColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BORDER_COLOR"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="RIGHT" x="5" y="0" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_BORDER_COLOR) - </OnShow> - </Scripts> - </Button> - <Button name="$parentTextColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_TEXT_COLOR"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBorderColorSelect" relativePoint="RIGHT" x="5" y="0" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_TEXT_COLOR) - </OnShow> - </Scripts> - </Button> - - <Slider name="$parentPaddingSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_PADDING, 2, 10, 1, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_PADDING) - </OnShow> - </Scripts> - </Slider> - <Slider name="$parentSpacingSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentPaddingSlider" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_SPACING, 2, 10, 1, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_SPACING) - </OnShow> - </Scripts> - </Slider> - <Slider name="$parentTextSize" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentSpacingSlider" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_TEXT_SIZE, 8, 16, 1, DJBags_TYPE_ITEM_CONTAINER, DJBags_SETTING_TEXT_SIZE) - </OnShow> - </Scripts> - </Slider> - </Frames> - </Frame> -</Ui> diff --git a/src/xml/settings/mainBarSettings.xml b/src/xml/settings/mainBarSettings.xml deleted file mode 100644 index a1940c0..0000000 --- a/src/xml/settings/mainBarSettings.xml +++ /dev/null @@ -1,44 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsMainBarSettings" hidden="false" virtual="true"> - <Size x="500" y="65"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_MAIN_BAR_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Button name="$parentBackgroundColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BACKGROUND_COLOR"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-15" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_MAIN_BAR, DJBags_SETTING_BACKGROUND_COLOR) - </OnShow> - </Scripts> - </Button> - <Button name="$parentBorderColorSelect" inherits="DJBagsColorPickerTemplate" text="DJBags_LOCALE_BORDER_COLOR"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBackgroundColorSelect" relativePoint="RIGHT" x="5" y="0" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsColorPicker(self, DJBags_TYPE_MAIN_BAR, DJBags_SETTING_BORDER_COLOR) - </OnShow> - </Scripts> - </Button> - </Frames> - </Frame> -</Ui> diff --git a/src/xml/settings/settingsContainer.xml b/src/xml/settings/settingsContainer.xml deleted file mode 100644 index 5df8e42..0000000 --- a/src/xml/settings/settingsContainer.xml +++ /dev/null @@ -1,140 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsSettingsContainer" parent="UIParent" movable="true" enableMouse="true" inherits="DJBagsContainerTemplate"> - <Size x="545" y="600"/> - <Anchors> - <Anchor point="TOPLEFT" x="200" y="-100"/> - </Anchors> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <Frame name="DJBagsSettingsContent"> - <Size x="500" y="565" /> - <Frames> - <Frame name="$parentMainSettings" inherits="DJBagsMainSettings"> - <Anchors> - <Anchor point="TOP" /> - </Anchors> - </Frame> - <Frame name="$parentSubClassSettings" inherits="DJBagsSubClassSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentMainSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - <Frame name="$parentFormatSettings" inherits="DJBagsFormatSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentSubClassSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - <Frame name="$parentItemContainerSettings" inherits="DJBagsItemContainerSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentFormatSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - <Frame name="$parentContainerSettings" inherits="DJBagsContainerSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentItemContainerSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - <Frame name="$parentMainBarSettings" inherits="DJBagsMainBarSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentContainerSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - <Frame name="$parentBankBarSettings" inherits="DJBagsBankBarSettings"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentMainBarSettings" relativePoint="BOTTOM" y="-5" /> - </Anchors> - </Frame> - </Frames> - </Frame> - <ScrollFrame name="DJBagsSettingsScrollFrame"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" y="-15" /> - <Anchor point="RIGHT" relativeTo="$parent" relativePoint="RIGHT" x="-25" /> - <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM" y="25" /> - </Anchors> - <Scripts> - <OnLoad> - self:EnableMouseWheel(true) - self:SetScrollChild(_G['DJBagsSettingsContent']) - </OnLoad> - <OnMouseWheel> - local scrollBar = _G['DJBagsSettingsContainerScrollBar'] - local current = scrollBar:GetValue() - - local _, max = scrollBar:GetMinMaxValues() - - local up = delta > 0 - if IsShiftKeyDown() and up then - scrollBar:SetValue(0) - elseif IsShiftKeyDown() and not up then - scrollBar:SetValue(max) - elseif not up and not (current >= max) then - scrollBar:SetValue(math.min(current + 20, max)) - elseif up and (current > 1) then - scrollBar:SetValue(math.max(current - 20, 0)) - end - </OnMouseWheel> - </Scripts> - </ScrollFrame> - <Slider name="$parentScrollBar" inherits="UIPanelScrollBarTemplate" minValue="0" maxValue="480" defaultValuie="1" valueStep="1"> - <Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" - edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true"> - <EdgeSize val="8"/> - <TileSize val="8"/> - <BackgroundInsets left="3" right="3" top="6" bottom="6"/> - </Backdrop> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="DJBagsSettingsScrollFrame" relativePoint="TOPRIGHT" x="5" /> - <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM" y="25" /> - </Anchors> - <Scripts> - <OnLoad> - self:SetValue(0) - </OnLoad> - <OnValueChanged> - DJBagsSettingsScrollFrame:SetVerticalScroll(value) - </OnValueChanged> - </Scripts> - </Slider> - <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton"> - <Anchors> - <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/> - </Anchors> - <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" /> - <Scripts> - <OnLoad> - self:SetAlpha(0.2) - </OnLoad> - <OnEnter> - self:SetAlpha(1) - </OnEnter> - <OnLeave> - self:SetAlpha(0.2) - </OnLeave> - </Scripts> - </Button> - </Frames> - <Scripts> - <OnLoad> - table.insert(UISpecialFrames, self:GetName()) - self:RegisterForDrag("LeftButton") - self:SetScript("OnDragStart", self.StartMoving) - self:SetScript("OnDragStop", self.StopMovingOrSizing) - self:SetUserPlaced(true) - - function self:Open() - self:Show() - end - </OnLoad> - </Scripts> - </Frame> -</Ui> diff --git a/src/xml/settings/slider.xml b/src/xml/settings/slider.xml deleted file mode 100644 index 42ca122..0000000 --- a/src/xml/settings/slider.xml +++ /dev/null @@ -1,11 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Slider name="DJBagsSettingsSliderTemplate" inherits="OptionsSliderTemplate" virtual="true"> - <Size x="460" y="15" /> - <Scripts> - <OnValueChanged> - DJBagsSettingsSlider_OnChange(self, value) - </OnValueChanged> - </Scripts> - </Slider> -</Ui> \ No newline at end of file diff --git a/src/xml/settings/subClassSettings.xml b/src/xml/settings/subClassSettings.xml deleted file mode 100644 index f473123..0000000 --- a/src/xml/settings/subClassSettings.xml +++ /dev/null @@ -1,134 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsSubClassSettings" hidden="false" virtual="true"> - <Size x="500" y="150"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_SUB_CLASS_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <CheckButton name="$parentArmorCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-5" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_ARMOR, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_ARMOR, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentConsumableCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentArmorCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_CONSUMABLES, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_CONSUMABLE, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentGemsCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentConsumableCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_GEMS, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_GEM, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentGlyphCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentArmorCheckBox" relativePoint="BOTTOM" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_GLYPHS, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_GLYPH, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentItemEnhancementCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentGlyphCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_ITEM_ENHANCEMENT, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_ITEM_ENHANCEMENT, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentMiscCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentItemEnhancementCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_MISCELLANEOUS, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_MISCELLANEOUS, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentRecipesCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentGlyphCheckBox" relativePoint="BOTTOM" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_RECIPES, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_RECIPE, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentTradeGoodsCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentRecipesCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_TRADE_GOODS, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_TRADEGOODS, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentWeaponsCheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentTradeGoodsCheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, AUCTION_CATEGORY_WEAPONS, DJBags_TYPE_SUB_CLASS, LE_ITEM_CLASS_WEAPON, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentBOECheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOP" relativeTo="$parentRecipesCheckBox" relativePoint="BOTTOM" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_BOE, DJBags_TYPE_SUB_CLASS, DJBags_SETTING_BOE, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentBOACheckBox" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentBOECheckBox" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_BOA, DJBags_TYPE_SUB_CLASS, DJBags_SETTING_BOA, 2) - </OnShow> - </Scripts> - </CheckButton> - </Frames> - </Frame> -</Ui> diff --git a/src/xml/settings/toggleSettings.xml b/src/xml/settings/toggleSettings.xml deleted file mode 100644 index 90e1434..0000000 --- a/src/xml/settings/toggleSettings.xml +++ /dev/null @@ -1,78 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> - <Frame name="DJBagsMainSettings" hidden="false" virtual="true"> - <Size x="500" y="145"/> - <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8"> - <EdgeSize> - <AbsValue val="1" /> - </EdgeSize> - <Color r="0" g="0" b="0" a="0.6" /> - <BorderColor r="0.3" g="0.3" b="0.3" a="1" /> - </Backdrop> - <Layers> - <Layer level="ARTWORK"> - <FontString name="$parentName" inherits="GameFontNormal" text="DJBags_LOCALE_MAIN_SETTINGS"> - <Anchors> - <Anchor point="TOPLEFT" x="15" y="-5"/> - </Anchors> - </FontString> - </Layer> - </Layers> - <Frames> - <CheckButton name="$parentAutoSellJunk" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentName" relativePoint="BOTTOMLEFT" x="5" y="-5" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_SELL_JUNK, DJBags_TYPE_MAIN, DJBags_SETTING_SELL_JUNK) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentDepositReagents" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentAutoSellJunk" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_DEPOSIT_REAGENT, DJBags_TYPE_MAIN, DJBags_SETTING_DEPOSIT_REAGENT) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentStackAllItems" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="LEFT" relativeTo="$parentDepositReagents" relativePoint="RIGHT" x="140" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_STACK_ALL, DJBags_TYPE_MAIN, DJBags_SETTING_STACK_ALL, 2) - </OnShow> - </Scripts> - </CheckButton> - <CheckButton name="$parentClearNewItems" inherits="DJBagsSettingsCheckBoxTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentAutoSellJunk" relativePoint="BOTTOMLEFT" /> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsCheckBox(self, DJBags_LOCALE_CLEAR_NEW_ITEMS, DJBags_TYPE_MAIN, DJBags_SETTING_CLEAR_NEW_ITEMS) - </OnShow> - </Scripts> - </CheckButton> - <Slider name="$parentScaleSlider" inherits="DJBagsSettingsSliderTemplate"> - <Anchors> - <Anchor point="TOPLEFT" relativeTo="$parentClearNewItems" relativePoint="BOTTOMLEFT"> - <Offset> - <AbsDimension x="0" y="-32"/> - </Offset> - </Anchor> - </Anchors> - <Scripts> - <OnShow> - DJBagsInitSettingsSlider(self, DJBags_LOCALE_SCALE, 0.5, 2, 0.1, DJBags_TYPE_MAIN, DJBags_SETTING_SCALE) - </OnShow> - </Scripts> - </Slider> - </Frames> - </Frame> -</Ui>