Quantcast

Graphics additions

Brandon James Talbot [01-06-16 - 20:34]
Graphics additions
Filename
art/Border.tga
bag/button.lua
bag/container.lua
bag/core.lua
bag/settings.lua
diff --git a/art/Border.tga b/art/Border.tga
new file mode 100644
index 0000000..41fca51
Binary files /dev/null and b/art/Border.tga differ
diff --git a/bag/button.lua b/bag/button.lua
index 73f8178..940bd12 100644
--- a/bag/button.lua
+++ b/bag/button.lua
@@ -51,6 +51,23 @@ function button:Init(bag, slot)
 	self.button:SetID(slot)
 	self.button:SetAllPoints()

+	self.button.BattlepayItemTexture:Hide()
+
+	self.button.Count:SetFont("Fonts\\FRIZQT__.TTF", settings.saved.countFontSize, "OUTLINE")
+	self.button.Count:ClearAllPoints()
+	self.button.Count:SetPoint("BOTTOMRIGHT",  -settings.saved.countFontSidePadding,
+		settings.saved.countFontBotPadding)
+
+	self.button.IconBorder:SetTexture([[Interface\AddOns\DJUI-WOW\art\Border]])
+	self.button.icon:ClearAllPoints()
+	self.button.icon:SetPoint("TOPLEFT", -1, 1)
+	self.button.icon:SetPoint("BOTTOMRIGHT", 1, -1)
+
+	local NT = _G[self.button:GetName() .. "NormalTexture"]
+	NT:SetTexture([[Interface\AddOns\DJUI-WOW\art\Border]])
+	NT:ClearAllPoints()
+	NT:SetAllPoints()
+
 	self:Show()
 	self.button:Show()
 end
@@ -61,7 +78,7 @@ function button:GetInformation()
 		local texture, count, locked, quality, readable, lootable, link, isFiltered = GetContainerItemInfo(self.bag, self.slot)
 		local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(id)

-		return id, name, texture, count, quality, ilevel
+		return id, name, texture, count, quality, iLevel
 	end
 end

@@ -74,16 +91,16 @@ function button:GetContainerName()

 		if isInSet then
 			settings.setNames[setName] = true
+			setName = string.gsub(setName, ",", " &")
 		end
-
-		return settings.saved.types[id] or (isInSet and setName) or class
+		return settings.saved.types[id] or (isInSet and setName) or (quality == 0 and "Junk") or class
 	end
 end

 function button:Update()
 	local id, name, texture, count, quality, ilevel = self:GetInformation()

-	if id then
+	if id then
 		self:UpdateItem(id, name, texture, count, quality, ilevel)
 	else
 		self:Clear()
@@ -131,6 +148,18 @@ function button:UpdateItem(id, name, texture, count, quality, ilevel)
 	else
 		button.Count:Hide()
 	end
+
+	if quality <= 0 then
+		button.JunkIcon:Show()
+	else
+		button.JunkIcon:Hide()
+	end
+	button.IconBorder:SetVertexColor(GetItemQualityColor(quality))
+	button.IconBorder:Show()
+
+	if C_NewItems.IsNewItem(self.bag, self.slot) then
+		button.newitemglowAnim:Play()
+	end
 end

 function button:Clear()
diff --git a/bag/container.lua b/bag/container.lua
index 7d76c95..b91f6c9 100644
--- a/bag/container.lua
+++ b/bag/container.lua
@@ -16,15 +16,20 @@ function containers:GetCurrencyBar()
 		self.currencyBar = CreateFrame("Frame", "DJUICurrencyBar", UIParent)
 		self.currencyBar:SetSize(container:GetWidth(), settings.saved.titleSize)
 		self.currencyBar:SetPoint("BOTTOMRIGHT", -300, 125)
-		self.currencyBar.background = self.currencyBar:CreateTexture("DJUICurrencyBarBackground", "BACKGROUND")
-		self.currencyBar.background:SetAllPoints()
-		self.currencyBar.background:SetTexture(0, 0, 0, 0.6)
+
+		self.currencyBar:SetBackdrop({
+	        bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
+	        edgeFile = "Interface\\Buttons\\WHITE8x8",
+	        tile = false, tileSize = 16, edgeSize = 1,
+    	})
+    	self.currencyBar:SetBackdropColor(unpack(settings.saved.containerColor))

 		self.currencyBar:SetMovable(true)
 		self.currencyBar:EnableMouse(true)
 		self.currencyBar:RegisterForDrag("LeftButton")
 		self.currencyBar:SetScript("OnDragStart", self.currencyBar.StartMoving)
 		self.currencyBar:SetScript("OnDragStop", self.currencyBar.StopMovingOrSizing)
+		tinsert(UISpecialFrames, self.currencyBar:GetName());
 	end

 	return self.currencyBar
