Skip to content

Commit b5e1d65

Browse files
kharenisrdw-software
authored andcommitted
Core: Added mount/item/pet filter
1 parent c77a28d commit b5e1d65

File tree

5 files changed

+116
-42
lines changed

5 files changed

+116
-42
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Embedded libraries that are used for local testing only
22
Libs/
33
*.CMD
4+
*.suo
5+
*.json
6+
*.sqlite

Core/GUI.lua

+60-42
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ local yellow = {r = 1.0, g = 1.0, b = 0.2}
104104
local gray = {r = 0.5, g = 0.5, b = 0.5}
105105
local white = {r = 1.0, g = 1.0, b = 1.0}
106106

107+
-- Types of items
108+
local MOUNT = "MOUNT"
109+
local PET = "PET"
110+
local ITEM = "ITEM"
111+
107112
-- Helper function (to look up map names more easily)
108113
-- TODO: DRY (not sure where this fits best, move after refactoring the rest and delete any duplicates)
109114
-- Returns the localized map name, or nil if the uiMapID is invalid
@@ -1745,34 +1750,41 @@ function R:ShowTooltip(hidden)
17451750
local somethingAdded = false
17461751

17471752
local group1start = debugprofilestop()
1748-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.mounts)
1749-
local group1end = debugprofilestop()
1750-
if addedLast then
1751-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1752-
end
1753-
if itemsExistInThisGroup then
1754-
somethingAdded = true
1753+
if(R.db.profile.collectionType[MOUNT]) then
1754+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.mounts)
1755+
1756+
if addedLast then
1757+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1758+
end
1759+
if itemsExistInThisGroup then
1760+
somethingAdded = true
1761+
end
17551762
end
1763+
local group1end = debugprofilestop()
17561764

17571765
local group2start = debugprofilestop()
1758-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.pets)
1759-
local group2end = debugprofilestop()
1760-
if addedLast then
1761-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1762-
end
1763-
if itemsExistInThisGroup then
1764-
somethingAdded = true
1766+
if(R.db.profile.collectionType[PET]) then
1767+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.pets)
1768+
if addedLast then
1769+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1770+
end
1771+
if itemsExistInThisGroup then
1772+
somethingAdded = true
1773+
end
17651774
end
1775+
local group2end = debugprofilestop()
17661776

17671777
local group3start = debugprofilestop()
1768-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.items)
1769-
local group3end = debugprofilestop()
1770-
if addedLast then
1771-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1772-
end
1773-
if itemsExistInThisGroup then
1774-
somethingAdded = true
1778+
if(R.db.profile.collectionType[ITEM]) then
1779+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.items)
1780+
if addedLast then
1781+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1782+
end
1783+
if itemsExistInThisGroup then
1784+
somethingAdded = true
1785+
end
17751786
end
1787+
local group3end = debugprofilestop()
17761788

17771789
local group4start = debugprofilestop()
17781790
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.user)
@@ -1785,34 +1797,40 @@ function R:ShowTooltip(hidden)
17851797
end
17861798

17871799
local group5start = debugprofilestop()
1788-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.mounts, true)
1789-
local group5end = debugprofilestop()
1790-
if addedLast then
1791-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1792-
end
1793-
if itemsExistInThisGroup then
1794-
somethingAdded = true
1800+
if(R.db.profile.collectionType[MOUNT]) then
1801+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.mounts, true)
1802+
if addedLast then
1803+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1804+
end
1805+
if itemsExistInThisGroup then
1806+
somethingAdded = true
1807+
end
17951808
end
1809+
local group5end = debugprofilestop()
17961810

17971811
local group6start = debugprofilestop()
1798-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.pets, true)
1799-
local group6end = debugprofilestop()
1800-
if addedLast then
1801-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1802-
end
1803-
if itemsExistInThisGroup then
1804-
somethingAdded = true
1812+
if(R.db.profile.collectionType[PET]) then
1813+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.pets, true)
1814+
if addedLast then
1815+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1816+
end
1817+
if itemsExistInThisGroup then
1818+
somethingAdded = true
1819+
end
18051820
end
1821+
local group6end = debugprofilestop()
18061822

