Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bag search update [BUGGY] & Action bar fixes

  • Loading branch information...
commit f2d40563a7b33be50b9540ae0c451f9a92346941 1 parent 8d311ce
@Safturento authored
View
1  SaftUI/SaftUI.toc
@@ -4,6 +4,7 @@
## Title: |cff00aaffSaftUI|r
## Notes: Saft's custom edit of Tukui
## RequiredDeps: Tukui
+## OptionalDeps: iFilger_Config
## SavedVariables: SaftUISaved
## SavedVariablesPerCharacter: SaftUISavedPerChar
SaftUI.xml
View
3  SaftUI/SaftUI.xml
@@ -11,7 +11,8 @@
<Script file="modules\unitframes.lua"/>
<Script file="modules\actionbars.lua"/>
<Script file="modules\experience.lua"/>
-
+ <Script file="modules\bags.lua"/>
+
<Script file="core\kill.lua"/>
<Script file="core\developer.lua"/>
</Ui>
View
1  SaftUI/core/api.lua
@@ -19,7 +19,6 @@ local function addapi(object)
if not object.SetPixelFont then mt.SetPixelFont = SetPixelFont end
if not object.RegisterEvents then mt.RegisterEvents = RegisterEvents end
if not object.round then mt.round = round end
-
end
local handled = {["Frame"] = true}
View
14 SaftUI/core/functions.lua
@@ -76,4 +76,18 @@ T.HidePortrait = function(self, unit)
end
-- weird bug, need to set level everytime to fix a portrait issue on dx9. :X
self.Portrait:SetFrameLevel(4)
+end
+
+T.SetModifiedTextColor = function(self, preserve)
+ local color = RAID_CLASS_COLORS[T.myclass]
+ if preserve then
+ self.originalColor = { self:GetTextColor() }
+ end
+ self:SetTextColor(color.r*.15, color.g*.15, color.b*.15)
+ self:SetTextColor(color.r, color.g, color.b)
+end
+
+T.SetOriginalTextColor = function(self)
+ local color = RAID_CLASS_COLORS[T.myclass]
+ self:SetTextColor(unpack(self.originalColor or {1, 1, 1, 1}) )
end
View
42 SaftUI/modules/actionbars.lua
@@ -138,7 +138,7 @@ local function LoadActionBarConfig()
local config = CreateFrame("Frame", "SaftUIActionBarConfig", UIParent)
local titleBar = CreateFrame("Frame", config:GetName().."TitleBar", config)
- config:SetSize(150, 150)
+ config:SetSize(150, 100)
titleBar:SetSize(config:GetWidth(), 20)
config:SetPoint("TOP", titleBar, "BOTTOM", 0, -2)
titleBar:SetPoint("BOTTOM", UIParent, "CENTER", 0, 141) --this should center it perectly
@@ -146,12 +146,19 @@ local function LoadActionBarConfig()
titleBar:SetTemplate()
config:SetTemplate("Transparent")
+ titleBar:SetMovable(true)
+ titleBar:EnableMouse(true)
+ titleBar:SetScript("OnMouseDown", function(self) self:StartMoving() end)
+ titleBar:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
+
local title = titleBar:CreateFontString(nil, "OVERLAY")
title:SetPoint("CENTER")
title:SetPixelFont()
title:SetText("Action Bar Config")
titleBar.text = title
+ titleBar:SetScript("OnEnter", T.SetModifiedBackdrop)
+
local close = CreateFrame("Button", nil, titleBar)
close:SetPoint("RIGHT", -3, 0)
close:SetSize(18,18)
@@ -160,13 +167,34 @@ local function LoadActionBarConfig()
close.text:SetText('x')
close.text:SetPoint("CENTER", 0, 0)
close:SetScript("OnMouseDown", function() config:Hide() end)
- close:SetScript("OnEnter", T.SetModifiedBackdrop)
- close:SetScript("OnLeave", T.SetOriginalBackdropo)
+ close:SetScript("OnEnter", function(self) T.SetModifiedTextColor(self.text, true) end)
+ close:SetScript("OnLeave", function(self) T.SetOriginalTextColor(self.text) end)
titleBar.close = close
config.titleBar = titleBar
local options = CreateFrame("Frame", config:GetName().."OptionsWindow", config)
options:SetInside(config)
+
+ local function UpdateButtonVisibility()
+ if SaftUISavedPerChar.ActionBars.barLocations.BOTTOM + SaftUISavedPerChar.ActionBars.barLocations.SIDE >= 5 then
+ for i=1, 2 do options[i].plus:Hide() end
+ else
+ for i=1, 2 do options[i].plus:Show() end
+ end
+
+ if SaftUISavedPerChar.ActionBars.barLocations.BOTTOM <= 0 then
+ options[1].minus:Hide()
+ else
+ options[1].minus:Show()
+ end
+
+ if SaftUISavedPerChar.ActionBars.barLocations.SIDE <= 0 then
+ options[2].minus:Hide()
+ else
+ options[2].minus:Show()
+ end
+ end
+
for i=1, 2 do
local option = CreateFrame("Frame", options:GetName().."Option1", options)
option:SetWidth(options:GetWidth())
@@ -210,16 +238,18 @@ local function LoadActionBarConfig()
counter:SetText(SaftUISavedPerChar.ActionBars.barLocations.BOTTOM)
plus:SetScript("OnMouseDown", function()
+ local bottom = SaftUISavedPerChar.ActionBars.barLocations.BOTTOM
SaftUISavedPerChar.ActionBars.barLocations.BOTTOM = SaftUISavedPerChar.ActionBars.barLocations.BOTTOM + 1
-
counter:SetText(SaftUISavedPerChar.ActionBars.barLocations.BOTTOM)
UpdateBarsPositions()
+ UpdateButtonVisibility()
end)
minus:SetScript("OnMouseDown", function()
SaftUISavedPerChar.ActionBars.barLocations.BOTTOM = SaftUISavedPerChar.ActionBars.barLocations.BOTTOM - 1
counter:SetText(SaftUISavedPerChar.ActionBars.barLocations.BOTTOM)
UpdateBarsPositions()
+ UpdateButtonVisibility()
end)
else
option:SetPoint("TOP", options[i-1], "BOTTOM", 0, 0)
@@ -230,16 +260,20 @@ local function LoadActionBarConfig()
SaftUISavedPerChar.ActionBars.barLocations.SIDE = SaftUISavedPerChar.ActionBars.barLocations.SIDE + 1
counter:SetText(SaftUISavedPerChar.ActionBars.barLocations.SIDE)
UpdateBarsPositions()
+ UpdateButtonVisibility()
end)
minus:SetScript("OnMouseDown", function()
SaftUISavedPerChar.ActionBars.barLocations.SIDE = SaftUISavedPerChar.ActionBars.barLocations.SIDE - 1
counter:SetText(SaftUISavedPerChar.ActionBars.barLocations.SIDE)
UpdateBarsPositions()
+ UpdateButtonVisibility()
end)
end
options[i] = option
end
+
+ UpdateButtonVisibility()
end
SLASH_ACTIONBARCONFIG1 = "/abc"
View
61 SaftUI/modules/bags.lua
@@ -0,0 +1,61 @@
+ITEM_RARITY_STRINGS = {
+ [0] = "Poor",
+ [1] = "Common",
+ [2] = "Uncommon",
+ [3] = "Rare",
+ [4] = "Epic",
+ [5] = "Legendary",
+ [6] = "Artifact",
+ [7] = "Heriloom",
+}
+
+local queryShortcuts = {
+ ["boe"] = "binds when equipped",
+ ["bop"] = "soulbound",
+}
+
+local function checkMatch(self, query)
+ if not self.name then return end
+ if queryShortcuts[query] then
+ query = queryShortcuts[query]
+ end
+
+ local name, link, quality, iLvl, minLvl, class, subclass, count, equiploc= GetItemInfo(self.name)
+ local parseString = name.." "..ITEM_RARITY_STRINGS[quality].." " ..class.." "..subclass.." " ..equiploc
+
+ GameTooltip:SetBagItem(self.bag, self.slot)
+ for i=1, GameTooltip:NumLines() do
+ local left, right = _G["GameTooltipTextLeft"..i], _G["GameTooltipTextRight"..i]
+ if left:GetText() then
+ parseString = parseString .. " " .. left:GetText()
+ end
+ if right:GetText() then
+ parseString = parseString .. " " .. right:GetText()
+ end
+ end
+
+ return strfind(strlower(parseString), strlower(query), 1, true)
+end
+
+function Stuffing:SearchUpdate(query)
+ for _, b in ipairs(self.buttons) do
+ if b.frame and not b.name then
+ b.frame:SetAlpha(.2)
+ end
+ if not checkMatch(b, query) then
+ SetItemButtonDesaturated(b.frame, 1, 1, 1, 1)
+ b.frame:SetAlpha(.2)
+ else
+ SetItemButtonDesaturated(b.frame, 0, 1, 1, 1)
+ b.frame:SetAlpha(1)
+ end
+ end
+end
+
+local updateSearch = function(self, t)
+ if t == true then
+ Stuffing:SearchUpdate(self:GetText())
+ end
+end
+
+TukuiBags.editbox:SetScript("OnTextChanged", updateSearch)
Please sign in to comment.
Something went wrong with that request. Please try again.