diff --git a/SVUI_Inventory/SVUI_Inventory.lua b/SVUI_Inventory/SVUI_Inventory.lua
index f9bca9a..2c1ad96 100644
--- a/SVUI_Inventory/SVUI_Inventory.lua
+++ b/SVUI_Inventory/SVUI_Inventory.lua
@@ -1,7 +1,7 @@
--[[
##########################################################
S V U I By: Munglunch
-##########################################################
+##########################################################
LOCALIZED LUA FUNCTIONS
##########################################################
]]--
@@ -112,8 +112,8 @@ local SVUI_Font_Bag_Number = _G.SVUI_Font_Bag_Number;
local BagFilters = _G.SVUI_BagFilterMenu;
local BagBar = _G.SVUI_BagBar;
---[[
-##########################################################
+--[[
+##########################################################
GET ADDON DATA
##########################################################
]]--
@@ -121,8 +121,8 @@ local SV = _G['SVUI']
local L = SV.L;
local MOD = SV.Inventory;
if(not MOD) then return end;
---[[
-##########################################################
+--[[
+##########################################################
LOCAL VARS
##########################################################
]]--
@@ -145,8 +145,8 @@ local RefProfessionColors = {
[0x10000] = {222/255,13/255,65/255},
[0x100000] = {18/255,224/255,180/255}
}
---[[
-##########################################################
+--[[
+##########################################################
LOCAL FUNCTIONS
##########################################################
]]--
@@ -169,13 +169,13 @@ function MOD:UpdateStockpile()
end
local function FormatCurrency(amount)
- if not amount then return end
+ if not amount then return end
local gold = floor(abs(amount/10000))
if gold ~= 0 then
gold = BreakUpLargeNumbers(gold)
return goldFormat:format(gold)
end
-end
+end
local function StyleBagToolButton(button, iconTex)
if button.styled then return end
@@ -193,7 +193,7 @@ local function StyleBagToolButton(button, iconTex)
button:SetNormalTexture(iconTex)
iconTex = button:GetNormalTexture()
iconTex:SetGradient(unpack(SV.media.gradient.medium))
-
+
local icon = button:CreateTexture(nil, "OVERLAY")
icon:WrapPoints(button, 5, 5)
SetPortraitToTexture(icon, iconTex)
@@ -204,37 +204,37 @@ local function StyleBagToolButton(button, iconTex)
hover:SetTexture(SV.media.button.round)
hover:SetGradient(unpack(SV.media.gradient.yellow))
- if button.SetPushedTexture then
+ if button.SetPushedTexture then
local pushed = button:CreateTexture(nil, "BORDER")
pushed:WrapPoints(button, 5, 5)
pushed:SetTexture(SV.media.button.round)
pushed:SetGradient(unpack(SV.media.gradient.highlight))
button:SetPushedTexture(pushed)
- end
+ end
- if button.SetCheckedTexture then
+ if button.SetCheckedTexture then
local checked = button:CreateTexture(nil, "BORDER")
checked:WrapPoints(button, 5, 5)
checked:SetTexture(SV.media.button.round)
checked:SetGradient(unpack(SV.media.gradient.green))
button:SetCheckedTexture(checked)
- end
+ end
- if button.SetDisabledTexture then
+ if button.SetDisabledTexture then
local disabled = button:CreateTexture(nil, "BORDER")
disabled:WrapPoints(button, 5, 5)
disabled:SetTexture(SV.media.button.round)
disabled:SetGradient(unpack(SV.media.gradient.default))
button:SetDisabledTexture(disabled)
- end
+ end
local cd = button:GetName() and _G[button:GetName().."Cooldown"]
- if cd then
+ if cd then
cd:ClearAllPoints()
cd:InsetPoints()
- end
+ end
button.styled = true
-end
+end
local function encodeSub(i, j, k)
local l = j;
@@ -248,11 +248,11 @@ local function encodeSub(i, j, k)
l = l + 2;
else
l = l + 1;
- end
+ end
k = k-1;
- end
+ end
return i:sub(j, (l-1))
-end
+end
local function SetGearLabel(level, font, saveTo)
if level == 1 then
@@ -264,7 +264,7 @@ local function SetGearLabel(level, font, saveTo)
else
font:SetText()
end
-end
+end
function MOD:BuildEquipmentMap()
for key, gearData in pairs(GEARSET_LISTING) do
@@ -272,7 +272,7 @@ function MOD:BuildEquipmentMap()
end
local set, player, bank, bags, slotIndex, bagIndex, loc, _;
-
+
for i = 1, GetNumEquipmentSets() do
set = GetEquipmentSetInfo(i);
GEAR_CACHE = GetEquipmentSetLocations(set);
@@ -290,59 +290,59 @@ function MOD:BuildEquipmentMap()
end
end
end
---[[
-##########################################################
+--[[
+##########################################################
CORE FUNCTIONS
##########################################################
]]--
function MOD:INVENTORY_SEARCH_UPDATE()
if(self.BagFrame) then
- for id, bag in ipairs(self.BagFrame.Bags) do
- for i = 1, GetContainerNumSlots(id) do
+ for id, bag in ipairs(self.BagFrame.Bags) do
+ for i = 1, GetContainerNumSlots(id) do
local _, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(id, i)
local item = bag[i]
- if(item and item:IsShown()) then
- if isFiltered then
+ if(item and item:IsShown()) then
+ if isFiltered then
SetItemButtonDesaturated(item, 1)
item:SetAlpha(0.4)
- else
+ else
SetItemButtonDesaturated(item)
item:SetAlpha(1)
- end
- end
- end
+ end
+ end
+ end
end
end
if(self.BankFrame and self.BankFrame:IsShown()) then
- for id, bag in ipairs(self.BankFrame.Bags) do
- for i = 1, GetContainerNumSlots(id) do
+ for id, bag in ipairs(self.BankFrame.Bags) do
+ for i = 1, GetContainerNumSlots(id) do
local _, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(id, i)
local item = bag[i]
- if(item and item:IsShown()) then
- if isFiltered then
+ if(item and item:IsShown()) then
+ if isFiltered then
SetItemButtonDesaturated(item, 1)
item:SetAlpha(0.4)
- else
+ else
SetItemButtonDesaturated(item)
item:SetAlpha(1)
- end
- end
- end
+ end
+ end
+ end
end
end
if(self.ReagentFrame and self.ReagentFrame:IsShown()) then
- for i = 1, self.ReagentFrame.numSlots do
+ for i = 1, self.ReagentFrame.numSlots do
local _, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(REAGENTBANK_CONTAINER, i)
local item = self.ReagentFrame.Bags[REAGENTBANK_CONTAINER][i]
- if(item and item:IsShown()) then
- if isFiltered then
+ if(item and item:IsShown()) then
+ if isFiltered then
SetItemButtonDesaturated(item, 1)
item:SetAlpha(0.4)
- else
+ else
SetItemButtonDesaturated(item)
item:SetAlpha(1)
- end
- end
+ end
+ end
end
end
end
@@ -396,7 +396,7 @@ local SlotUpdate = function(self, slotID)
end
local rarity = select(3, GetItemInfo(itemLink));
if(rarity) then
- if(rarity > 1) then
+ if(rarity > 1) then
r,g,b = GetItemQualityColor(rarity)
elseif(rarity == 0) then
slot.JunkIcon:Show()
@@ -412,14 +412,14 @@ local SlotUpdate = function(self, slotID)
if((duration > 0) and (enable == 0)) then
SetItemButtonTextureVertexColor(slot, 0.4, 0.4, 0.4)
- else
+ else
SetItemButtonTextureVertexColor(slot, 1, 1, 1)
end
if(C_NewItems.IsNewItem(bagID, slotID)) then
C_NewItems.RemoveNewItem(bagID, slotID)
end
-
+
if(slot.NewItemTexture) then slot.NewItemTexture:Hide() end;
if(slot.flashAnim) then slot.flashAnim:Stop() end;
if(slot.newitemglowAnim) then slot.newitemglowAnim:Stop() end;
@@ -447,7 +447,7 @@ local RefreshSlots = function(self)
local bagKey = tostring(bagID)
journal[bagKey] = {};
for slotID = 1, maxcount do
- self:SlotUpdate(slotID)
+ self:SlotUpdate(slotID)
end
end
@@ -459,7 +459,7 @@ local RefreshReagentSlots = function(self)
local bagKey = tostring(bagID)
journal[bagKey] = {};
for slotID = 1, maxcount do
- self:SlotUpdate(slotID)
+ self:SlotUpdate(slotID)
end
end
@@ -467,19 +467,19 @@ local ContainerFrame_UpdateCooldowns = function(self)
if self.isReagent then return end
for _, bagID in ipairs(self.BagIDs) do
if self.Bags[bagID] then
- for slotID = 1, GetContainerNumSlots(bagID)do
+ for slotID = 1, GetContainerNumSlots(bagID)do
local start, duration, enable = GetContainerItemCooldown(bagID, slotID)
if(self.Bags[bagID][slotID]) then
CooldownFrame_SetTimer(self.Bags[bagID][slotID].cooldown, start, duration, enable)
- if duration > 0 and enable == 0 then
+ if duration > 0 and enable == 0 then
SetItemButtonTextureVertexColor(self.Bags[bagID][slotID], 0.4, 0.4, 0.4)
- else
+ else
SetItemButtonTextureVertexColor(self.Bags[bagID][slotID], 1, 1, 1)
end
end
end
- end
- end
+ end
+ end
end
local ContainerFrame_UpdateBags = function(self)
@@ -550,7 +550,7 @@ local ContainerFrame_UpdateLayout = function(self)
if isBank then
globalName = "SVUI_BankBag" .. bagID - 4;
bagTemplate = "BankItemButtonBagTemplate"
- else
+ else
globalName = "SVUI_MainBag" .. bagID .. "Slot";
bagTemplate = "BagSlotButtonTemplate"
end
@@ -586,26 +586,26 @@ local ContainerFrame_UpdateLayout = function(self)
menu[i] = bagSlot;
end
- bagSlot:ModSize(buttonSize)
+ bagSlot:ModSize(buttonSize)
bagSlot:ClearAllPoints()
if(isBank) then
BankFrameItemButton_Update(bagSlot)
BankFrameItemButton_UpdateLocked(bagSlot)
- if(i == 2) then
+ if(i == 2) then
bagSlot:SetPoint("BOTTOMLEFT", menu, "BOTTOMLEFT", buttonSpacing, buttonSpacing)
- else
+ else
bagSlot:SetPoint("LEFT", lastMenu, "RIGHT", buttonSpacing, 0)
end
else
- if(i == 1) then
+ if(i == 1) then
bagSlot:SetPoint("BOTTOMLEFT", menu, "BOTTOMLEFT", buttonSpacing, buttonSpacing)
- else
+ else
bagSlot:SetPoint("LEFT", lastMenu, "RIGHT", buttonSpacing, 0)
end
end
- lastMenu = bagSlot;
+ lastMenu = bagSlot;
end
local numSlots = GetContainerNumSlots(bagID);
@@ -615,7 +615,7 @@ local ContainerFrame_UpdateLayout = function(self)
if numSlots > 0 then
if not self.Bags[bagID] then
- self.Bags[bagID] = CreateFrame("Frame", bagName, self);
+ self.Bags[bagID] = CreateFrame("Frame", bagName, self);
self.Bags[bagID]:SetID(bagID);
self.Bags[bagID].SlotUpdate = SlotUpdate;
self.Bags[bagID].RefreshSlots = RefreshSlots;
@@ -630,10 +630,10 @@ local ContainerFrame_UpdateLayout = function(self)
self.Bags[bagID].bagFamily = {r, g, b};
end
- for i = 1, MAX_CONTAINER_ITEMS do
- if self.Bags[bagID][i] then
+ for i = 1, MAX_CONTAINER_ITEMS do
+ if self.Bags[bagID][i] then
self.Bags[bagID][i]:Hide();
- end
+ end
end
for slotID = 1, numSlots do
@@ -654,7 +654,7 @@ local ContainerFrame_UpdateLayout = function(self)
-- if(self.Bags[bagID][slotID].flashAnim) then
-- self.Bags[bagID][slotID].flashAnim.Play = SV.fubar
-- end
-
+
if(not self.Bags[bagID][slotID].NewItemTexture) then
self.Bags[bagID][slotID].NewItemTexture = self.Bags[bagID][slotID]:CreateTexture(nil, "OVERLAY", 1);
end
@@ -662,7 +662,7 @@ local ContainerFrame_UpdateLayout = function(self)
self.Bags[bagID][slotID].NewItemTexture:SetTexture("");
self.Bags[bagID][slotID].NewItemTexture:Hide()
- if(not self.Bags[bagID][slotID].JunkIcon) then
+ if(not self.Bags[bagID][slotID].JunkIcon) then
self.Bags[bagID][slotID].JunkIcon = self.Bags[bagID][slotID]:CreateTexture(nil, "OVERLAY");
self.Bags[bagID][slotID].JunkIcon:ModSize(16,16);
end
@@ -679,14 +679,14 @@ local ContainerFrame_UpdateLayout = function(self)
self.Bags[bagID][slotID].questIcon:SetTexture(TEXTURE_ITEM_QUEST_BANG);
self.Bags[bagID][slotID].questIcon:InsetPoints(self.Bags[bagID][slotID]);
self.Bags[bagID][slotID].questIcon:SetTexCoord(unpack(_G.SVUI_ICON_COORDS));
-
+
hooksecurefunc(self.Bags[bagID][slotID], "SetBackdropColor", function(self, r, g, b, a) if(self.HasQuestItem and (r ~= 1)) then self:SetBackdropColor(1,0.3,0.3,a) end end)
hooksecurefunc(self.Bags[bagID][slotID], "SetBackdropBorderColor", function(self, r, g, b, a) if(self.HasQuestItem and (r ~= 1)) then self:SetBackdropBorderColor(1,0.3,0.3,a) end end)
self.Bags[bagID][slotID].cooldown = _G[cdName];
end
- if(not self.Bags[bagID][slotID].GearInfo) then
+ if(not self.Bags[bagID][slotID].GearInfo) then
self.Bags[bagID][slotID].GearInfo = self.Bags[bagID][slotID]:CreateFontString(nil,"OVERLAY")
self.Bags[bagID][slotID].GearInfo:SetFontObject(SVUI_Font_Default)
self.Bags[bagID][slotID].GearInfo:SetAllPoints(self.Bags[bagID][slotID])
@@ -698,18 +698,18 @@ local ContainerFrame_UpdateLayout = function(self)
self.Bags[bagID][slotID]:SetID(slotID);
self.Bags[bagID][slotID]:ModSize(buttonSize);
- if self.Bags[bagID][slotID]:GetPoint() then
+ if self.Bags[bagID][slotID]:GetPoint() then
self.Bags[bagID][slotID]:ClearAllPoints();
end
- if lastButton then
- if((totalSlots - 1) % numContainerColumns == 0) then
+ if lastButton then
+ if((totalSlots - 1) % numContainerColumns == 0) then
self.Bags[bagID][slotID]:ModPoint("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing);
lastRowButton = self.Bags[bagID][slotID];
- else
+ else
self.Bags[bagID][slotID]:ModPoint("LEFT", lastButton, "RIGHT", buttonSpacing, 0);
- end
- else
+ end
+ else
self.Bags[bagID][slotID]:ModPoint("TOPLEFT", self.holderFrame, "TOPLEFT");
lastRowButton = self.Bags[bagID][slotID];
end
@@ -721,13 +721,13 @@ local ContainerFrame_UpdateLayout = function(self)
else
if(self.Bags[bagID]) then
self.Bags[bagID].numSlots = numSlots;
-
- for i = 1, MAX_CONTAINER_ITEMS do
- if(self.Bags[bagID][i]) then
+
+ for i = 1, MAX_CONTAINER_ITEMS do
+ if(self.Bags[bagID][i]) then
self.Bags[bagID][i]:Hide();
- end
+ end
end
- end
+ end
if(isBank) then
if(menu[i]) then
@@ -737,10 +737,10 @@ local ContainerFrame_UpdateLayout = function(self)
end
end
end
-
+
self:ModSize(containerWidth, containerHeight);
MOD:UpdateStockpile()
-end
+end
local ReagentFrame_UpdateLayout = function(self)
if not _G.ReagentBankFrame then return; end
@@ -769,7 +769,7 @@ local ReagentFrame_UpdateLayout = function(self)
local bagName = ("%sBag%d"):format(containerName, bagID)
if not self.Bags[bagID] then
- bag = CreateFrame("Frame", bagName, self);
+ bag = CreateFrame("Frame", bagName, self);
bag:SetID(bagID);
bag.SlotUpdate = SlotUpdate;
bag.RefreshSlots = RefreshReagentSlots;
@@ -827,18 +827,18 @@ local ReagentFrame_UpdateLayout = function(self)
slot:SetID(slotID);
slot:ModSize(buttonSize);
- if slot:GetPoint() then
+ if slot:GetPoint() then
slot:ClearAllPoints();
end
- if lastButton then
- if((totalSlots - 1) % numContainerColumns == 0) then
+ if lastButton then
+ if((totalSlots - 1) % numContainerColumns == 0) then
slot:ModPoint("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing);
lastRowButton = slot;
- else
+ else
slot:ModPoint("LEFT", lastButton, "RIGHT", buttonSpacing, 0);
- end
- else
+ end
+ else
slot:ModPoint("TOPLEFT", self.holderFrame, "TOPLEFT");
lastRowButton = slot;
end
@@ -855,28 +855,28 @@ local ReagentFrame_UpdateLayout = function(self)
self:ModSize(containerWidth, containerHeight);
MOD:UpdateStockpile()
-end
+end
function MOD:RefreshBagFrames(frame)
if(frame and self[frame]) then
self[frame]:UpdateLayout()
return
else
- if(self.BagFrame) then
+ if(self.BagFrame) then
self.BagFrame:UpdateLayout()
- end
- if self.BankFrame then
+ end
+ if self.BankFrame then
self.BankFrame:UpdateLayout()
end
- if self.ReagentFrame then
+ if self.ReagentFrame then
self.ReagentFrame:UpdateLayout()
end
end
-end
+end
function MOD:UpdateGoldText()
self.BagFrame.goldText:SetText(GetCoinTextureString(GetMoney(), 12))
-end
+end
function MOD:VendorCheck(itemID, bagID, slot)
if((not MOD.private) or (not MOD.private.junk)) then return end
@@ -885,7 +885,7 @@ function MOD:VendorCheck(itemID, bagID, slot)
PickupMerchantItem()
return true
end
-end
+end
function MOD:ModifyBags()
local docked = SV.db.Inventory.alignToChat
@@ -894,7 +894,7 @@ function MOD:ModifyBags()
if self.BagFrame then
self.BagFrame:ClearAllPoints()
self.BagFrame:ModPoint("BOTTOMRIGHT", SV.Dock.BottomRight, "BOTTOMRIGHT", 0, 0)
- end
+ end
if self.BankFrame then
self.BankFrame:ClearAllPoints()
self.BankFrame:ModPoint("BOTTOMLEFT", SV.Dock.BottomLeft, "BOTTOMLEFT", 0, 0)
@@ -904,23 +904,23 @@ function MOD:ModifyBags()
local anchor, x, y = SV.db.Inventory.bags.point, SV.db.Inventory.bags.xOffset, SV.db.Inventory.bags.yOffset
self.BagFrame:ClearAllPoints()
self.BagFrame:ModPoint(anchor, SV.Screen, anchor, x, y)
- end
+ end
if self.BankFrame then
local anchor, x, y = SV.db.Inventory.bank.point, SV.db.Inventory.bank.xOffset, SV.db.Inventory.bank.yOffset
self.BankFrame:ClearAllPoints()
self.BankFrame:ModPoint(anchor, SV.Screen, anchor, x, y)
end
end
-end
+end
do
local function Bags_OnEnter()
- if SV.db.Inventory.bagBar.mouseover ~= true then return end
+ if SV.db.Inventory.bagBar.mouseover ~= true then return end
BagBar:FadeIn(0.2, BagBar:GetAlpha(), 1)
end
local function Bags_OnLeave()
- if SV.db.Inventory.bagBar.mouseover ~= true then return end
+ if SV.db.Inventory.bagBar.mouseover ~= true then return end
BagBar:FadeOut(0.2, BagBar:GetAlpha(), 0)
end
@@ -960,7 +960,7 @@ do
local count = #BagBar.buttons
local frameCount = NUM_BAG_FRAMES - 1;
- for i = 0, frameCount do
+ for i = 0, frameCount do
local bagSlot = _G["CharacterBag"..i.."Slot"]
bagSlot:SetParent(BagBar)
bagSlot.SetParent = SV.Hidden;
@@ -977,57 +977,57 @@ do
function MOD:ModifyBagBar()
if not SV.db.Inventory.bagBar.enable then return end
- if not self.BagBarLoaded then
- LoadBagBar()
- end
- if SV.db.Inventory.bagBar.mouseover then
+ if not self.BagBarLoaded then
+ LoadBagBar()
+ end
+ if SV.db.Inventory.bagBar.mouseover then
BagBar:SetAlpha(0)
- else
+ else
BagBar:SetAlpha(1)
- end
+ end
local showBy = SV.db.Inventory.bagBar.showBy
local sortDir = SV.db.Inventory.bagBar.sortDirection
local bagSize = SV.db.Inventory.bagBar.size
local bagSpacing = SV.db.Inventory.bagBar.spacing
- for i = 1, #BagBar.buttons do
+ for i = 1, #BagBar.buttons do
local button = BagBar.buttons[i]
local lastButton = BagBar.buttons[i - 1]
button:ModSize(bagSize)
button:ClearAllPoints()
- if(showBy == "HORIZONTAL" and sortDir == "ASCENDING") then
- if i == 1 then
+ if(showBy == "HORIZONTAL" and sortDir == "ASCENDING") then
+ if i == 1 then
button:SetPoint("LEFT", BagBar, "LEFT", bagSpacing, 0)
- elseif lastButton then
+ elseif lastButton then
button:SetPoint("LEFT", lastButton, "RIGHT", bagSpacing, 0)
- end
- elseif(showBy == "VERTICAL" and sortDir == "ASCENDING") then
- if i == 1 then
+ end
+ elseif(showBy == "VERTICAL" and sortDir == "ASCENDING") then
+ if i == 1 then
button:SetPoint("TOP", BagBar, "TOP", 0, -bagSpacing)
- elseif lastButton then
+ elseif lastButton then
button:SetPoint("TOP", lastButton, "BOTTOM", 0, -bagSpacing)
- end
- elseif(showBy == "HORIZONTAL" and sortDir == "DESCENDING") then
- if i == 1 then
+ end
+ elseif(showBy == "HORIZONTAL" and sortDir == "DESCENDING") then
+ if i == 1 then
button:SetPoint("RIGHT", BagBar, "RIGHT", -bagSpacing, 0)
- elseif lastButton then
+ elseif lastButton then
button:SetPoint("RIGHT", lastButton, "LEFT", -bagSpacing, 0)
- end
- else
- if i == 1 then
+ end
+ else
+ if i == 1 then
button:SetPoint("BOTTOM", BagBar, "BOTTOM", 0, bagSpacing)
- elseif lastButton then
+ elseif lastButton then
button:SetPoint("BOTTOM", lastButton, "TOP", 0, bagSpacing)
- end
- end
- end
- if showBy == "HORIZONTAL" then
+ end
+ end
+ end
+ if showBy == "HORIZONTAL" then
BagBar:ModWidth((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing)
BagBar:ModHeight(bagSize + (bagSpacing * 2))
- else
+ else
BagBar:ModHeight((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing)
BagBar:ModWidth(bagSize + (bagSpacing * 2))
end
@@ -1037,89 +1037,89 @@ do
SV:NewAnchor(BagBar, L["Bags Bar"])
end
- if SV.db.Inventory.bagBar.showBackdrop then
+ if SV.db.Inventory.bagBar.showBackdrop then
BagBar.Panel:Show()
- else
+ else
BagBar.Panel:Hide()
end
end
end
---[[
-##########################################################
+--[[
+##########################################################
BAG CONTAINER CREATION
##########################################################
]]--
-do
+do
local Search_OnKeyPressed = function(self)
self:GetParent().detail:Show()
self:ClearFocus()
SetItemSearch('')
- end
+ end
local Search_OnInput = function(self)
local i = 3;
local j = self:GetText()
- if len(j) > i then
+ if len(j) > i then
local k=true;
- for h=1,i,1 do
- if sub(j,0-h,0-h) ~= sub(j,-1-h,-1-h) then
+ for h=1,i,1 do
+ if sub(j,0-h,0-h) ~= sub(j,-1-h,-1-h) then
k=false;
- break
- end
- end
- if k then
+ break
+ end
+ end
+ if k then
Search_OnKeyPressed(self)
- return
- end
- end
+ return
+ end
+ end
SetItemSearch(j)
- end
+ end
local Search_OnClick = function(self, button)
local container = self:GetParent()
- if button == "RightButton"then
+ if button == "RightButton"then
container.detail:Hide()
container.editBox:Show()
container.editBox:SetText(SEARCH)
container.editBox:HighlightText()
- else
- if container.editBox:IsShown()then
+ else
+ if container.editBox:IsShown()then
container.editBox:Hide()
container.editBox:ClearFocus()
container.detail:Show()
SetItemSearch('')
- else
+ else
container.detail:Hide()
container.editBox:Show()
container.editBox:SetText(SEARCH)
container.editBox:HighlightText()
- end
- end
- end
+ end
+ end
+ end
local Vendor_OnClick = function(self)
- if IsShiftKeyDown()then
+ if IsShiftKeyDown()then
SV.SystemAlert["DELETE_GRAYS"].Money = SV:VendorGrays(false,true,true)
SV:StaticPopup_Show('DELETE_GRAYS')
- else
+ else
SV:VendorGrays()
- end
- end
+ end
+ end
local Token_OnEnter = function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetBackpackToken(self:GetID())
- end
+ end
local Token_OnLeave = function(self)
- GameTooltip:Hide()
- end
+ GameTooltip:Hide()
+ end
local Token_OnClick = function(self)
- if IsModifiedClick("CHATLINK") then
+ if IsModifiedClick("CHATLINK") then
HandleModifiedItemClick(GetCurrencyLink(self.currencyID))
- end
- end
+ end
+ end
local Tooltip_Show = function(self)
GameTooltip:SetOwner(self:GetParent(),"ANCHOR_TOP",0,4)
@@ -1131,29 +1131,29 @@ do
GameTooltip:AddLine(self.ttText)
end
- if self.ttText2 then
+ if self.ttText2 then
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1)
end
self:GetNormalTexture():SetGradient(unpack(SV.media.gradient.highlight))
GameTooltip:Show()
- end
+ end
local Tooltip_Hide = function(self)
self:GetNormalTexture():SetGradient(unpack(SV.media.gradient.medium))
GameTooltip:Hide()
- end
+ end
local Container_OnDragStart = function(self)
if IsShiftKeyDown()then self:StartMoving()end
- end
+ end
local Container_OnDragStop = function(self)
self:StopMovingOrSizing()
- end
+ end
local Container_OnClick = function(self)
if IsControlKeyDown() then MOD:ModifyBags() end
- end
+ end
local Container_OnEnter = function(self)
GameTooltip:SetOwner(self,"ANCHOR_TOPLEFT",0,4)
GameTooltip:ClearLines()
@@ -1205,8 +1205,8 @@ do
frame.closeButton = CreateFrame("Button", "SVUI_ContainerFrameCloseButton", frame, "UIPanelCloseButton")
frame.closeButton:ModPoint("TOPRIGHT", -4, -4)
SV.API:Set("CloseButton", frame.closeButton);
- frame.closeButton:SetScript("PostClick", function()
- if(not InCombatLockdown()) then CloseBag(0) end
+ frame.closeButton:SetScript("PostClick", function()
+ if(not InCombatLockdown()) then CloseBag(0) end
end)
frame.holderFrame = CreateFrame("Frame", nil, frame)
@@ -1323,7 +1323,7 @@ do
frame.currencyButton:ModPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 4, 0)
frame.currencyButton:ModPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0)
frame.currencyButton:ModHeight(32)
- for h = 1, MAX_WATCHED_TOKENS do
+ for h = 1, MAX_WATCHED_TOKENS do
frame.currencyButton[h] = CreateFrame("Button", nil, frame.currencyButton)
frame.currencyButton[h]:ModSize(22)
frame.currencyButton[h]:SetStyle("!_Frame", "Default")
@@ -1397,8 +1397,8 @@ do
frame.closeButton = CreateFrame("Button", bagName.."CloseButton", frame, "UIPanelCloseButton")
frame.closeButton:ModPoint("TOPRIGHT", -4, -4)
SV.API:Set("CloseButton", frame.closeButton);
- frame.closeButton:SetScript("PostClick", function()
- if(not InCombatLockdown()) then CloseBag(0) end
+ frame.closeButton:SetScript("PostClick", function()
+ if(not InCombatLockdown()) then CloseBag(0) end
end)
frame.holderFrame = CreateFrame("Frame", nil, frame)
@@ -1448,7 +1448,7 @@ do
frame.transferButton:SetScript("OnLeave", Tooltip_Hide)
local Transfer_OnClick = MOD:RunSortingProcess(MOD.Transfer, "bank bags")
frame.transferButton:SetScript("OnClick", Transfer_OnClick)
-
+
tinsert(UISpecialFrames, bagName)
frame.bagsButton = CreateFrame("Button", nil, frame)
@@ -1464,11 +1464,11 @@ do
ToggleFrame(BagFilters)
end
local numSlots, _ = GetNumBankSlots()
- if numSlots >= 1 then
+ if numSlots >= 1 then
ToggleFrame(frame.BagMenu)
- else
+ else
SV:StaticPopup_Show("NO_BANK_BAGS")
- end
+ end
end
frame.bagsButton:SetScript("OnClick", BagBtn_OnClick)
@@ -1483,11 +1483,11 @@ do
local PurchaseBtn_OnClick = function()
PlaySound("igMainMenuOption");
local _, full = GetNumBankSlots()
- if not full then
+ if not full then
SV:StaticPopup_Show("BUY_BANK_SLOT")
- else
+ else
SV:StaticPopup_Show("CANNOT_BUY_BANK_SLOT")
- end
+ end
end
frame.purchaseBagButton:SetScript("OnClick", PurchaseBtn_OnClick)
@@ -1510,7 +1510,7 @@ do
end)
frame.swapButton:SetScript("OnLeave", Tooltip_Hide)
frame.swapButton:SetScript("OnClick", function()
- if(not IsReagentBankUnlocked()) then
+ if(not IsReagentBankUnlocked()) then
SV:StaticPopup_Show("CONFIRM_BUY_REAGENTBANK_TAB");
else
PlaySound("igMainMenuOption");
@@ -1552,29 +1552,29 @@ function MOD:RefreshTokens()
local name,count,icon,currencyID = GetBackpackCurrencyInfo(i)
local set = frame.currencyButton[i]
set:ClearAllPoints()
- if name then
+ if name then
set.icon:SetTexture(icon)
- if SV.db.Inventory.currencyFormat == 'ICON_TEXT' then
+ if SV.db.Inventory.currencyFormat == 'ICON_TEXT' then
set.text:SetText(name..': '..count)
- elseif SV.db.Inventory.currencyFormat == 'ICON' then
+ elseif SV.db.Inventory.currencyFormat == 'ICON' then
set.text:SetText(count)
- end
+ end
set.currencyID = currencyID;
set:Show()
- index = index + 1;
- else
+ index = index + 1;
+ else
set:Hide()
- end
+ end
end
- if index == 0 then
+ if index == 0 then
frame.bottomOffset = 8;
- if frame.currencyButton:IsShown() then
+ if frame.currencyButton:IsShown() then
frame.currencyButton:Hide()
MOD.BagFrame:UpdateLayout()
- end
- return
- elseif not frame.currencyButton:IsShown() then
+ end
+ return
+ elseif not frame.currencyButton:IsShown() then
frame.bottomOffset = 28;
frame.currencyButton:Show()
MOD.BagFrame:UpdateLayout()
@@ -1582,16 +1582,16 @@ function MOD:RefreshTokens()
frame.bottomOffset = 28;
local set = frame.currencyButton;
- if index == 1 then
+ if index == 1 then
set[1]:ModPoint("BOTTOM", set, "BOTTOM", -(set[1].text:GetWidth() / 2), 3)
- elseif index == 2 then
+ elseif index == 2 then
set[1]:ModPoint("BOTTOM", set, "BOTTOM", -set[1].text:GetWidth()-set[1]:GetWidth() / 2, 3)
frame.currencyButton[2]:ModPoint("BOTTOMLEFT", set, "BOTTOM", set[2]:GetWidth() / 2, 3)
- else
+ else
set[1]:ModPoint("BOTTOMLEFT", set, "BOTTOMLEFT", 3, 3)
set[2]:ModPoint("BOTTOM", set, "BOTTOM", -(set[2].text:GetWidth() / 3), 3)
set[3]:ModPoint("BOTTOMRIGHT", set, "BOTTOMRIGHT", -set[3].text:GetWidth()-set[3]:GetWidth() / 2, 3)
- end
+ end
end
@@ -1608,10 +1608,10 @@ end
local function _closeBags()
GameTooltip:Hide()
MOD.BagFrame:Hide()
- if(MOD.BankFrame) then
+ if(MOD.BankFrame) then
MOD.BankFrame:Hide()
end
- if(MOD.ReagentFrame) then
+ if(MOD.ReagentFrame) then
MOD.ReagentFrame:Hide()
end
if(SV.Dock.CloseBreakStuff) then
@@ -1624,21 +1624,12 @@ local function _closeBags()
end
local function _toggleBags(id)
- if(id and (GetContainerNumSlots(id) == 0)) then return end
- if(MOD.BagFrame:IsShown()) then
+ if(IsOptionFrameOpen() or (id and (GetContainerNumSlots(id) == 0))) then return end
+ if(MOD.BagFrame:IsShown() or (not IsBagOpen(0))) then
_closeBags()
- else
- _openBags()
- end
-end
-
-local function _toggleBackpack()
- if IsOptionFrameOpen() then return end
- if IsBagOpen(0) then
+ else
_openBags()
- else
- _closeBags()
- end
+ end
end
local _hook_OnModifiedClick = function(self, button)
@@ -1660,21 +1651,21 @@ local _hook_OnModifiedClick = function(self, button)
end
function MOD:BANKFRAME_OPENED()
- if(not self.BankFrame) then
+ if(not self.BankFrame) then
self:MakeBankOrReagent()
end
self.BankFrame:UpdateLayout()
- if(not self.ReagentFrame) then
+ if(not self.ReagentFrame) then
self:MakeBankOrReagent(true)
end
-
- if(self.ReagentFrame) then
+
+ if(self.ReagentFrame) then
self.ReagentFrame:UpdateLayout()
end
self:ModifyBags()
-
+
self.BankFrame:Show()
self.BankFrame:RefreshBags()
self.BagFrame:Show()
@@ -1683,29 +1674,29 @@ function MOD:BANKFRAME_OPENED()
end
function MOD:BANKFRAME_CLOSED()
- if(self.BankFrame and self.BankFrame:IsShown()) then
+ if(self.BankFrame and self.BankFrame:IsShown()) then
self.BankFrame:Hide()
end
- if(self.ReagentFrame and self.ReagentFrame:IsShown()) then
+ if(self.ReagentFrame and self.ReagentFrame:IsShown()) then
self.ReagentFrame:Hide()
end
end
function MOD:PLAYERBANKBAGSLOTS_CHANGED()
- if(self.BankFrame) then
+ if(self.BankFrame) then
self.BankFrame:UpdateLayout()
end
- if(self.ReagentFrame) then
+ if(self.ReagentFrame) then
self.ReagentFrame:UpdateLayout()
end
-end
+end
function MOD:PLAYER_ENTERING_WORLD()
self:UpdateGoldText()
self.BagFrame:RefreshBags()
-end
---[[
-##########################################################
+end
+--[[
+##########################################################
BUILD FUNCTION / UPDATE
##########################################################
]]--
@@ -1713,7 +1704,7 @@ function MOD:ReLoad()
self:RefreshBagFrames()
self:ModifyBags();
self:ModifyBagBar();
-end
+end
function MOD:Load()
if(self.private) then self.private = {} end
@@ -1737,8 +1728,8 @@ function MOD:Load()
hooksecurefunc("OpenAllBags", _openBags)
hooksecurefunc("CloseAllBags", _closeBags)
hooksecurefunc("ToggleBag", _toggleBags)
- hooksecurefunc("ToggleAllBags", _toggleBackpack)
- hooksecurefunc("ToggleBackpack", _toggleBackpack)
+ hooksecurefunc("ToggleAllBags", _toggleBags)
+ hooksecurefunc("ToggleBackpack", _toggleBags)
hooksecurefunc("BackpackTokenFrame_Update", self.RefreshTokens)
hooksecurefunc("ContainerFrameItemButton_OnModifiedClick", _hook_OnModifiedClick)
@@ -1754,20 +1745,20 @@ function MOD:Load()
StackSplitFrame:SetFrameStrata("DIALOG")
SV.SystemAlert["BUY_BANK_SLOT"] = {
- text = CONFIRM_BUY_BANK_SLOT,
- button1 = YES,
- button2 = NO,
- OnAccept = function(self) PurchaseSlot() end,
- OnShow = function(self) MoneyFrame_Update(self.moneyFrame, GetBankSlotCost()) end,
- hasMoneyFrame = 1,
- timeout = 0,
+ text = CONFIRM_BUY_BANK_SLOT,
+ button1 = YES,
+ button2 = NO,
+ OnAccept = function(self) PurchaseSlot() end,
+ OnShow = function(self) MoneyFrame_Update(self.moneyFrame, GetBankSlotCost()) end,
+ hasMoneyFrame = 1,
+ timeout = 0,
hideOnEscape = 1
};
SV.SystemAlert["CONFIRM_BUY_REAGENTBANK_TAB"] = {
- text = L["Purchase Reagents Bank?"],
- button1 = YES,
- button2 = NO,
- OnAccept = function(self) BuyReagentBank() end,
+ text = L["Purchase Reagents Bank?"],
+ button1 = YES,
+ button2 = NO,
+ OnAccept = function(self) BuyReagentBank() end,
OnShow = function(self)
MoneyFrame_Update(self.moneyFrame, GetReagentBankCost());
if(MOD.ReagentFrame) then
@@ -1777,21 +1768,21 @@ function MOD:Load()
MOD.ReagentFrame.swapButton:SetNormalTexture(MOD.media.reagentIcon)
end
end
- end,
- hasMoneyFrame = 1,
- timeout = 0,
+ end,
+ hasMoneyFrame = 1,
+ timeout = 0,
hideOnEscape = 1
};
SV.SystemAlert["CANNOT_BUY_BANK_SLOT"] = {
- text = L["Can't buy anymore slots!"],
- button1 = ACCEPT,
- timeout = 0,
+ text = L["Can't buy anymore slots!"],
+ button1 = ACCEPT,
+ timeout = 0,
whileDead = 1
};
SV.SystemAlert["NO_BANK_BAGS"] = {
- text = L["You must purchase a bank slot first!"],
- button1 = ACCEPT,
- timeout = 0,
+ text = L["You must purchase a bank slot first!"],
+ button1 = ACCEPT,
+ timeout = 0,
whileDead = 1
};
-end
\ No newline at end of file
+end