18071823
local group7start = debugprofilestop()
1808-
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.items, true)
1809-
local group7end = debugprofilestop()
1810-
if addedLast then
1811-
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1812-
end
1813-
if itemsExistInThisGroup then
1814-
somethingAdded = true
1824+
if(R.db.profile.collectionType[ITEM]) then
1825+
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.items, true)
1826+
if addedLast then
1827+
tooltip:AddSeparator(1, 1, 1, 1, 1.0)
1828+
end
1829+
if itemsExistInThisGroup then
1830+
somethingAdded = true
1831+
end
18151832
end
1833+
local group7end = debugprofilestop()
18161834

18171835
local group8start = debugprofilestop()
18181836
addedLast, itemsExistInThisGroup = addGroup(self.db.profile.groups.user, true)

Locales.lua

+2
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,8 @@ L["This can be looted after killing Dionae."] = true
16301630
L["Stewart's Stewpendous Stew"] = true
16311631
L["Bleakwood Chest"] = true
16321632
L["Trapped Stonefiend"] = true
1633+
L["Collectable Type Filter"] = true
1634+
L["These toggles filter which items appear in the main Rarity tooltip. Items are categorized by their type (eg. Mounts, Battle Pets...). Turning off these checkboxes does not turn off tracking for any items within the category; it simply hides the item from the tooltip in order to help reduce the number of items in it."] = true
16331635

16341636
--[[
16351637
The rest of this file is auto-generated using the WoWAce localization application.

Modules/Options/Options.lua

+45
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,51 @@ function R:PrepareOptions()
787787
}, -- args
788788
}, -- contentCategory
789789

790+
collectionType = {
791+
type = "group",
792+
name = L["Collectable Type Filter"],
793+
order = newOrder(),
794+
inline = true,
795+
args = {
796+
797+
desc = {
798+
type = "description",
799+
name = L["These toggles filter which items appear in the main Rarity tooltip. Items are categorized by their type (eg. Mounts, Battle Pets...). Turning off these checkboxes does not turn off tracking for any items within the category; it simply hides the item from the tooltip in order to help reduce the number of items in it."],
800+
order = newOrder(),
801+
},
802+
mounts = {
803+
type = "toggle",
804+
order = newOrder(),
805+
name = L["Mounts"],
806+
get = function() return self.db.profile.collectionType[MOUNT] end,
807+
set = function(info, val)
808+
self.db.profile.collectionType[MOUNT] = val
809+
Rarity.GUI:UpdateText()
810+
end,
811+
},
812+
pets = {
813+
type = "toggle",
814+
order = newOrder(),
815+
name = L["Battle Pets"],
816+
get = function() return self.db.profile.collectionType[PET] end,
817+
set = function(info, val)
818+
self.db.profile.collectionType[PET] = val
819+
Rarity.GUI:UpdateText()
820+
end,
821+
},
822+
items = {
823+
type = "toggle",
824+
order = newOrder(),
825+
name = L["Toys & Items"],
826+
get = function() return self.db.profile.collectionType[ITEM] end,
827+
set = function(info, val)
828+
self.db.profile.collectionType[ITEM] = val
829+
Rarity.GUI:UpdateText()
830+
end,
831+
},
832+
833+
}, --args
834+
}, -- collectionType
790835

791836
bar = {
792837
type = "group",

Options_Defaults.lua

+6
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ function R:PrepareDefaults()
242242
[SHADOWLANDS] = true,
243243
},
244244

245+
collectionType = {
246+
[MOUNT] = true,
247+
[PET] = true,
248+
[ITEM] = true,
249+
},
250+
245251
-- These are achievements with the names of rare NPCs as criteria to kill
246252
achNpcs = {
247253
-- Burning Crusade

0 commit comments

Comments
 (0)