Skip to content

Commit

Permalink
Merge pull request #282 from ForsakenNGS/bis-enhancement
Browse files Browse the repository at this point in the history
 Enhanced Favourite-/BiS-Lists
  • Loading branch information
Hoizame authored Nov 27, 2022
2 parents c1047f9 + 350a48b commit db21f50
Show file tree
Hide file tree
Showing 10 changed files with 1,631 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,16 @@ globals = {
"ATLAS_DROPDOWNS",
"ATLAS_SMALLFRAME_SELECTED",

-- Other
"Outfitter",

-- misc custom
"AceGUIWidgetLSMlists",
"CUSTOM_CLASS_COLORS",
"LibStub",

-- FrameXML misc
"C_BattleNet",
"C_CurrencyInfo",
"C_ChatInfo",
"ChatEdit_InsertLink",
Expand Down
1 change: 1 addition & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ externals:
AtlasLootClassic/Libs/LibSharedMedia-3.0: https://repos.wowace.com/wow/libsharedmedia-3-0/trunk/LibSharedMedia-3.0
AtlasLootClassic/Libs/LibDBIcon-1.0: https://repos.wowace.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0
AtlasLootClassic/Libs/AceDB-3.0: https://repos.wowace.com/wow/ace3/trunk/AceDB-3.0
AtlasLootClassic/Libs/AceComm-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceComm-3.0
AtlasLootClassic_Options/Libs/AceConfig-3.0: https://repos.wowace.com/wow/ace3/trunk/AceConfig-3.0
AtlasLootClassic_Options/Libs/AceGUI-3.0: https://repos.wowace.com/wow/ace3/trunk/AceGUI-3.0
AtlasLootClassic_Options/Libs/AceDBOptions-3.0: https://repos.wowace.com/wow/ace3/trunk/AceDBOptions-3.0
Expand Down
628 changes: 622 additions & 6 deletions AtlasLootClassic/Addons/Favourites.lua

Large diffs are not rendered by default.

57 changes: 52 additions & 5 deletions AtlasLootClassic/Addons/Favourites_GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ local function ShowOptionsOnClick()
AtlasLoot.Loader:LoadModule("AtlasLootClassic_Options", ShowFavOptions)
end

local function ChatLinkOnClick()
Favourites:InsertChatLink()
end

local function ShowAllItemsOnClick()
GUI:SelectSlot(nil)
end
Expand Down Expand Up @@ -224,6 +228,7 @@ local function GUI_InfoOnEnter(self)
tooltip:SetOwner(self, "ANCHOR_LEFT", (self:GetWidth() * 0.5), 5)
tooltip:AddLine(AL["Favourites"], 0, 1, 0)
tooltip:AddLine(format(TT_INFO_ENTRY, AL["Alt + Left Click"], AL["Remove item from list"]))
tooltip:AddLine(format(TT_INFO_ENTRY, AL["Alt + Right Click"], AL["Change item note"]))
tooltip:AddLine(ALIL["Dressing Room"]..":", 1, 1, 1)
tooltip:AddLine(format(TT_INFO_ENTRY, AL["Right Click"], AL["Undress item"]))
tooltip:Show()
Expand Down Expand Up @@ -269,10 +274,14 @@ local function SlotButton_OnClick(self, button, down)
end
end
elseif self.ItemID then
local b = ItemButtonType.ItemClickHandler:Get(button)
ItemButtonType.OnMouseAction(self, button)
if b == "SetFavourite" then
UpdateItemFrame(true)
if button == "LeftButton" then
local b = ItemButtonType.ItemClickHandler:Get(button)
ItemButtonType.OnMouseAction(self, button)
if b == "SetFavourite" then
UpdateItemFrame(true)
end
elseif button == "RightButton" then
GUI:OnItemNoteChange(self.ItemID)
end
end
end
Expand Down Expand Up @@ -314,7 +323,13 @@ local function SlotButton_SetSlotItem(self, itemID)
self.modelFrame:TryOn("item:"..itemID)
end
end
if GetItemCount(itemID, true) > 0 then
local obsoleteType = Favourites:IsItemEquippedOrObsolete(itemID)
if obsoleteType then
if obsoleteType == "obsolete" then
self.ownedItem:SetVertexColor(0.6, 0.6, 0.6) -- Darken items that are obsolete but not owned a bit
else
self.ownedItem:SetVertexColor(1.0, 1.0, 1.0)
end
self.ownedItem:Show()
else
self.ownedItem:Hide()
Expand Down Expand Up @@ -750,6 +765,11 @@ function GUI:Create()
frame.content.optionsButton:SetText(AL["Settings"])
frame.content.optionsButton:SetScript("OnClick", ShowOptionsOnClick)

frame.content.chatLinkButton = AtlasLoot.GUI.CreateButton()
frame.content.chatLinkButton:SetPoint("LEFT", frame.content.optionsButton, "RIGHT", 5, 0)
frame.content.chatLinkButton:SetText(AL["Chat-Link"])
frame.content.chatLinkButton:SetScript("OnClick", ChatLinkOnClick)

frame.content.showAllItems = AtlasLoot.GUI.CreateButton()
frame.content.showAllItems:SetPoint("LEFT", frame.content.bottomBg, "LEFT", 2, 0)
frame.content.showAllItems:SetText(AL["Show all items"])
Expand Down Expand Up @@ -815,6 +835,33 @@ function GUI:Create()

frame:Hide()
end
if not self.popupNote then
local gui = self
StaticPopupDialogs["ATLASLOOT_FAVOURITE_NOTE_POPUP"] = {
text = AL["Enter a note for %s"],
button1 = AL["Save"],
button2 = AL["Cancel"],
whileDead = true,
hideOnEscape = true,
maxLetters = 100,
hasEditBox = true,
OnAccept = function(self, data, data2)
if gui.popupNoteId then
Favourites:SetItemNote(gui.popupNoteId, self.editBox:GetText())
gui.popupNoteId = nil
end
end,
}
self.popupNote = StaticPopupDialogs["ATLASLOOT_FAVOURITE_NOTE_POPUP"]
end
end

function GUI:OnItemNoteChange(itemId, note)
self.popupNoteId = itemId
local itemName, itemLink = GetItemInfo(itemId)
local itemNote = Favourites:GetItemNote(itemId)
local popup = StaticPopup_Show("ATLASLOOT_FAVOURITE_NOTE_POPUP", itemLink)
popup.editBox:SetText(itemNote or "")
end

function GUI:UpdateStyle()
Expand Down
119 changes: 107 additions & 12 deletions AtlasLootClassic/GUI/GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local AtlasLoot = _G.AtlasLoot
local GUI = {}
local AL = AtlasLoot.Locales
local ALIL = AtlasLoot.IngameLocales
local Favourites

local LibSharedMedia = LibStub("LibSharedMedia-3.0")

Expand Down Expand Up @@ -40,6 +41,10 @@ local RIGHT_SELECTION_ENTRYS = {
local db
local LoadAtlasLootModule

local function OnFavouritesAddonLoad(addon, enabled)
Favourites = enabled and addon or nil
end

local function UpdateFrames(noPageUpdate, forceContentUpdate)
local moduleData = AtlasLoot.ItemDB:Get(db.selected[1])
if not moduleData then return end
Expand Down Expand Up @@ -735,12 +740,30 @@ LoadAtlasLootModule = function(abc)
}
}
end
-- add favourites
local name = moduleData[content]:GetName()
local tt_title = moduleData[content]:GetName()
local tt_text = moduleData[content]:GetInfo()
if Favourites then
local favCounts = Favourites:CountFavouritesByList(db.selected[1], content)
local favOverall = 0
for listName, itemCount in pairs(favCounts) do
if tt_text ~= nil then
tt_text = tt_text.."\n"
end
tt_text = (tt_text or "")..Favourites:GetFavouriteListText(listName, itemCount)
favOverall = favOverall + itemCount
end
if favOverall > 0 then
name = name..Favourites:GetFavouriteCountText(favOverall)
end
end
-- add ini
loadedContent[contentIndex][ #loadedContent[contentIndex]+1 ] = {
id = content,
name = moduleData[content]:GetName(),
tt_title = moduleData[content]:GetName(),
tt_text = moduleData[content]:GetInfo(),
name = name,
tt_title = tt_title,
tt_text = tt_text,
}
end
end
Expand Down Expand Up @@ -853,21 +876,42 @@ local function SubCatSelectFunction(self, id, arg)
moduleData:CheckForLink(id, i)
if tabVal.ExtraList then
if not dataExtra then dataExtra = {} end
local name = moduleData[id]:GetNameForItemTable(i)
local tt_title = moduleData[id]:GetNameForItemTable(i)
local tt_text = tabVal.info -- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
if Favourites then
local favouriteCounts = Favourites:CountFavouritesByList(db.selected[1], db.selected[2], i)
local favouriteOverall = 0
for listName, itemCount in pairs(favouriteCounts) do
if tt_text ~= nil then
tt_text = tt_text.."\n"
end
tt_text = (tt_text or "")..Favourites:GetFavouriteListText(listName, itemCount)
favouriteOverall = favouriteOverall + itemCount
end
if (favouriteOverall > 0) then
name = name..Favourites:GetFavouriteCountText(favouriteOverall)
end
end
dataExtra[#dataExtra+1] = {
id = i,
name = moduleData[id]:GetNameForItemTable(i),
name = name,
name_org = name,
coinTexture = tabVal.CoinTexture,
tt_title = moduleData[id]:GetNameForItemTable(i),
tt_text = tabVal.info-- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
tt_title = tt_title,
tt_text = tt_text, -- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
tt_text_org = tt_text -- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
}
if not dataExtra[#dataExtra].name then dataExtra[#dataExtra] = nil end
else
data[#data+1] = {
id = i,
name = moduleData[id]:GetNameForItemTable(i),
name_org = moduleData[id]:GetNameForItemTable(i),
coinTexture = tabVal.CoinTexture,
tt_title = moduleData[id]:GetNameForItemTable(i),
tt_text = tabVal.info-- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
tt_text = tabVal.info, -- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
tt_text_org = tabVal.info -- or AtlasLoot.EncounterJournal:GetBossInfo(tabVal.EncounterJournalID)
}
if not data[#data].name then data[#data] = nil end
if linkedContentLastBoss and data[#data] and data[#data].name == linkedContentLastBoss.name then
Expand Down Expand Up @@ -901,10 +945,28 @@ local function BossSelectFunction(self, id, arg)
local bossData = moduleData[db.selected[2]].items[id]
for count = 1, #difficultys do
if bossData[count] then
data[ #data+1 ] = {
local name = bossData[count].diffName or difficultys[count].name
local tt_title = bossData[count].diffName or difficultys[count].name
local tt_text = nil
if Favourites then
local favouriteCounts = Favourites:CountFavouritesByList(db.selected[1], db.selected[2], nil, count)
local favouriteOverall = 0
for listName, itemCount in pairs(favouriteCounts) do
if tt_text ~= nil then
tt_text = tt_text.."\n"
end
tt_text = (tt_text or "")..Favourites:GetFavouriteListText(listName, itemCount)
favouriteOverall = favouriteOverall + itemCount
end
if (favouriteOverall > 0) then
name = name..Favourites:GetFavouriteCountText(favouriteOverall)
end
end
data[#data+1] = {
id = count,
name = bossData[count].diffName or difficultys[count].name,
tt_title = bossData[count].diffName or difficultys[count].name
name = name,
tt_title = tt_title,
tt_text = tt_text
}
diffCount = diffCount + 1
end
Expand All @@ -926,10 +988,24 @@ local function ExtraSelectFunction(self, id, arg)
local diffCount = 0
for count = 1, #difficultys do
if moduleData[db.selected[2]].items[id][count] then
local name = moduleData[db.selected[2]].items[id][count].diffName or difficultys[count].name
local tt_title = moduleData[db.selected[2]].items[id][count].diffName or difficultys[count].name
local tt_text = ""

if Favourites then
local favCount = Favourites:CountFavouritesByList(db.selected[1], db.selected[2], id, count)
local favOverall = 0
for favList, favItems in pairs(favCount) do
tt_text = tt_text.."\n"..Favourites:GetFavouriteListText(favList, favItems)
favOverall = favOverall + favItems
end
name = name..Favourites:GetFavouriteCountText(favOverall)
end
data[ #data+1 ] = {
id = count,
name = moduleData[db.selected[2]].items[id][count].diffName or difficultys[count].name,
tt_title = moduleData[db.selected[2]].items[id][count].diffName or difficultys[count].name
name = name,
tt_title = tt_title,
tt_text = tt_text
}
diffCount = diffCount + 1
end
Expand All @@ -944,6 +1020,22 @@ local function DifficultySelectFunction(self, id, arg, start)
if not start then
db.selected[4] = id
end
if Favourites then
-- Update boss tooltips to contain the number of favourite items per list
for i, boss in ipairs(GUI.frame.boss.data) do
-- count favourite items and add to tooltip
local favCount = Favourites:CountFavouritesByList(db.selected[1], db.selected[2], i, id)
local favOverall = 0
local favText = ""
for favList, favItems in pairs(favCount) do
favText = favText.."\n"..Favourites:GetFavouriteListText(favList, favItems)
favOverall = favOverall + favItems
end
boss.tt_text = (boss.tt_text_org or "")..favText
boss.name = boss.name_org..Favourites:GetFavouriteCountText(favOverall)
end
GUI.frame.boss:UpdateContent()
end
UpdateFrames()
end

Expand All @@ -955,6 +1047,9 @@ function GUI.Init()

GUI:Create()

-- Get favourites addon if loaded
AtlasLoot.Addons:GetAddon("Favourites", OnFavouritesAddonLoad)

-- Class Info
PLAYER_CLASS, PLAYER_CLASS_FN = UnitClass("player")

Expand Down
Loading

0 comments on commit db21f50

Please sign in to comment.