@@ -38,14 +43,24 @@ function containers:GetContainer(name)
 	return self.list[name]
 end

+function containers:Toggle()
+	if containers.currencyBar:IsShown() then
+		containers:Hide()
+	else
+		containers:Show()
+	end
+end
+
 function containers:Show()
-	for k, v in pairs(self.list) do
+	containers.currencyBar:Show()
+	for k, v in pairs(containers.list) do
 		v:Show()
 	end
 end

 function containers:Hide()
-	for k, v in pairs(self.list) do
+	containers.currencyBar:Hide()
+	for k, v in pairs(containers.list) do
 		v:Hide()
 	end
 end
@@ -68,19 +83,25 @@ function container:Init(name)
 	self.name = name
 	self.items = {}

+	self:SetFrameLevel(5)
+
 	self.title = self:CreateFontString(self:GetName() .. "Title", "OVERLAY")
 	self.title:SetFont("Fonts\\FRIZQT__.TTF", settings.saved.titleSize, "OUTLINE")
 	self.title:SetText(name)
-	self.title:SetPoint("TOP", 0, -1)
-	self.title:SetTextColor(0.6, 0.36, 0, 1)
+	self.title:SetPoint("TOPLEFT", settings.saved.titlePadding, -settings.saved.titlePadding)
+	self.title:SetTextColor(unpack(settings.saved.titleColor))

 	self.itemContainer = CreateFrame("Frame", self:GetName() .. "ItemContainer", self)
 	self.itemContainer:SetPoint("TOPLEFT", self, "TOPLEFT", settings.saved.padding, -settings.saved.titleSize - settings.saved.padding)
 	self.itemContainer:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -settings.saved.padding, settings.saved.padding)

-	self.background = self:CreateTexture(self:GetName() .. "Background", "BACKGROUND")
-	self.background:SetAllPoints()
-	self.background:SetTexture(0, 0, 0, 0.6)
+	self:SetBackdrop({
+        bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
+        edgeFile = "Interface\\Buttons\\WHITE8x8",
+        tile = false, tileSize = 16, edgeSize = 1,
+    })
+    self:SetBackdropColor(unpack(settings.saved.containerColor))
+    tinsert(UISpecialFrames, self:GetName());

 	self:Position()
 end
@@ -170,6 +191,9 @@ function container:RemoveItem(item)
 		if self.items[i] == item then
 			table.remove(self.items, i)
 			self:Arrange()
+			if #self.items == 0 then
+				self:RepositionChildren()
+			end
 			break
 		end
 	end
@@ -201,6 +225,10 @@ function container:Arrange()
 		return
 	end

+	if containers.currencyBar:IsShown() then
+		self:Show()
+	end
+
 	self:SetSize(w, h)

 	self:ArrangeItems()
diff --git a/bag/core.lua b/bag/core.lua
index 9f0f860..e7a6fe3 100644
--- a/bag/core.lua
+++ b/bag/core.lua
@@ -17,7 +17,6 @@ function impl:ADDON_LOADED(name)
 				button:Update()
 			end
 		end
-		containers:Show()
 	end
 end

@@ -28,4 +27,36 @@ function impl:BAG_UPDATE(bag, slot)
 			button:Update()
 		end
 	end
-end
\ No newline at end of file
+end
+
+-- Replace the standard bags
+
+ToggleAllBags = function()
+	containers:Toggle()
+end
+
+ToggleBag = function()
+	containers:Toggle()
+end
+
+ToggleBackpack = function()
+	containers:Toggle()
+end
+
+OpenAllBags = function()
+	containers:Show()
+end
+
+OpenBackpack = function()
+	containers:Show()
+end
+
+CloseAllBags = function()
+	containers:Hide()
+end
+
+CloseBackpack = function()
+	containers:Hide()
+end
+
+-- BankFrame:UnregisterAllEvents()
\ No newline at end of file
diff --git a/bag/settings.lua b/bag/settings.lua
index df3571e..07c88e3 100644
--- a/bag/settings.lua
+++ b/bag/settings.lua
@@ -9,14 +9,20 @@ settings.saved = {
 	itemPadding = 3,
 	padding = 5,
 	bagPadding = 3,
-	titleSize = 15,
-	countFontSize = 10,
+	containerColor = {0, 0, 0, 0.6},
+	titleSize = 11,
+	titlePadding = 2,
+	titleColor = {0.8, 0.8, 0.8, 1},
+	countFontSize = 11,
+	countFontBotPadding = 2,
+	countFontSidePadding = 2,
 	types = {},
 	bagColumns = {
 		{
 			"Miscellaneous",
 			"Consumable",
 			"Trade Goods",
+			"Junk",
 			"Quest",
 		},
 		{