From 8a6a6ce1e65504dc74cbc176e1c93783c267b1b5 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Thu, 25 Jul 2024 21:28:29 -0500 Subject: [PATCH] Initial TWW updates --- .github/workflows/deploy-packager.yml | 2 +- .vscode/settings.json | 383 ++++++++++++++++++++++++++ Scoreboard.lua | 9 +- Scoreboard.toc | 3 +- config.lua | 110 ++++---- i18n/enUS.lua | 3 + stylua.toml | 3 + 7 files changed, 449 insertions(+), 64 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 stylua.toml diff --git a/.github/workflows/deploy-packager.yml b/.github/workflows/deploy-packager.yml index 9ef40d6..790f6e3 100644 --- a/.github/workflows/deploy-packager.yml +++ b/.github/workflows/deploy-packager.yml @@ -16,6 +16,6 @@ jobs: GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Package and Release uses: BigWigsMods/packager@master diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..52e907d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,383 @@ +{ + "Lua.diagnostics.globals": [ + "Settings", + "NORMAL_FONT_COLOR_CODE", + "HIGHLIGHT_FONT_COLOR_CODE", + "DISABLED_FONT_COLOR_CODE", + "CreateFrame", + "FONT_COLOR_CODE_CLOSE", + "IsInGuild", + "GetNumGuildMembers", + "GetGuildInfo", + "C_FriendList", + "ToggleGuildFrame", + "InCombatLockdown", + "HideUIPanel", + "ShowUIPanel", + "FriendsFrame", + "NUM_ACTIONBAR_BUTTONS", + "hooksecurefunc", + "ToggleCharacter", + "StaticPopup_Show", + "ALL", + "CALLINGS_QUESTS", + "COLOR", + "CURRENCY", + "DELETE", + "EMBLEM_SYMBOL", + "GREEN_FONT_COLOR_CODE", + "LEVEL", + "RED_FONT_COLOR_CODE", + "StaticPopupDialogs", + "DUNGEON_DIFFICULTY1", + "DUNGEON_DIFFICULTY2", + "RAID_DIFFICULTY1", + "RAID_DIFFICULTY2", + "RAID_DIFFICULTY3", + "RAID_DIFFICULTY4", + "STATICPOPUP_NUMDIALOGS", + "OKAY", + "CANCEL", + "EXPANSION_NAME0", + "LFG_TYPE_RAID", + "SettingsPanel", + "InterfaceOptionsFrame_OpenToCategory", + "ToggleDropDownMenu", + "UnitPopup_ShowMenu", + "CHAT_FLAG_AFK", + "CHAT_FLAG_DND", + "TravelPassDropDown", + "ChatFrame_SendBNetTell", + "BNET_CLIENT_APP", + "BNET_CLIENT_WOW", + "FRIENDS_TEXTURE_AFK", + "FRIENDS_TEXTURE_DND", + "ChatFrame_SendTell", + "CanGroupWithAccount", + "REMOTE_CHAT", + "BNet_GetClientEmbeddedAtlas", + "FRIENDS_LIST_PLAYING", + "SELECTED_CHAT_FRAME", + "DEFAULT_CHAT_FRAME", + "SlashCmdList", + "ACCEPT", + "TOOLTIP_DEFAULT_COLOR", + "HIDE", + "ReloadUI", + "TooltipBackdropTemplateMixin", + "InterfaceOptions_AddCategory", + "NORMAL_FONT_COLOR", + "hash_SlashCmdList", + "USE", + "BACKGROUND", + "BATTLEGROUND", + "NONE", + "ARENA", + "LOW", + "HIGH", + "YES", + "NO", + "HELP_LABEL", + "MUTE", + "MUTED", + "CLOSE", + "LIGHTYELLOW_FONT_COLOR_CODE", + "GRAY_FONT_COLOR_CODE", + "INSTANCE_SAVED", + "TRANSFER_ABORT_TOO_MANY_INSTANCES", + "NO_RAID_INSTANCES_SAVED", + "INSTANCE_RESET_FAILED", + "INSTANCE_RESET_FAILED_OFFLINE", + "INSTANCE_RESET_FAILED_ZONING", + "ERR_LOOT_GONE", + "STAT_AVERAGE_ITEM_LEVEL", + "LFG_LIST_ITEM_LEVEL_INSTR_PVP_SHORT", + "CURRENCY_GAINED", + "INSTANCE_RESET_SUCCESS", + "ERR_RAID_DIFFICULTY_CHANGED_S", + "ERR_DUNGEON_DIFFICULTY_CHANGED_S", + "WeeklyRewardsFrame", + "ICON_LIST", + "SPLASH_LEGION_NEW_7_1_RIGHT_TITLE", + "ChatFrame_TimeBreakDown", + "TOTAL", + "ToggleLFDParentFrame", + "LFDQueueFrame_SetType", + "PVEFrame_ToggleFrame", + "RaidFinderQueueFrame_SetRaid", + "ChatEdit_GetActiveWindow", + "ChatEdit_InsertLink", + "ChatFrame_OpenChat", + "LFG_TYPE_DUNGEON", + "PVP_RATED_BATTLEGROUND", + "COMBAT_XP_GAIN", + "DUNGEON_SCORE", + "BG_RATING_ABBR", + "MONEY", + "PVP_LABEL_WAR_MODE", + "PVP_WAR_MODE_ENABLED", + "ZONE", + "LFG_TYPE_RANDOM_DUNGEON", + "LFDParentFrame", + "RaidFinderFrame", + "STAT_AVERAGE_ITEM_LEVEL_EQUIPPED", + "ARENA_2V2", + "ARENA_RATING", + "ARENA_3V3", + "LFDQueueFrame", + "RaidFinderQueueFrame", + "WEEKLY_REWARDS_MYTHIC_TOP_RUNS", + "TOTAL_STACKS", + "ID", + "LFG_RANDOM_COOLDOWN_YOU", + "CURRENCY_WEEKLY_CAP", + "CURRENCY_TOTAL", + "CURRENCY_SEASON_TOTAL_MAXIMUM", + "CURRENCY_TOTAL_CAP", + "RESET_INSTANCES", + "LARGE_NUMBER_SEPERATOR", + "TIME_PLAYED_TOTAL", + "TIME_PLAYED_LEVEL", + "UNKNOWN", + "PVP_RATED_SOLO_SHUFFLE", + "AVAILABLE", + "RATING", + "LOOT", + "BOSS_ALIVE", + "ToggleFriendsFrame", + "ITEM_COOLDOWN_TOTAL", + "DESERTER", + "RaidInfoFrame", + "BOSS_DEAD", + "PanelTemplates_TabResize", + "PanelTemplates_SetDisabledTabState", + "PanelTemplates_SelectTab", + "PanelTemplates_DeselectTab", + "FCF_DockUpdate", + "UpdateContainerFrameAnchors", + "MainMenuBar", + "TicketStatusFrame", + "ContainerFrame1", + "MainMenuBarVehicleLeaveButton", + "MultiBarBottomLeft", + "ExtraActionBarFrame", + "MultiCastActionBarFrame", + "MultiBarBottomRight", + "MouseIsOver", + "HIGHLIGHT_FONT_COLOR", + "SetDesaturation", + "ColorPickerFrame", + "OpacitySliderFrame", + "DropDownList1", + "UIDropDownMenu_AddButton", + "UIDROPDOWNMENU_MENU_LEVEL", + "UIDropDownMenu_AddSeparator", + "UIDropDownMenu_AddSpace", + "TOOLTIP_DEFAULT_BACKGROUND_COLOR", + "UIDropDownMenu_Initialize", + "UKNOWNBEING", + "SHORT", + "NOT_BOUND", + "UIDROPDOWNMENU_MAXLEVELS", + "ExecuteFrameScript", + "DropDownMenuButtonMixin", + "VIDEO_QUALITY_LABEL6", + "SharedTooltip_SetBackdropStyle", + "GRAY_FONT_COLOR", + "GameTooltip_Hide", + "RED_FONT_COLOR", + "GameTooltip_AddErrorLine", + "AddonCompartmentFrame", + "BACKDROP_SLIDER_8_8", + "NineSlicePanelMixin", + "GetBonusRollEncounterJournalLinkDifficulty", + "DifficultyUtil", + "BonusRollFrame", + "QuestUtils_GetBestQualityItemRewardIndex", + "WEEKLY_REWARDS_HEROIC", + "WEEKLY_REWARDS_MYTHIC", + "WeeklyRewardsUtil", + "RAIDS", + "PVP", + "ISLANDS_HEADER", + "SPLASH_BATTLEFORAZEROTH_8_3_0_FEATURE1_TITLE", + "WORLD_MAP_THREATS", + "MAW_BUFF_QUALITY_STRING_EPIC", + "MAW_BUFF_QUALITY_STRING_RARE", + "MAW_BUFF_QUALITY_STRING_UNCOMMON", + "MAW_BUFF_QUALITY_STRING_COMMON", + "YELLOW_FONT_COLOR_CODE", + "ORANGE_FONT_COLOR_CODE", + "ENABLE", + "DAILY", + "WEEKLY", + "CRITERIA_COMPLETED", + "GENERAL", + "GARRISON_LOCATION_TOOLTIP", + "BOSS", + "IGNORE", + "FACTION", + "CUSTOM", + "SHOW", + "COMMAND", + "RESET_POSITION", + "RaidNotice_AddMessage", + "RaidWarningFrame", + "pairs", + "ipairs", + "_G", + "type", + "next", + "tostring", + "error", + "assert", + "Ambiguate", + "string", + "table", + "C_ChatInfo", + "setmetatable", + "GameTooltip", + "UnitFactionGroup", + "GetPVPLifetimeStats", + "UnitHonorLevel", + "math", + "UnitHonor", + "UnitHonorMax", + "pcall", + "select", + "GetLocale", + "unpack", + "Enum", + "print", + "geterrorhandler", + "securecallfunction", + "tonumber", + "GetBindingKey", + "GetCurrentBindingSet", + "GetRealmName", + "SaveBindings", + "SetBinding", + "rawget", + "Minimap", + "UIParent", + "WOW_PROJECT_ID", + "WOW_PROJECT_MAINLINE", + "GetCursorPosition", + "getfenv", + "PlaySound", + "PlaySoundFile", + "IsShiftKeyDown", + "IsAltKeyDown", + "WOW_PROJECT_CLASSIC", + "C_EditMode", + "GetSavedInstanceInfo", + "GetNumSavedInstances", + "GetSavedInstanceChatLink", + "GetLFGDungeonNumEncounters", + "GetLFGDungeonEncounterInfo", + "GetNumRandomDungeons", + "GetLFGRandomDungeonInfo", + "GetLFGDungeonInfo", + "GetLFGDungeonRewards", + "UnitIsUnit", + "SecondsToTime", + "GetNumGroupMembers", + "RAID_CLASS_COLORS", + "RequestRatedInfo", + "RequestRaidInfo", + "RequestLFDPlayerLockInfo", + "UpdateAddOnMemoryUsage", + "GetNumSpecializations", + "debugprofilestop", + "TYPEID_DUNGEON", + "LFG_SUBTYPEID_HEROIC", + "TYPEID_RANDOM_DUNGEON", + "LFG_SUBTYPEID_SCENARIO", + "RequestTimePlayed", + "GetAverageItemLevel", + "GetSpecialization", + "UnitLevel", + "UnitRace", + "QuestIsDaily", + "GetQuestID", + "GetTitleText", + "QuestIsWeekly", + "GetQuestLink", + "UnitClass", + "GetAutoCompleteRealms", + "IsInRaid", + "GetAddOnMemoryUsage", + "GetNumSavedWorldBosses", + "GetSavedWorldBossInfo", + "C_UnitAuras", + "GetSpecializationInfo", + "C_QuestLog", + "C_AddOns", + "GetLFGRandomCooldownExpiration", + "GetPersonalRatedInfo", + "IsResting", + "UnitXPMax", + "C_Map", + "C_Reputation", + "HasLFGRestrictions", + "SendChatMessage", + "GetMoneyString", + "C_TooltipInfo", + "C_PvP", + "C_Covenants", + "C_ChallengeMode", + "C_Item", + "UnitXP", + "GetXPExhaustion", + "UnitIsGroupLeader", + "IsInLFGDungeon", + "IsInScenarioGroup", + "EJ_GetCreatureInfo", + "tContains", + "GetQuestResetTime", + "C_DateAndTime", + "GetCurrentRegion", + "GetCVar", + "C_Calendar", + "CreateFont", + "UnitName", + "loadstring", + "getmetatable", + "rawset", + "IsLoggedIn", + "GetCursorInfo", + "ClearCursor", + "GetSpellInfo", + "GetMacroInfo", + "IsControlKeyDown", + "C_GuildInfo", + "BNGetFriendIndex", + "BNGetNumFriends", + "SetGuildRosterShowOffline", + "GetGuildRosterShowOffline", + "UnitInParty", + "UnitInRaid", + "IsInGroup", + "GetGuildRosterInfo", + "BNInviteFriend", + "SOUNDKIT", + "C_PartyInfo", + "BackdropTemplateMixin", + "rawequal", + "GetNumQuestLogRewards", + "GetQuestLogRewardInfo", + "GetQuestObjectiveInfo", + "GetQuestProgressBarPercent", + "GetMoney", + "GetQuestLogRewardMoney", + "C_Container", + "C_MythicPlus", + "CopyTable", + "tIndexOf", + "GetAchievementCriteriaInfo", + "C_TradeSkillUI", + "C_ContributionCollector", + "EJ_GetEncounterInfo", + "InterfaceOptionsFramePanelContainer" + ] +} diff --git a/Scoreboard.lua b/Scoreboard.lua index 1a23741..5466f86 100644 --- a/Scoreboard.lua +++ b/Scoreboard.lua @@ -4,8 +4,7 @@ local ldb = LibStub:GetLibrary("LibDataBroker-1.1") local ldbi = LibStub:GetLibrary('LibDBIcon-1.0') local function showConfig() - InterfaceOptionsFrame_OpenToCategory(addonName) - InterfaceOptionsFrame_OpenToCategory(addonName) + Settings.OpenToCategory(addonName, true) end local function normal(text) @@ -31,10 +30,11 @@ do if loadedAddon ~= addonName then return end self:UnregisterEvent("ADDON_LOADED") - if type(ScoreboardSettings) ~= "table" then ScoreboardSettings = {currencies={},minimap={hide=false}} end + if type(ScoreboardSettings) ~= "table" then ScoreboardSettings = {currencies={},minimap={hide=false},showInAddonCompartment=true} end local sv = ScoreboardSettings if type(sv.currencies) ~= "table" then sv.currencies = {} end if type(sv.minimap) ~= "table" then sv.minimap = {hide=false} end + if type(sv.showInAddonCompartment) ~= "boolean" then sv.showInAddonCompartment = true end if type(sv.showHKs) ~= "boolean" then sv.showHKs = true end if type(sv.showIcons) ~= "boolean" then sv.showIcons = true end if type(sv.showLabels) ~= "boolean" then sv.showLabels = true end @@ -45,6 +45,7 @@ do addon.db = sv ldbi:Register(addonName, addon.dataobj, addon.db.minimap) + if (sv.showInAddonCompartment) then ldbi:AddButtonToCompartment(addonName) end self:SetScript("OnEvent", nil) end) @@ -72,7 +73,7 @@ do GameTooltip:Hide() end, OnClick = function(self, button) - if button == "RightButton" then + if button == "RightButton" or self == nil then showConfig() else ToggleCharacter("TokenFrame"); diff --git a/Scoreboard.toc b/Scoreboard.toc index e006d0a..b83f1c2 100644 --- a/Scoreboard.toc +++ b/Scoreboard.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 110002 ## Title: Scoreboard ## Notes: A customizable data broker for displaying player currencies ## Author: solocommand @@ -9,6 +9,7 @@ ## X-Curse-Project-ID: 27055 ## X-Wago-ID: 5bGo7kG0 ## OptionalDeps: Ace3, LibDataBroker-1.1, LibDBIcon-1.0 +## IconTexture: Interface\AddOns\Scoreboard\Scoreboard embeds.xml diff --git a/config.lua b/config.lua index 9259f36..a210062 100644 --- a/config.lua +++ b/config.lua @@ -2,10 +2,21 @@ local addonName, addon = ... local L = addon.L local ldbi = LibStub('LibDBIcon-1.0', true) +local function buildCheckbox(key, order) + return { + type = 'toggle', + name = L[key], + order = order or 0, + desc = L[key.."Description"], + get = function(info) return addon.db[info[#info]] end, + set = function(info, value) return addon:setDB(info[#info], value) end, + } +end + local function build() + local currencies = {} local t = { name = "Scoreboard", - handler = Scoreboard, type = 'group', args = { showMinimapIcon = { @@ -18,69 +29,52 @@ local function build() local config = addon.db.minimap config.hide = not value addon:setDB("minimap", config) - ldbi:Refresh(addonName) + ldbi:Refresh(addonName, addon.db) end, }, - showHKs = { + showInAddonCompartment = { type = 'toggle', + name = L.showInAddonCompartment, + desc = L.showInAddonCompartmentDescription, order = 1, get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, - name = L.showHKs, - desc = L.showHKsDescription, - }, - showIcons = { - type = 'toggle', - order = 2, - name = L.showIcons, - desc = L.showIconsDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, - }, - showLabels = { - type = 'toggle', - order = 3, - name = L.showLabels, - desc = L.showLabelsDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, - }, - showLimits = { - type = 'toggle', - order = 4, - name = L.showLimits, - desc = L.showLimitsDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, + set = function(info, value) + addon:setDB(info[#info], value) + if value then + ldbi:AddButtonToCompartment(addonName) + else + ldbi:RemoveButtonFromCompartment(addonName) + end + ldbi:Refresh(addonName, addon.db) + end }, - useShortLabels = { - type = 'toggle', + disableUsageText = buildCheckbox("disableUsageText", 2), + dataText = { + type = "group", + name = "Data Text", order = 5, - name = L.useShortLabels, - desc = L.useShortLabelsDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, + args = { + showHKs = buildCheckbox("showHKs", 6), + showIcons = buildCheckbox("showIcons", 7), + showLabels = buildCheckbox("showLabels", 8), + showLimits = buildCheckbox("showLimits", 9), + useShortLabels = buildCheckbox("useShortLabels", 10), + }, }, - showHeaders = { - type = 'toggle', - order = 7, - name = L.showHeaders, - desc = L.showHeadersDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, - }, - disableUsageText = { - type = 'toggle', - order = 8, - name = L.disableUsageText, - desc = L.disableUsageTextDescription, - get = function(info) return addon.db[info[#info]] end, - set = function(info, value) return addon:setDB(info[#info], value) end, + + tooltip = { + type = "group", + name = "Tooltip", + order = 15, + args = { + showHeaders = buildCheckbox("showHeaders", 16), + } }, currencies = { - type = "header", + type = "group", name = L["currenciesTitle"], - order = 10, + order = 20, + args = currencies, }, } } @@ -91,17 +85,17 @@ local function build() local li = C_CurrencyInfo.GetCurrencyListLink(i) if c.isHeader then if c.isHeaderExpanded and c.name ~= "Unused" then - t.args[c.name] = { + currencies[c.name] = { type = 'header', - order = 20 + i, + order = 30 + i, name = c.name, } end else if not c.isTypeUnused then - t.args[c.name] = { + currencies[c.name] = { type = 'toggle', - order = 20 + i, + order = 30 + i, name = c.name, get = function() return addon:getCurrency(li) end, set = function(i, v) return addon:setCurrency(li, v) end, @@ -116,4 +110,4 @@ end LibStub("AceConfig-3.0"):RegisterOptionsTable("Scoreboard", build, nil) addon.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, "Scoreboard") -LibStub("AceConsole-3.0"):RegisterChatCommand("scoreboard", function() InterfaceOptionsFrame_OpenToCategory(addon.optionsFrame) end) +LibStub("AceConsole-3.0"):RegisterChatCommand("scoreboard", function() Settings.OpenToCategory(addonName) end) diff --git a/i18n/enUS.lua b/i18n/enUS.lua index 13ca6ee..0c616e3 100644 --- a/i18n/enUS.lua +++ b/i18n/enUS.lua @@ -7,6 +7,9 @@ local L = {} L["showHKs"] = "Show Honor Kills"; L["showHKsDescription"] = "Shows the total number of honor kills within the data text." +L["showInAddonCompartment"] = "Show in compartment" +L["showInAddonCompartmentDescription"] = "Toggles the display of Scoreboard within the addon compartment." + L["showIcons"] = "Show currency icons"; L["showIconsDescription"] = "Includes the relevant currency icon next to the amount owned within the data text." diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..ec1aea9 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 180