Added bag sort capability to the inventory frame
This commit is contained in:
@ -1,13 +1,18 @@
|
|||||||
local MBC = "MyBagsCore-1.0"
|
local MBC = "MyBagsCore-1.0"
|
||||||
local MBC_MINOR = "2014.10.22.5"
|
local MBC_MINOR = "2015.01.05.3"
|
||||||
if not LibStub then error(MBC .. " requires LibStub.") end
|
if not LibStub then
|
||||||
|
error(MBC .. " requires LibStub.")
|
||||||
|
end
|
||||||
|
|
||||||
local MyBagsCore = LibStub:NewLibrary(MBC, MBC_MINOR)
|
local MyBagsCore = LibStub:NewLibrary(MBC, MBC_MINOR)
|
||||||
if not MyBagsCore then return end
|
if not MyBagsCore then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
MyBagsCore.embeds = MyBagsCore.embeds or {} -- table containing objects MyBagsCore is embedded in.
|
MyBagsCore.embeds = MyBagsCore.embeds or {} -- table containing objects MyBagsCore is embedded in.
|
||||||
|
|
||||||
local AC = LibStub("AceConsole-3.0");
|
local AC = LibStub("AceConsole-3.0")
|
||||||
assert(AC, MBC .. " requires AceConsole-3.0");
|
assert(AC, MBC .. " requires AceConsole-3.0")
|
||||||
|
|
||||||
local MYBAGS_BOTTOMOFFSET = 20
|
local MYBAGS_BOTTOMOFFSET = 20
|
||||||
local MYBAGS_COLWIDTH = 40
|
local MYBAGS_COLWIDTH = 40
|
||||||
@ -27,7 +32,7 @@ local MYBAGS_HERBCOLOR = { 0.0, 0.6, 0.0 }
|
|||||||
local MYBAGS_GEMCOLOR = { 0.0, 0.6, 0.6 }
|
local MYBAGS_GEMCOLOR = { 0.0, 0.6, 0.6 }
|
||||||
local MYBAGS_MININGCOLOR = { 0.0, 0.0, 0.6 }
|
local MYBAGS_MININGCOLOR = { 0.0, 0.0, 0.6 }
|
||||||
|
|
||||||
local ACEG_MAP_ONOFF = {[0]="|cffff5050Off|r",[1]="|cff00ff00On|r"}
|
local ACEG_MAP_ONOFF = {[0]="|cffff5050Off|r",[1]="|cff00ff00On|r"}
|
||||||
|
|
||||||
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
local L = LibStub("AceLocale-3.0"):GetLocale("MyBags")
|
||||||
|
|
||||||
@ -39,35 +44,35 @@ local tostring, tonumber, select = tostring, tonumber, select
|
|||||||
local CreateFrame = _G.CreateFrame
|
local CreateFrame = _G.CreateFrame
|
||||||
|
|
||||||
local mb_options = {
|
local mb_options = {
|
||||||
type = "group",
|
type = "group",
|
||||||
args = {
|
args = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function tostr(str)
|
local function tostr(str)
|
||||||
return tostring(str or "")
|
return tostring(str or "")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tonum(val)
|
local function tonum(val)
|
||||||
return tonumber(val or 0)
|
return tonumber(val or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ColorConvertHexToDigit(h)
|
local function ColorConvertHexToDigit(h)
|
||||||
if (strlen(h) ~= 6) then
|
if (strlen(h) ~= 6) then
|
||||||
return 0, 0, 0
|
return 0, 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local r = {
|
local r = {
|
||||||
a = 10,
|
a = 10,
|
||||||
b = 11,
|
b = 11,
|
||||||
c = 12,
|
c = 12,
|
||||||
d = 13,
|
d = 13,
|
||||||
e = 14,
|
e = 14,
|
||||||
f = 15
|
f = 15
|
||||||
}
|
}
|
||||||
return ((tonumber(strsub(h,1,1)) or r[strsub(h,1,1)] or 0) * 16 + (tonumber(strsub(h,2,2)) or r[strsub(h,2,2)] or 0))/255,
|
return ((tonumber(strsub(h,1,1)) or r[strsub(h,1,1)] or 0) * 16 + (tonumber(strsub(h,2,2)) or r[strsub(h,2,2)] or 0))/255,
|
||||||
((tonumber(strsub(h,3,3)) or r[strsub(h,3,3)] or 0) * 16 + (tonumber(strsub(h,4,4)) or r[strsub(h,4,4)] or 0))/255,
|
((tonumber(strsub(h,3,3)) or r[strsub(h,3,3)] or 0) * 16 + (tonumber(strsub(h,4,4)) or r[strsub(h,4,4)] or 0))/255,
|
||||||
((tonumber(strsub(h,5,5)) or r[strsub(h,5,5)] or 0) * 16 + (tonumber(strsub(h,6,6)) or r[strsub(h,6,6)] or 0))/255
|
((tonumber(strsub(h,5,5)) or r[strsub(h,5,5)] or 0) * 16 + (tonumber(strsub(h,6,6)) or r[strsub(h,6,6)] or 0))/255
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetItemInfoFromLink(l)
|
local function GetItemInfoFromLink(l)
|
||||||
@ -187,7 +192,7 @@ function MyBagsCore:OnEmbedInitialize(addon)
|
|||||||
|
|
||||||
addon.SetOpt = function(var,val)
|
addon.SetOpt = function(var,val)
|
||||||
local prof = addon.db:GetCurrentProfile()
|
local prof = addon.db:GetCurrentProfile()
|
||||||
addon.db.profiles[prof][var] = val;
|
addon.db.profiles[prof][var] = val
|
||||||
end
|
end
|
||||||
|
|
||||||
addon.TogOpt = function(var)
|
addon.TogOpt = function(var)
|
||||||
@ -248,16 +253,16 @@ function MyBagsCore:OnEmbedInitialize(addon)
|
|||||||
LibStub("AceConfig-3.0"):RegisterOptionsTable(addon.name, addon.options)
|
LibStub("AceConfig-3.0"):RegisterOptionsTable(addon.name, addon.options)
|
||||||
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addon.name, addon.name, "MyBags")
|
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addon.name, addon.name, "MyBags")
|
||||||
|
|
||||||
local charName = strtrim(UnitName("player"));
|
local charName = strtrim(UnitName("player"))
|
||||||
local realmName = strtrim(GetRealmName());
|
local realmName = strtrim(GetRealmName())
|
||||||
-- self.atBank = false
|
-- self.atBank = false
|
||||||
addon.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
addon.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
||||||
end
|
end
|
||||||
|
|
||||||
-- OnEnable
|
-- OnEnable
|
||||||
function MyBagsCore:OnEmbedEnable(addon)
|
function MyBagsCore:OnEmbedEnable(addon)
|
||||||
addon:RegisterEvents();
|
addon:RegisterEvents()
|
||||||
addon:HookFunctions();
|
addon:HookFunctions()
|
||||||
if addon.GetOpt("Scale") then
|
if addon.GetOpt("Scale") then
|
||||||
addon.frame:SetScale(addon.GetOpt("Scale"))
|
addon.frame:SetScale(addon.GetOpt("Scale"))
|
||||||
end
|
end
|
||||||
@ -289,10 +294,10 @@ function MyBagsCore:RegisterEvents(obj)
|
|||||||
self = obj
|
self = obj
|
||||||
end
|
end
|
||||||
|
|
||||||
self:RegisterEvent("BAG_UPDATE");
|
self:RegisterEvent("BAG_UPDATE")
|
||||||
self:RegisterEvent("BAG_UPDATE_COOLDOWN", "LayoutFrameOnEvent")
|
self:RegisterEvent("BAG_UPDATE_COOLDOWN", "LayoutFrameOnEvent")
|
||||||
-- self:RegisterEvent("UNIT_INVENTORY_CHANGED", "UNIT_INVENTORY_CHANGED");
|
-- self:RegisterEvent("UNIT_INVENTORY_CHANGED", "UNIT_INVENTORY_CHANGED")
|
||||||
self:RegisterEvent("ITEM_LOCK_CHANGED", "LayoutFrameOnEvent");
|
self:RegisterEvent("ITEM_LOCK_CHANGED", "LayoutFrameOnEvent")
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:HookFunctions(obj)
|
function MyBagsCore:HookFunctions(obj)
|
||||||
@ -399,8 +404,8 @@ function MyBagsCore:GetCurrentPlayer()
|
|||||||
return self.Player
|
return self.Player
|
||||||
end
|
end
|
||||||
|
|
||||||
local charName = strtrim(UnitName("player"));
|
local charName = strtrim(UnitName("player"))
|
||||||
local realmName = strtrim(GetRealmName());
|
local realmName = strtrim(GetRealmName())
|
||||||
return charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
return charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -429,8 +434,8 @@ function MyBagsCore:Open()
|
|||||||
self.frame:Show()
|
self.frame:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local charName = strtrim(UnitName("player"));
|
local charName = strtrim(UnitName("player"))
|
||||||
local realmName = strtrim(GetRealmName());
|
local realmName = strtrim(GetRealmName())
|
||||||
self.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
self.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
||||||
|
|
||||||
if self.Player then
|
if self.Player then
|
||||||
@ -597,8 +602,8 @@ function MyBagsCore:GetInfo(bag, slot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:GetInfoLive(bag, slot)
|
function MyBagsCore:GetInfoLive(bag, slot)
|
||||||
local charName = strtrim(UnitName("player"));
|
local charName = strtrim(UnitName("player"))
|
||||||
local realmName = strtrim(GetRealmName());
|
local realmName = strtrim(GetRealmName())
|
||||||
self.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
self.Player = charName .. L["CHARACTER_DELIMITOR"] .. realmName
|
||||||
if slot ~= nil then
|
if slot ~= nil then
|
||||||
-- it's an item
|
-- it's an item
|
||||||
@ -627,7 +632,7 @@ function MyBagsCore:GetInfoLive(bag, slot)
|
|||||||
readable = IsSpecialtyBagFromLink(itemLink)
|
readable = IsSpecialtyBagFromLink(itemLink)
|
||||||
elseif (bag == -1) then
|
elseif (bag == -1) then
|
||||||
texture = "Interface\\Buttons\\Button-Backpack-Up"
|
texture = "Interface\\Buttons\\Button-Backpack-Up"
|
||||||
count = 28;
|
count = 28
|
||||||
elseif (bag == 0) then
|
elseif (bag == 0) then
|
||||||
texture = "Interface\\Buttons\\Button-Backpack-Up"
|
texture = "Interface\\Buttons\\Button-Backpack-Up"
|
||||||
count = 16
|
count = 16
|
||||||
@ -748,9 +753,9 @@ end
|
|||||||
|
|
||||||
--ITEMBUTTONS--
|
--ITEMBUTTONS--
|
||||||
function MyBagsCore:ItemButton_OnLoad(widget)
|
function MyBagsCore:ItemButton_OnLoad(widget)
|
||||||
_G[widget:GetName().."NormalTexture"]:SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button");
|
_G[widget:GetName().."NormalTexture"]:SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button")
|
||||||
ContainerFrameItemButton_OnLoad(widget)
|
ContainerFrameItemButton_OnLoad(widget)
|
||||||
widget.UpdateTooltip = widget.ItemButton_OnEnter;
|
widget.UpdateTooltip = widget.ItemButton_OnEnter
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:ItemButton_OnLeave(widget)
|
function MyBagsCore:ItemButton_OnLeave(widget)
|
||||||
@ -762,8 +767,8 @@ function MyBagsCore:ItemButton_OnLeave(widget)
|
|||||||
CursorUpdate(widget)
|
CursorUpdate(widget)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
function MyBagsCore:ItemButton_OnClick(widget, button)
|
function MyBagsCore:ItemButton_OnClick(widget, button)
|
||||||
|
--[[
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
if widget.hasItem then
|
if widget.hasItem then
|
||||||
self.watchLock = 1
|
self.watchLock = 1
|
||||||
@ -775,17 +780,17 @@ function MyBagsCore:ItemButton_OnClick(widget, button)
|
|||||||
ContainerFrameItemButton_OnClick(widget, button)
|
ContainerFrameItemButton_OnClick(widget, button)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
]]
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
function MyBagsCore:ItemButton_OnModifiedClick(widget, button)
|
function MyBagsCore:ItemButton_OnModifiedClick(widget, button)
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
-- if self.isBank and widget:GetParent():GetID() == BANK_CONTAINER then
|
-- if self.isBank and widget:GetParent():GetID() == BANK_CONTAINER then
|
||||||
-- BankFrameItemButtonGeneric_OnModifiedClick(widget, button)
|
-- BankFrameItemButtonGeneric_OnModifiedClick(widget, button)
|
||||||
-- StackSplitFrame:SetFrameStrata("TOOLTIP");
|
-- StackSplitFrame:SetFrameStrata("TOOLTIP")
|
||||||
-- else
|
-- else
|
||||||
-- ContainerFrameItemButton_OnModifiedClick(widget, button)
|
-- ContainerFrameItemButton_OnModifiedClick(widget, button)
|
||||||
-- StackSplitFrame:SetFrameStrata("TOOLTIP");
|
-- StackSplitFrame:SetFrameStrata("TOOLTIP")
|
||||||
-- end
|
-- end
|
||||||
else
|
else
|
||||||
if (button == "LeftButton") then
|
if (button == "LeftButton") then
|
||||||
@ -805,7 +810,7 @@ function MyBagsCore:ItemButton_OnModifiedClick(widget, button)
|
|||||||
ChatEdit_InsertLink(hyperLink)
|
ChatEdit_InsertLink(hyperLink)
|
||||||
end
|
end
|
||||||
|
|
||||||
StackSplitFrame:Hide();
|
StackSplitFrame:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -865,16 +870,27 @@ end
|
|||||||
--BAGBUTTONS--
|
--BAGBUTTONS--
|
||||||
function MyBagsCore:BagButton_OnEnter(widget)
|
function MyBagsCore:BagButton_OnEnter(widget)
|
||||||
local bagFrame = widget:GetParent()
|
local bagFrame = widget:GetParent()
|
||||||
|
local bagID = bagFrame:GetID()
|
||||||
local setTooltip = true
|
local setTooltip = true
|
||||||
self:TooltipSetOwner(widget)
|
self:TooltipSetOwner(widget)
|
||||||
if self.isLive then
|
if self.isLive then
|
||||||
local invSlot = self:BagIDToInvSlotID(bagFrame:GetID())
|
if (bagID == 0) then
|
||||||
|
GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0, 1.0, 1.0)
|
||||||
|
else
|
||||||
|
--
|
||||||
|
end
|
||||||
|
|
||||||
|
local invSlot = self:BagIDToInvSlotID(bagID)
|
||||||
if not invSlot or (not GameTooltip:SetInventoryItem("player", invSlot)) then
|
if not invSlot or (not GameTooltip:SetInventoryItem("player", invSlot)) then
|
||||||
setTooltip = false
|
setTooltip = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (bagID == 0 or not IsInventoryItemProfessionBag("player", ContainerIDToInventoryID(bagID))) then
|
||||||
|
GameTooltip:AddLine(CLICK_BAG_SETTINGS)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local ID = select(3, self:GetInfo(widget:GetParent():GetID()))
|
local ID = select(3, self:GetInfo(bagID))
|
||||||
if bagFrame:GetID() == 0 then
|
if bagID == 0 then
|
||||||
GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0)
|
GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0)
|
||||||
elseif ID then
|
elseif ID then
|
||||||
local hyperlink = self:GetHyperlink(ID)
|
local hyperlink = self:GetHyperlink(ID)
|
||||||
@ -887,9 +903,8 @@ function MyBagsCore:BagButton_OnEnter(widget)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not setTooltip then
|
if not setTooltip then
|
||||||
local keyBinding
|
|
||||||
if self.isBank then
|
if self.isBank then
|
||||||
if self.isLive and not self:IsBagSlotUsable(bagFrame:GetID()) then
|
if self.isLive and not self:IsBagSlotUsable(bagID) then
|
||||||
GameTooltip:SetText(BANK_BAG_PURCHASE)
|
GameTooltip:SetText(BANK_BAG_PURCHASE)
|
||||||
if MyBank.atBank then
|
if MyBank.atBank then
|
||||||
local cost = GetBankSlotCost()
|
local cost = GetBankSlotCost()
|
||||||
@ -902,18 +917,15 @@ function MyBagsCore:BagButton_OnEnter(widget)
|
|||||||
end
|
end
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
keyBinding = GetBindingKey("TOGGLEBAG" .. (4 - widget:GetID()))
|
|
||||||
else
|
else
|
||||||
GameTooltip:SetText(BANK_BAG)
|
GameTooltip:SetText(BANK_BAG)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if bagFrame:GetID() == 0 then
|
if bagID ~= 0 then
|
||||||
-- SetScript("OnEnter", MainMenuBarBackpackButton:GetScript("OnEnter"))
|
|
||||||
GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0)
|
|
||||||
keyBinding = GetBindingKey("TOGGLEBACKPACK")
|
|
||||||
else
|
|
||||||
GameTooltip:SetText(EQUIP_CONTAINER)
|
GameTooltip:SetText(EQUIP_CONTAINER)
|
||||||
|
else
|
||||||
|
-- SetScript("OnEnter", MainMenuBarBackpackButton:GetScript("OnEnter"))
|
||||||
|
-- GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -928,10 +940,12 @@ function MyBagsCore:BagButton_OnEnter(widget)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:BagButton_OnLeave(widget)
|
function MyBagsCore:BagButton_OnLeave(widget)
|
||||||
SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0);
|
SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0)
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
local i
|
local i
|
||||||
for i = 1, self.GetOpt("MAXBAGSLOTS") do
|
for i = 1, self.GetOpt("MAXBAGSLOTS") do
|
||||||
@ -1023,6 +1037,7 @@ function MyBagsCore:LayoutOptions()
|
|||||||
local cash = _G[self.frameName .. "MoneyFrame"]
|
local cash = _G[self.frameName .. "MoneyFrame"]
|
||||||
local slots = _G[self.frameName .. "Slots"]
|
local slots = _G[self.frameName .. "Slots"]
|
||||||
local buttons = _G[self.frameName .. "Buttons"]
|
local buttons = _G[self.frameName .. "Buttons"]
|
||||||
|
local sortButton = _G[self.frameName .. "SortButton"]
|
||||||
|
|
||||||
local search = _G[self.frameName .. "SearchBox"]
|
local search = _G[self.frameName .. "SearchBox"]
|
||||||
if search then
|
if search then
|
||||||
@ -1054,31 +1069,31 @@ function MyBagsCore:LayoutOptions()
|
|||||||
cash:Hide()
|
cash:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local token = _G[self.frameName .. "TokenFrame"]
|
||||||
if self.GetOpt("Token") and ManageBackpackTokenFrame then
|
if self.GetOpt("Token") and ManageBackpackTokenFrame then
|
||||||
local token = _G[self.frameName .. "TokenFrame"]
|
|
||||||
if (BackpackTokenFrame_IsShown()) then
|
if (BackpackTokenFrame_IsShown()) then
|
||||||
token:SetParent(self.frameName)
|
token:SetParent(self.frameName)
|
||||||
token:SetPoint("RIGHT", cash, "LEFT", -10, 0)
|
token:SetPoint("RIGHT", cash, "LEFT", -10, 0)
|
||||||
local i
|
local i
|
||||||
for i=1, MAX_WATCHED_TOKENS do
|
for i=1, MAX_WATCHED_TOKENS do
|
||||||
local name, count, icon, currencyID = GetBackpackCurrencyInfo(i);
|
local name, count, icon, currencyID = GetBackpackCurrencyInfo(i)
|
||||||
-- Update watched tokens
|
-- Update watched tokens
|
||||||
local watchButton = _G[self.frameName .. "TokenFrameToken"..i];
|
local watchButton = _G[self.frameName .. "TokenFrameToken"..i]
|
||||||
if ( name ) then
|
if ( name ) then
|
||||||
watchButton.icon:SetTexture(icon);
|
watchButton.icon:SetTexture(icon)
|
||||||
if ( count <= 99999 ) then
|
if ( count <= 99999 ) then
|
||||||
watchButton.count:SetText(count);
|
watchButton.count:SetText(count)
|
||||||
else
|
else
|
||||||
watchButton.count:SetText("*");
|
watchButton.count:SetText("*")
|
||||||
end
|
end
|
||||||
watchButton.currencyID = currencyID;
|
watchButton.currencyID = currencyID
|
||||||
watchButton:Show();
|
watchButton:Show()
|
||||||
BackpackTokenFrame.shouldShow = 1;
|
BackpackTokenFrame.shouldShow = 1
|
||||||
BackpackTokenFrame.numWatchedTokens = i;
|
BackpackTokenFrame.numWatchedTokens = i
|
||||||
else
|
else
|
||||||
watchButton:Hide();
|
watchButton:Hide()
|
||||||
if ( i == 1 ) then
|
if ( i == 1 ) then
|
||||||
BackpackTokenFrame.shouldShow = nil;
|
BackpackTokenFrame.shouldShow = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1087,6 +1102,7 @@ function MyBagsCore:LayoutOptions()
|
|||||||
token:Hide()
|
token:Hide()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
token:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.GetOpt("Buttons") then
|
if self.GetOpt("Buttons") then
|
||||||
@ -1170,6 +1186,28 @@ function MyBagsCore:LayoutOptions()
|
|||||||
else
|
else
|
||||||
self.aioiOrder = false
|
self.aioiOrder = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.isLive and self.GetOpt("BagSort") then
|
||||||
|
-- sortButton:ClearAllPoints()
|
||||||
|
sortButton:SetPoint("TOPRIGHT", search, "TOPLEFT", -20, 1)
|
||||||
|
sortButton:SetScript("OnEnter", nil)
|
||||||
|
sortButton:SetScript("OnLeave", nil)
|
||||||
|
sortButton:SetScript("OnClick", function()
|
||||||
|
self:SortBags();
|
||||||
|
end)
|
||||||
|
--[[
|
||||||
|
if search:IsShown() then
|
||||||
|
sortButton:SetPoint("TOPRIGHT", search, "TOPLEFT", -8, 0)
|
||||||
|
elseif playerSelectFrame:IsShown() then
|
||||||
|
sortButton:SetPoint("TOPRIGHT", playerSelectFrame, "TOPLEFT", -8, 0)
|
||||||
|
else
|
||||||
|
sortButton:SetPoint("TOPRIGHT", self.frameName, "TOPRIGHT", -8, -32)
|
||||||
|
end
|
||||||
|
]]
|
||||||
|
sortButton:Show()
|
||||||
|
else
|
||||||
|
sortButton:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:UpdateTitle()
|
function MyBagsCore:UpdateTitle()
|
||||||
@ -1351,13 +1389,12 @@ function MyBagsCore:LayoutBagFrame(bagFrame)
|
|||||||
itemButton = _G[itemBase .. slot]
|
itemButton = _G[itemBase .. slot]
|
||||||
else
|
else
|
||||||
itemButton = CreateFrame("Button", itemBase .. slot, bagFrame, "MyBagsItemButtonTemplate")
|
itemButton = CreateFrame("Button", itemBase .. slot, bagFrame, "MyBagsItemButtonTemplate")
|
||||||
-- print("Button " .. itemBase .. slot .. " created");
|
|
||||||
end
|
end
|
||||||
-- local itemButton = () or CreateFrame("Button", itemBase .. slot, bagFrame, "MyBagsItemButtonTemplate")
|
|
||||||
if (self:IsLive()) then
|
if (self:IsLive()) then
|
||||||
itemButton:SetID(slot);
|
itemButton:SetID(slot)
|
||||||
else
|
else
|
||||||
itemButton:SetID(slot + 1000);
|
itemButton:SetID(slot + 1000)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.curCol >= self.GetOpt("Columns") then
|
if self.curCol >= self.GetOpt("Columns") then
|
||||||
@ -1366,37 +1403,37 @@ function MyBagsCore:LayoutBagFrame(bagFrame)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local newItemTexture = _G[itemBase .. slot].NewItemTexture
|
local newItemTexture = _G[itemBase .. slot].NewItemTexture
|
||||||
local flash = _G[itemBase .. slot].flashAnim;
|
local flash = _G[itemBase .. slot].flashAnim
|
||||||
local newItemAnim = _G[itemBase .. slot].newitemglowAnim;
|
local newItemAnim = _G[itemBase .. slot].newitemglowAnim
|
||||||
local isNewItem = C_NewItems.IsNewItem(bagFrame:GetID(), itemButton:GetID())
|
local isNewItem = C_NewItems.IsNewItem(bagFrame:GetID(), itemButton:GetID())
|
||||||
local isBattlePayItem = IsBattlePayItem(bagFrame:GetID(), itemButton:GetID())
|
local isBattlePayItem = IsBattlePayItem(bagFrame:GetID(), itemButton:GetID())
|
||||||
|
|
||||||
local battlepayItemTexture = _G[itemBase .. slot].BattlepayItemTexture;
|
local battlepayItemTexture = _G[itemBase .. slot].BattlepayItemTexture
|
||||||
battlepayItemTexture:Hide();
|
battlepayItemTexture:Hide()
|
||||||
|
|
||||||
if (isNewItem) then
|
if (isNewItem) then
|
||||||
if (isBattlePayItem) then
|
if (isBattlePayItem) then
|
||||||
newItemTexture:Hide();
|
newItemTexture:Hide()
|
||||||
battlepayItemTexture:Show();
|
battlepayItemTexture:Show()
|
||||||
else
|
else
|
||||||
if (quality and NEW_ITEM_ATLAS_BY_QUALITY[quality]) then
|
if (quality and NEW_ITEM_ATLAS_BY_QUALITY[quality]) then
|
||||||
newItemTexture:SetAtlas(NEW_ITEM_ATLAS_BY_QUALITY[quality]);
|
newItemTexture:SetAtlas(NEW_ITEM_ATLAS_BY_QUALITY[quality])
|
||||||
else
|
else
|
||||||
newItemTexture:SetAtlas("bags-glow-white");
|
newItemTexture:SetAtlas("bags-glow-white")
|
||||||
end
|
end
|
||||||
battlepayItemTexture:Hide();
|
battlepayItemTexture:Hide()
|
||||||
newItemTexture:Show();
|
newItemTexture:Show()
|
||||||
end
|
end
|
||||||
if (not flash:IsPlaying() and not newItemAnim:IsPlaying()) then
|
if (not flash:IsPlaying() and not newItemAnim:IsPlaying()) then
|
||||||
flash:Play();
|
flash:Play()
|
||||||
newItemAnim:Play();
|
newItemAnim:Play()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
battlepayItemTexture:Hide();
|
battlepayItemTexture:Hide()
|
||||||
newItemTexture:Hide();
|
newItemTexture:Hide()
|
||||||
if (flash:IsPlaying() or newItemAnim:IsPlaying()) then
|
if (flash:IsPlaying() or newItemAnim:IsPlaying()) then
|
||||||
flash:Stop();
|
flash:Stop()
|
||||||
newItemAnim:Stop();
|
newItemAnim:Stop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1537,6 +1574,12 @@ function MyBagsCore:LayoutFrameOnEvent(event, unit)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MyBagsCore:SortBags()
|
||||||
|
PlaySound("UI_BagSorting_01")
|
||||||
|
SortBags()
|
||||||
|
self:LayoutFrame()
|
||||||
|
end
|
||||||
|
|
||||||
function MyBagsCore:LockButton_OnClick()
|
function MyBagsCore:LockButton_OnClick()
|
||||||
self.TogOpt("Lock")
|
self.TogOpt("Lock")
|
||||||
self:SetLockTexture()
|
self:SetLockTexture()
|
||||||
@ -1697,6 +1740,11 @@ function MyBagsCore:SetStrata(strata)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MyBagsCore:SetBagSort()
|
||||||
|
self.TogMsg("BagSort", "Bag sorting")
|
||||||
|
self:LayoutFrame()
|
||||||
|
end
|
||||||
|
|
||||||
function MyBagsCore:ResetSettings()
|
function MyBagsCore:ResetSettings()
|
||||||
self.db:ResetProfile()
|
self.db:ResetProfile()
|
||||||
local prof = self.db:GetCurrentProfile()
|
local prof = self.db:GetCurrentProfile()
|
||||||
@ -1801,13 +1849,13 @@ function MyBagsCore:BagSearch_OnTextChanged()
|
|||||||
local search = _G[self.frameName .. "SearchBox"]
|
local search = _G[self.frameName .. "SearchBox"]
|
||||||
local text = search:GetText()
|
local text = search:GetText()
|
||||||
if (text == SEARCH) then
|
if (text == SEARCH) then
|
||||||
text = "";
|
text = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
if (text ~= "") then
|
if (text ~= "") then
|
||||||
search.clearButton:Show();
|
search.clearButton:Show()
|
||||||
else
|
else
|
||||||
search.clearButton:Hide();
|
search.clearButton:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
self:LayoutFrame()
|
self:LayoutFrame()
|
||||||
@ -1820,16 +1868,16 @@ function MyBagsCore:BagSearch_OnEditFocusGained()
|
|||||||
search.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
|
search.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
|
||||||
local text = search:GetText()
|
local text = search:GetText()
|
||||||
if (text == SEARCH) then
|
if (text == SEARCH) then
|
||||||
text = "";
|
text = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
search.clearButton:Show();
|
search.clearButton:Show()
|
||||||
search:SetText(text)
|
search:SetText(text)
|
||||||
self:LayoutFrame()
|
self:LayoutFrame()
|
||||||
end
|
end
|
||||||
|
|
||||||
function MyBagsCore:GetCoreVersion()
|
function MyBagsCore:GetCoreVersion()
|
||||||
return MBC .. " version " .. MBC_MINOR;
|
return MBC .. " version " .. MBC_MINOR
|
||||||
end
|
end
|
||||||
|
|
||||||
local mixins = {
|
local mixins = {
|
||||||
@ -1879,6 +1927,7 @@ local mixins = {
|
|||||||
"LayoutBagFrame",
|
"LayoutBagFrame",
|
||||||
"LayoutFrame",
|
"LayoutFrame",
|
||||||
"LayoutFrameOnEvent",
|
"LayoutFrameOnEvent",
|
||||||
|
"SortBags",
|
||||||
"LockButton_OnClick",
|
"LockButton_OnClick",
|
||||||
"SetColumns",
|
"SetColumns",
|
||||||
"SetReplace",
|
"SetReplace",
|
||||||
@ -1900,6 +1949,7 @@ local mixins = {
|
|||||||
"SetCount",
|
"SetCount",
|
||||||
"SetScale",
|
"SetScale",
|
||||||
"SetStrata",
|
"SetStrata",
|
||||||
|
"SetBagSort",
|
||||||
"ResetSettings",
|
"ResetSettings",
|
||||||
"ResetAnchor",
|
"ResetAnchor",
|
||||||
"SetAnchor",
|
"SetAnchor",
|
||||||
|
|||||||
@ -366,6 +366,22 @@
|
|||||||
<Frame name="$parentBag4" inherits="MyBagsContainerTemplate" id="4"/>
|
<Frame name="$parentBag4" inherits="MyBagsContainerTemplate" id="4"/>
|
||||||
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
|
<Frame name="$parentButtons" inherits="MyBagsButtonBarTemplate"/>
|
||||||
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
|
<Frame name="$parentCharSelect" inherits="MyBagsCharSelectTemplate"/>
|
||||||
|
<Button name="$parentSortButton">
|
||||||
|
<Size x="28" y="26"/>
|
||||||
|
<NormalTexture atlas="bags-button-autosort-up"/>
|
||||||
|
<PushedTexture atlas="bags-button-autosort-down"/>
|
||||||
|
<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD">
|
||||||
|
<Size x="24" y="23"/>
|
||||||
|
<Anchors>
|
||||||
|
<Anchor point="CENTER" x="0" y="0"/>
|
||||||
|
</Anchors>
|
||||||
|
</HighlightTexture>
|
||||||
|
<Scripts>
|
||||||
|
<OnEnter/>
|
||||||
|
<OnLeave/>
|
||||||
|
<OnClick/>
|
||||||
|
</Scripts>
|
||||||
|
</Button>
|
||||||
<Frame name="$parentTokenFrame">
|
<Frame name="$parentTokenFrame">
|
||||||
<Size>
|
<Size>
|
||||||
<AbsDimension x="183" y="32"/>
|
<AbsDimension x="183" y="32"/>
|
||||||
|
|||||||
@ -2,12 +2,13 @@ local MYINVENTORY_DEFAULT_OPTIONS = {
|
|||||||
["Columns"] = 12,
|
["Columns"] = 12,
|
||||||
["Replace"] = true,
|
["Replace"] = true,
|
||||||
["Bag"] = "bar",
|
["Bag"] = "bar",
|
||||||
|
["BagSort"] = true,
|
||||||
["Graphics"] = "art",
|
["Graphics"] = "art",
|
||||||
["Count"] = "free",
|
["Count"] = "free",
|
||||||
["HlItems"] = true,
|
["HlItems"] = true,
|
||||||
["Sort"] = "realm",
|
["Sort"] = "realm",
|
||||||
["Search"] = true,
|
["Search"] = true,
|
||||||
["Token"] = true,
|
["Token"] = true,
|
||||||
["HlBags"] = true,
|
["HlBags"] = true,
|
||||||
["Freeze"] = "sticky",
|
["Freeze"] = "sticky",
|
||||||
["NoEsc"] = false,
|
["NoEsc"] = false,
|
||||||
@ -137,6 +138,17 @@ function MyInventory:OnInitialize()
|
|||||||
MyInventory:SetBagDisplay(val)
|
MyInventory:SetBagDisplay(val)
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
bagsort = {
|
||||||
|
type = "toggle",
|
||||||
|
name = "BagSort",
|
||||||
|
desc = "Toggle bag sort button",
|
||||||
|
get = function(info)
|
||||||
|
return MyInventory.IsSet("BagSort")
|
||||||
|
end,
|
||||||
|
set = function(info, val)
|
||||||
|
MyInventory:SetBagSort()
|
||||||
|
end,
|
||||||
|
},
|
||||||
back = {
|
back = {
|
||||||
type = "select",
|
type = "select",
|
||||||
name = "Background",
|
name = "Background",
|
||||||
|
|||||||
Reference in New Issue
Block a user