diff --git a/Libs/AceAddon-3.0/AceAddon-3.0.lua b/Libs/AceAddon-3.0/AceAddon-3.0.lua index 00e4e48..f392a21 100644 --- a/Libs/AceAddon-3.0/AceAddon-3.0.lua +++ b/Libs/AceAddon-3.0/AceAddon-3.0.lua @@ -28,7 +28,7 @@ -- end -- @class file -- @name AceAddon-3.0.lua --- @release $Id$ +-- @release $Id: AceAddon-3.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ local MAJOR, MINOR = "AceAddon-3.0", 13 local AceAddon, oldminor = LibStub:NewLibrary(MAJOR, MINOR) diff --git a/Libs/AceConsole-3.0/AceConsole-3.0.lua b/Libs/AceConsole-3.0/AceConsole-3.0.lua index 8e5ec81..2361a3b 100644 --- a/Libs/AceConsole-3.0/AceConsole-3.0.lua +++ b/Libs/AceConsole-3.0/AceConsole-3.0.lua @@ -9,7 +9,7 @@ -- make into AceConsole. -- @class file -- @name AceConsole-3.0 --- @release $Id$ +-- @release $Id: AceConsole-3.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ local MAJOR,MINOR = "AceConsole-3.0", 7 local AceConsole, oldminor = LibStub:NewLibrary(MAJOR, MINOR) diff --git a/Libs/AceGUI-3.0/AceGUI-3.0.lua b/Libs/AceGUI-3.0/AceGUI-3.0.lua index 35b176e..f05b1ed 100644 --- a/Libs/AceGUI-3.0/AceGUI-3.0.lua +++ b/Libs/AceGUI-3.0/AceGUI-3.0.lua @@ -24,7 +24,7 @@ -- f:AddChild(btn) -- @class file -- @name AceGUI-3.0 --- @release $Id$ +-- @release $Id: AceGUI-3.0.lua 1288 2022-09-25 14:19:00Z funkehdude $ local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 41 local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua index d57b008..ec811d0 100644 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- ColorPicker Widget -------------------------------------------------------------------------------]] -local Type, Version = "ColorPicker", 25 +local Type, Version = "ColorPicker", 28 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -11,13 +11,24 @@ local pairs = pairs -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent +-- Unfortunately we have no way to realistically detect if a client uses inverted alpha +-- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted +local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) + --[[----------------------------------------------------------------------------- Support functions -------------------------------------------------------------------------------]] local function ColorCallback(self, r, g, b, a, isAlpha) + if INVERTED_ALPHA and a then + a = 1 - a + end if not self.HasAlpha then a = 1 end + -- no change, skip update + if r == self.r and g == self.g and b == self.b and a == self.a then + return + end self:SetColor(r, g, b, a) if ColorPickerFrame:IsVisible() then --colorpicker is still open @@ -50,30 +61,63 @@ local function ColorSwatch_OnClick(frame) ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) ColorPickerFrame:SetClampedToScreen(true) - ColorPickerFrame.func = function() - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = 1 - OpacitySliderFrame:GetValue() - ColorCallback(self, r, g, b, a) - end - - ColorPickerFrame.hasOpacity = self.HasAlpha - ColorPickerFrame.opacityFunc = function() - local r, g, b = ColorPickerFrame:GetColorRGB() - local a = 1 - OpacitySliderFrame:GetValue() - ColorCallback(self, r, g, b, a, true) - end - - local r, g, b, a = self.r, self.g, self.b, self.a - if self.HasAlpha then - ColorPickerFrame.opacity = 1 - (a or 0) - end - ColorPickerFrame:SetColorRGB(r, g, b) - - ColorPickerFrame.cancelFunc = function() - ColorCallback(self, r, g, b, a, true) + if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul + local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1) + if INVERTED_ALPHA then + a2 = 1 - a2 + end + + local info = { + swatchFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = ColorPickerFrame:GetColorAlpha() + ColorCallback(self, r, g, b, a) + end, + + hasOpacity = self.HasAlpha, + opacityFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = ColorPickerFrame:GetColorAlpha() + ColorCallback(self, r, g, b, a, true) + end, + opacity = a2, + + cancelFunc = function() + ColorCallback(self, r2, g2, b2, a2, true) + end, + + r = r2, + g = g2, + b = b2, + } + + ColorPickerFrame:SetupColorPickerAndShow(info) + else + ColorPickerFrame.func = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + ColorCallback(self, r, g, b, a) + end + + ColorPickerFrame.hasOpacity = self.HasAlpha + ColorPickerFrame.opacityFunc = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + ColorCallback(self, r, g, b, a, true) + end + + local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1) + if self.HasAlpha then + ColorPickerFrame.opacity = a + end + ColorPickerFrame:SetColorRGB(r, g, b) + + ColorPickerFrame.cancelFunc = function() + ColorCallback(self, r, g, b, a, true) + end + + ColorPickerFrame:Show() end - - ColorPickerFrame:Show() end AceGUI:ClearFocus() end diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua index 6fe30ea..947184c 100644 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua @@ -1,4 +1,4 @@ ---[[ $Id$ ]]-- +--[[ $Id: AceGUIWidget-DropDown-Items.lua 1272 2022-08-29 15:56:35Z nevcairiel $ ]]-- local AceGUI = LibStub("AceGUI-3.0") diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua index 9fde707..59c7f53 100644 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua @@ -1,4 +1,4 @@ ---[[ $Id$ ]]-- +--[[ $Id: AceGUIWidget-DropDown.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]-- local AceGUI = LibStub("AceGUI-3.0") -- Lua APIs diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua index bb1e4fd..f2a238b 100644 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- EditBox Widget -------------------------------------------------------------------------------]] -local Type, Version = "EditBox", 28 +local Type, Version = "EditBox", 29 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -10,7 +10,7 @@ local tostring, pairs = tostring, pairs -- WoW APIs local PlaySound = PlaySound -local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo +local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G @@ -76,12 +76,16 @@ end local function EditBox_OnReceiveDrag(frame) local self = frame.obj - local type, id, info = GetCursorInfo() + local type, id, info, extra = GetCursorInfo() local name if type == "item" then name = info elseif type == "spell" then - name = GetSpellInfo(id, info) + if C_Spell and C_Spell.GetSpellName then + name = C_Spell.GetSpellName(extra) + else + name = GetSpellInfo(id, info) + end elseif type == "macro" then name = GetMacroInfo(id) end diff --git a/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua b/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua index bacb2be..f0095b5 100644 --- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua +++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua @@ -1,4 +1,4 @@ -local Type, Version = "MultiLineEditBox", 32 +local Type, Version = "MultiLineEditBox", 33 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -6,7 +6,7 @@ if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end local pairs = pairs -- WoW APIs -local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor +local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G @@ -100,9 +100,13 @@ local function OnMouseUp(self) end local function OnReceiveDrag(self) -- EditBox / ScrollFrame - local type, id, info = GetCursorInfo() + local type, id, info, extra = GetCursorInfo() if type == "spell" then - info = GetSpellInfo(id, info) + if C_Spell and C_Spell.GetSpellName then + info = C_Spell.GetSpellName(extra) + else + info = GetSpellInfo(id, info) + end elseif type ~= "item" then return end diff --git a/PotentialDarkmoonDecks.lua b/PotentialDarkmoonDecks.lua index a6ed6a0..8c169e1 100644 --- a/PotentialDarkmoonDecks.lua +++ b/PotentialDarkmoonDecks.lua @@ -71,33 +71,9 @@ local function isDMCard(itemLink) return cardInfo end -local function GetCharacterGuild(account, realm, guildName) - local guildKey = DataStore:GetGuild(guildName, realm, account) - if guildKey then - return DataStore_Containers.db.global.Guilds[guildKey] - end -end - -local function _IterateGuildBankSlots(guild, callback) - for tabID, tab in pairs(guild.Tabs) do - if tab.name then - for slotID = 1, 98 do - local itemID, itemLink, itemCount, isBattlePet = DataStore:GetSlotInfo(tab, slotID) - - -- Callback only if there is an item in that slot - if itemID then - local location = format("%s, %s - col %d/row %d)", GUILD_BANK, tab.name, floor((slotID-1)/7)+1, ((slotID-1)%7)+1) - - callback(location, itemID, itemLink, itemCount, isBattlePet) - end - end - end - end -end - -local function AddCard(cards, cardInfo) +local function AddCard(cards, cardInfo, source) local suit = cardInfo.suit - -- addon:Print("AddCard " .. cardInfo.rank .. " of " .. suit) + -- addon:Print("AddCard " .. cardInfo.rank .. " of " .. suit .. " from " .. source) if not cards[suit] then cards[suit] = {} end @@ -107,37 +83,46 @@ local function AddCard(cards, cardInfo) end end +-- with TWW and the warbank, we can now look on "disconnected realms" and both factions +local isRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) +local searchAllRealms = isRetail + local function FindCards() - local connectedRealms = GetAutoCompleteRealms() + local connectedRealms + if not searchAllRealms then connectedRealms = GetAutoCompleteRealms() end local currentFaction = UnitFactionGroup("player") local guilds = {} local cards = {} for account in pairs(DataStore:GetAccounts()) do for realm in pairs(DataStore:GetRealms(account)) do - if contains(connectedRealms, realm) then + if not connectedRealms or contains(connectedRealms, realm) then for characterName, character in pairs(DataStore:GetCharacters(realm, account)) do - if DataStore:GetCharacterFaction(character) == currentFaction then + if searchAllRealms or (DataStore:GetCharacterFaction(character) == currentFaction) then + local characterNameWithRealm = characterName .. "-" .. realm -- check this character's inventory - -- addon:Print("checking inventory " .. characterName) + -- addon:Print("checking inventory " .. characterNameWithRealm) DataStore:IterateContainerSlots(character, function(containerName, itemID, itemLink, itemCount, isBattlePet) local cardInfo = isDMCard(itemLink) if cardInfo then - AddCard(cards, cardInfo) + AddCard(cards, cardInfo, characterNameWithRealm .. " inventory") end end) -- check this character's guild bank - -- addon:Print("checking guild vault " .. characterName) - local guildName = DataStore:GetGuildInfo(character) + local guildName = DataStore:GetGuildName(character) + -- addon:Print(characterNameWithRealm .. "(" .. tostring(character) .. ") is in guild " .. tostring(guildName)) if guildName and not contains(guilds, guildName) then - local guild = GetCharacterGuild(account, realm, guildName) - if guild then + -- addon:Print("checking guild vault " .. guildName .. " for " .. characterNameWithRealm) + -- local guild = GetCharacterGuild(account, realm, guildName) + -- if guild then + local guildID = DataStore:GetCharacterGuildID(character) + if guildID then -- addon:Print("checking guild bank " .. guildName) table.insert(guilds, guildName) - _IterateGuildBankSlots(guild, function(location, itemID, itemLink, itemCount, isBattlePet) - local cardInfo = isDMCard(itemLink) + local guild = account .. "." .. realm .. "." .. guildName + DataStore:IterateGuildBankSlots(guild, function(location, itemID, itemLink, itemCount, isBattlePet) + local cardInfo = isDMCard(itemLink, true) if cardInfo then - AddCard(cards, cardInfo) - -- addon:Print(guildName .. " has card " .. itemLink) + AddCard(cards, cardInfo, "guild bank " .. guildName) end end) end diff --git a/PotentialDarkmoonDecks.toc b/PotentialDarkmoonDecks.toc index b6c9461..da45cc9 100644 --- a/PotentialDarkmoonDecks.toc +++ b/PotentialDarkmoonDecks.toc @@ -1,8 +1,8 @@ -## Interface: 100207 +## Interface: 110002 ## Title: PotentialDarkmoonDecks ## Notes: Display Darkmoon cards ## Author: SpareSimian -## Version: 0.7 +## Version: 0.8 ## Dependencies: DataStore, DataStore_Containers, DataStore_Characters ## IconTexture: Interface\Icons\Inv_inscription_darkmooncard_putrescence_a ## AddonCompartmentFunc: pddgui_OnAddonCompartmentClick