diff --git a/.vscode/settings.json b/.vscode/settings.json index c9a8012..2928959 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -122,7 +122,14 @@ "ipairs", "UnitFullName", "PlaySoundFile", - "Menu" + "Menu", + "WOW_PROJECT_ID", + "WOW_PROJECT_MAINLINE", + "StaticPopupDialogs", + "StaticPopup_Show", + "C_UI", + "CreateColor", + "next" ], "Lua.runtime.builtin": { "basic": "disable", @@ -136,6 +143,6 @@ "utf8": "disable" }, "Lua.workspace.library": [ - "/home/codespace/.vscode-remote/extensions/ketho.wow-api-0.15.5/Annotations" + "c:\\Users\\jim_a\\.vscode\\extensions\\ketho.wow-api-0.15.5\\Annotations" ], } \ No newline at end of file diff --git a/Images/icon.png b/Images/icon.png index 159ae5c..d045836 100644 Binary files a/Images/icon.png and b/Images/icon.png differ diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 6b91657..38a8576 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -1,4 +1,4 @@ -local L = LibStub("AceLocale-3.0"):NewLocale("Shitlist", "enUS", true) +local L = LibStub("AceLocale-3.0"):NewLocale("PersonalPlayerNotes", "enUS", true) -- White |cffffffff -- Red |cffff0000 @@ -9,15 +9,15 @@ local L = LibStub("AceLocale-3.0"):NewLocale("Shitlist", "enUS", true) -- GOLDENROD |cFFDAA520 -- TAN |cFFD2B48C -L["SHITLIST"] = "Shitlist"; -L["SHITLIST_DEBUG"] = "|cffff0000[Shitlist]|cffffffff"; -L["SHITLIST_PRINT"] = "|cffffd700[Shitlist]|cffffffff"; +L["SHITLIST"] = "Personal Player Notes"; +L["SHITLIST_DEBUG"] = "|cffff0000[Personal Player Notes]|cffffffff"; +L["SHITLIST_PRINT"] = "|cffffd700[Personal Player Notes]|cffffffff"; L["SHITLIST_NA"] = "N/A"; L["SHITLIST_DISABLE"] = "Unloading..."; -L["SHITLIST_MENU_TITLE"] = "Shitlist"; +L["SHITLIST_MENU_TITLE"] = "Personal Player Notes"; L["SHITLIST_MENU_SETTINGS"] = "Options"; L["SHITLIST_MENU_REASONS"] = "Reasons"; L["SHITLIST_MENU_LISTED_PLAYERS"] = "Listed Players"; @@ -30,6 +30,7 @@ L["SHITLIST_CONFIG_REASONS"] = "Reasons:"; L["SHITLIST_CONFIG_LISTEDPLAYERS"] = "Players:"; L["SHITLIST_CONFIG_REFRESH"] = "Reloading configuration..."; L["SHITLIST_CONFIG_CHECK_OLD_DATA"] = "Checking for old player data..."; +L["SHITLIST_CONFIG_MIGRATE_OLD_DATA"] = "Migrating profiles from Shitlist."; L["SHITLIST_CONFIG_ADDED_OLD_DATA"] = "Added old player:"; L["SHITLIST_CONFIG_DUPLICATE_DATA"] = "Found duplicate:"; @@ -49,7 +50,7 @@ L["SHITLIST_INFO_ABOUT_LICENSE"] = "License"; L["SHITLIST_INFO_ABOUT_WEB"] = "Website"; L["SHITLIST_SETTINGS"] = "Options"; -L["SHITLIST_SETTINGS_TITLE"] = "Shitlist - Options"; +L["SHITLIST_SETTINGS_TITLE"] = "Personal Player Notes - Options"; L["SHITLIST_SETTINGS_MINIMAP"] = "Minimap"; L["SHITLIST_SETTINGS_MINIMAP_ICON"] = "Hide the icon."; L["SHITLIST_SETTINGS_MINIMAP_ICON_DESC"] = "Show or hide the minimap icon."; @@ -65,7 +66,7 @@ L["SHITLIST_SETTINGS_ALERT_SOUNDS_DESC"] = "Select the sound to be played."; L["SHITLIST_SETTINGS_ALERT_DELAY"] = "Delay"; L["SHITLIST_SETTINGS_ALERT_DELAY_DESC"] = "How many seconds to sleep before a new alert for the same player is played."; -L["SHITLIST_REASONS_TITLE"] = "Shitlist - Reasons"; +L["SHITLIST_REASONS_TITLE"] = "Personal Player Notes - Reasons"; L["SHITLIST_REASONS"] = "Reasons"; L["SHITLIST_REASON"] = "Reason"; L["SHITLIST_REASON_DESCRIPTION"] = "Here you can Edit, Add or Remove differrent reasons.\n"; @@ -75,7 +76,7 @@ L["SHITLIST_REASON_COLOR"] = "Select a color"; L["SHITLIST_REASON_ALERT_ENABLED"] = "Alert" L["SHITLIST_REASON_ALERT_ENABLED_DESC"] = "Toggle sound effect for all players with this reason." -L["SHITLIST_LISTED_PLAYERS_TITLE"] = "Shitlist - Listed Players"; +L["SHITLIST_LISTED_PLAYERS_TITLE"] = "Personal Player Notes - Listed Players"; L["SHITLIST_LISTED_PLAYERS"] = "Listed Players"; L["SHITLIST_LISTED_PLAYER"] = "Listed Player"; L["SHITLIST_LISTED_PLAYER_REMOVE"] = "Remove Player"; @@ -89,11 +90,11 @@ L["SHITLIST_LISTED_PLAYER_ALERT_ENABLED"] = "Alert" L["SHITLIST_LISTED_PLAYER_ALERT_ENABLED_DESC"] = "Toggle sound effect for a specific player. If a sound effect is disabled on a pre defined reason then this has no effect." -L["SHITLIST_POPUP_ADD"] = "Add to Shitlist"; +L["SHITLIST_POPUP_ADD"] = "Add Player"; L["SHITLIST_POPUP_EDIT"] = "Edit Player"; L["SHITLIST_POPUP_NEW_ADDED"] = "Added"; -L["SHITLIST_MINIMAP_TOOLTIP_TITLE"] = "Shitlist" +L["SHITLIST_MINIMAP_TOOLTIP_TITLE"] = "Personal Player Notes" L["SHITLIST_MINIMAP_TOOLTIP_RIGHT_CLICK"] = "|cFFD2B48C Right-Click|cff00ff00 to open Blizzard options." L["SHITLIST_MINIMAP_TOOLTIP_LEFT_CLICK"] = "|cFFD2B48C Left-Click|cff00ff00 to open options." L["SHITLIST_MINIMAP_TOOLTIP_SHIFT_LEFT_CLICK"] = "|cFFD2B48C SHIFT + Left-Click|cff00ff00 to open reasons." diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index 65b0692..8637176 100644 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -1,4 +1,4 @@ -local L = LibStub("AceLocale-3.0"):NewLocale("Shitlist", "zhCN") +local L = LibStub("AceLocale-3.0"):NewLocale("PersonalPlayerNotes", "zhCN") if not L then return end -- White |cffffffff diff --git a/PersonalPlayerNotes.lua b/PersonalPlayerNotes.lua index 655f846..9f64183 100644 --- a/PersonalPlayerNotes.lua +++ b/PersonalPlayerNotes.lua @@ -1,46 +1,51 @@ -local shitlist = ... -Shitlist = LibStub("AceAddon-3.0"):NewAddon(shitlist, "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0", +local personalPlayerNotes = ... +PersonalPlayerNotes = LibStub("AceAddon-3.0"):NewAddon(personalPlayerNotes, "AceConsole-3.0", "AceEvent-3.0", + "AceHook-3.0", "AceTimer-3.0" , "AceSerializer-3.0") -local L = LibStub("AceLocale-3.0"):GetLocale(shitlist, true) -local AceConfig = LibStub("AceConfig-3.0") -local AceConfigDialog = LibStub("AceConfigDialog-3.0") -local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") -local LibDataBroker = LibStub("LibDataBroker-1.1") -local LibDBIcon = LibStub("LibDBIcon-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(personalPlayerNotes, true) +local AceConfig = LibStub("AceConfig-3.0") +local AceConfigDialog = LibStub("AceConfigDialog-3.0") +local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") +local LibDataBroker = LibStub("LibDataBroker-1.1") +local LibDBIcon = LibStub("LibDBIcon-1.0") -local IS_RETAIL = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE or nil; -Shitlist.IsRetail = IS_RETAIL; +local IS_RETAIL = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE or false; +PersonalPlayerNotes.IsRetail = IS_RETAIL; -function Shitlist:OnInitialize() +function PersonalPlayerNotes:OnInitialize() -- uses the "Default" profile instead of character-specific profiles -- https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0 - self.db = LibStub("AceDB-3.0"):New("ShitlistDB", self.defaults, true) - self.db.RegisterCallback(self, "OnNewProfile", "RefreshConfig") - self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig") - self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig") - self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig") + self.db = LibStub("AceDB-3.0"):New("PersonalPlayerNotesDB", self.defaults, true) + self.db.RegisterCallback(self, "OnNewProfile", "LoadConfig") + self.db.RegisterCallback(self, "OnProfileChanged", "LoadConfig") + self.db.RegisterCallback(self, "OnProfileCopied", "LoadConfig") + self.db.RegisterCallback(self, "OnProfileReset", "LoadConfig") -- registers an options table and adds it to the Blizzard options window -- https://www.wowace.com/projects/ace3/pages/api/ace-config-3-0 - AceConfig:RegisterOptionsTable("ShitlistSettings Info", self.options.Info) - AceConfigDialog:AddToBlizOptions("ShitlistSettings Info", shitlist) + AceConfig:RegisterOptionsTable("PersonalPlayerNotesSettings Info", self.options.Info) + AceConfigDialog:AddToBlizOptions("PersonalPlayerNotesSettings Info", personalPlayerNotes) - AceConfig:RegisterOptionsTable("ShitlistSettings Options", self.options.Settings, { "slo" }) - AceConfigDialog:AddToBlizOptions("ShitlistSettings Options", L["SHITLIST_MENU_SETTINGS"], shitlist) + AceConfig:RegisterOptionsTable("PersonalPlayerNotesSettings Options", self.options.Settings, { "slo" }) + AceConfigDialog:AddToBlizOptions("PersonalPlayerNotesSettings Options", L["SHITLIST_MENU_SETTINGS"], + personalPlayerNotes) - AceConfig:RegisterOptionsTable("ShitlistSettings Reasons", self.options.Reasons, { "slr" }) - AceConfigDialog:AddToBlizOptions("ShitlistSettings Reasons", L["SHITLIST_MENU_REASONS"], shitlist) + AceConfig:RegisterOptionsTable("PersonalPlayerNotesSettings Reasons", self.options.Reasons, { "slr" }) + AceConfigDialog:AddToBlizOptions("PersonalPlayerNotesSettings Reasons", L["SHITLIST_MENU_REASONS"], + personalPlayerNotes) - AceConfig:RegisterOptionsTable("ShitlistSettings Listed_Players", self.options.ListedPlayers, { "slp" }) - AceConfigDialog:AddToBlizOptions("ShitlistSettings Listed_Players", L["SHITLIST_MENU_LISTED_PLAYERS"], shitlist) + AceConfig:RegisterOptionsTable("PersonalPlayerNotesSettings Listed_Players", self.options.ListedPlayers, { "slp" }) + AceConfigDialog:AddToBlizOptions("PersonalPlayerNotesSettings Listed_Players", L["SHITLIST_MENU_LISTED_PLAYERS"], + personalPlayerNotes) -- adds a child options table, in this case our profiles panel local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) - AceConfig:RegisterOptionsTable("ShitlistSettings Profiles", profiles) - AceConfigDialog:AddToBlizOptions("ShitlistSettings Profiles", L["SHITLIST_MENU_PROFILES"], shitlist) + AceConfig:RegisterOptionsTable("PersonalPlayerNotesSettings Profiles", profiles) + AceConfigDialog:AddToBlizOptions("PersonalPlayerNotesSettings Profiles", L["SHITLIST_MENU_PROFILES"], + personalPlayerNotes) - LibDBIcon:Register(shitlist, self:MiniMapIcon(), self.db.profile.minimap) + LibDBIcon:Register(personalPlayerNotes, self:MiniMapIcon(), self.db.profile.minimap) -- https://www.wowace.com/projects/ace3/pages/api/ace-console-3-0 self:RegisterChatCommand("slm", "ToggleMiniMapIcon") @@ -49,11 +54,16 @@ function Shitlist:OnInitialize() self:RegisterChatCommand("sldebug", "ToggleDebug") --@end-debug@ - self:GetOldConfigData() - self:RefreshConfig() + local loaded, reason = LoadAddOn("Shitlist") + if not loaded then + self:Print("Failed to load Shitlist because", reason) + else + self:GetOldConfigData() + end + self:LoadConfig() end -function Shitlist:OnEnable() +function PersonalPlayerNotes:OnEnable() self:Print(L["SHITLIST_CONFIG_LOADING"]) self:Print(L["SHITLIST_CONFIG_VERSION"], _G["ORANGE_FONT_COLOR_CODE"], self:GetVersion()) self:Print(L["SHITLIST_CONFIG_REASONS"], _G["GREEN_FONT_COLOR_CODE"], #self:GetReasons()) @@ -76,17 +86,17 @@ function Shitlist:OnEnable() self:Print(L["SHITLIST_CONFIG_LOADED"]) end -function Shitlist:OnDisable() +function PersonalPlayerNotes:OnDisable() self:Print(L["SHITLIST_DISABLE"]) end -function Shitlist:RefreshConfig() +function PersonalPlayerNotes:LoadConfig() self.db.profile.alert.last = {} if self.db.profile.minimap.hide then - LibDBIcon:Hide(shitlist) + LibDBIcon:Hide(personalPlayerNotes) else - LibDBIcon:Show(shitlist) + LibDBIcon:Show(personalPlayerNotes) end --@debug@ @@ -96,78 +106,100 @@ function Shitlist:RefreshConfig() --@end-debug@ end -function Shitlist:GetOldConfigData() - -- Check if old data exist pre addon 2.0.0 version - if _G.ShitlistDB.ListedPlayers == nil and _G.ShitlistDB.Reasons == nil then - return - end - self:Print(L["SHITLIST_CONFIG_CHECK_OLD_DATA"]) - - local oldReasons = _G.ShitlistDB.Reasons - local oldListedPlayers = _G.ShitlistDB.ListedPlayers +function PersonalPlayerNotes:GetOldConfigData() local reasons = self:GetReasons() local listedPlayers = self:GetListedPlayers() - local newPlayers = {} + -- Check if old data exist pre addon 2.0.0 version + if ShitlistDB.Reasons ~= nil and ShitlistDB.ListedPlayers ~= nil then + self:Print(L["SHITLIST_CONFIG_CHECK_OLD_DATA"]) - -- Check old listed player list - if oldListedPlayers ~= nil then - for _, player in pairs(listedPlayers) do - newPlayers[player.name .. "-" .. player.realm] = true - end + local oldListedPlayers = ShitlistDB.ListedPlayers + local newPlayers = {} - for key, value in pairs(oldListedPlayers) do - local name, realm = key:match("([^-]+)-([^-]+)") - if name and realm then - if not newPlayers[name .. "-" .. realm] then - local reason = value[1] - local description = value[2] - - -- Check if the reason exist already and get it's id. - local reasonId = nil - for _, r in ipairs(reasons) do - if r.reason == reason then - reasonId = r.id - break + -- Check old listed player list + if oldListedPlayers ~= nil then + for _, player in pairs(listedPlayers) do + newPlayers[player.name .. "-" .. player.realm] = true + end + + for key, value in pairs(oldListedPlayers) do + local name, realm = key:match("([^-]+)-([^-]+)") + if name and realm then + if not newPlayers[name .. "-" .. realm] then + local reason = value[1] + local description = value[2] + + -- Check if the reason exist already and get it's id. + local reasonId = nil + for _, r in ipairs(reasons) do + if r.reason == reason then + reasonId = r.id + break + end end - end - -- If the reason do not exist add it to the reason data. - if not reasonId then - reasonId = #reasons + 1 - reasons[reasonId] = { - id = reasonId, - reason = reason, + -- If the reason do not exist add it to the reason data. + if not reasonId then + reasonId = #reasons + 1 + reasons[reasonId] = { + id = reasonId, + reason = reason, + color = { r = 1, g = 1, b = 1 }, + alert = true, + } + end + + -- Add the old player to the new listed players + listedPlayers[#listedPlayers + 1] = { + id = #listedPlayers + 1, + name = name, + realm = realm, + reason = reasonId, + description = description, color = { r = 1, g = 1, b = 1 }, alert = true, } - end - -- Add the old player to the new listed players - listedPlayers[#listedPlayers + 1] = { - id = #listedPlayers + 1, - name = name, - realm = realm, - reason = reasonId, - description = description, - color = { r = 1, g = 1, b = 1 }, - alert = true, - } - - self:Print(L["SHITLIST_CONFIG_ADDED_OLD_DATA"], name .. "-" .. realm) - else - self:Print(L["SHITLIST_CONFIG_DUPLICATE_DATA"], name .. "-" .. realm) + self:Print(L["SHITLIST_CONFIG_ADDED_OLD_DATA"], name .. "-" .. realm) + else + self:Print(L["SHITLIST_CONFIG_DUPLICATE_DATA"], name .. "-" .. realm) + end end end - end - -- remove the old listed players from the database - _G.ShitlistDB.ListedPlayers = nil - _G.ShitlistDB.Reasons = nil + -- remove the old listed players from the database + ShitlistDB.ListedPlayers = nil + ShitlistDB.Reasons = nil + end end - -- TODO: Add support to use the new PersonalPlayerNotesDB and move old data to the new DB. + -- Move old shitlist profiles data to new Personal Player Notes database + if ShitlistDB and ShitlistDB.profiles then + StaticPopupDialogs["MIGRATE_PROFILES"] = { + text = "Do you want to migrate profiles from Shitlist?", + button1 = "Yes", + button2 = "No", + OnAccept = function() + PersonalPlayerNotes:Print(L["SHITLIST_CONFIG_MIGRATE_OLD_DATA"]) + for profileName, profileData in pairs(ShitlistDB.profiles) do + PersonalPlayerNotes.db.profiles[profileName] = profileData + end + self:Print(L["SHITLIST_CONFIG_REASONS"], _G["GREEN_FONT_COLOR_CODE"], #self:GetReasons()) + self:Print(L["SHITLIST_CONFIG_LISTEDPLAYERS"], _G["GREEN_FONT_COLOR_CODE"], #self:GetListedPlayers()) + PersonalPlayerNotes:Print("Profiles from Shitlist has been migrated.") + self.db:SetProfile("Default") + DisableAddOn("Shitlist") + C_UI.Reload() + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, + preferredIndex = 3, + } + StaticPopup_Show("MIGRATE_PROFILES") + end end -function Shitlist:DropDownMenuInitialize() +function PersonalPlayerNotes:DropDownMenuInitialize() local DropDownMenu = function(ownerRegion, rootDescription, contextData) -- verify the unit if contextData.unit == nil or not UnitIsPlayer(contextData.unit) then @@ -178,44 +210,46 @@ function Shitlist:DropDownMenuInitialize() -- if the unit is from the same realm then realm is empty, use current realm instead if realm == nil then realm = GetRealmName() end - local listedPlayer = Shitlist:GetListedPlayer(name, realm) + local listedPlayer = PersonalPlayerNotes:GetListedPlayer(name, realm) if (not listedPlayer) then + rootDescription:CreateDivider() + rootDescription:CreateTitle(L["SHITLIST"]) rootDescription:CreateButton(L["SHITLIST_POPUP_ADD"], function() - Shitlist:Print(L["SHITLIST_POPUP_NEW_ADDED"], name, realm) + PersonalPlayerNotes:Print(L["SHITLIST_POPUP_NEW_ADDED"], name, realm) - local new_player = Shitlist:NewListedPlayer(name, realm) - Shitlist.db.profile.listedPlayer.id = new_player.id - Shitlist.db.profile.listedPlayer.name = new_player.name - Shitlist.db.profile.listedPlayer.realm = new_player.realm - Shitlist.db.profile.listedPlayer.reason = new_player.reason - Shitlist.db.profile.listedPlayer.description = new_player.description - Shitlist.db.profile.listedPlayer.color = new_player.color - Shitlist.db.profile.listedPlayer.alert = new_player.alert + local new_player = PersonalPlayerNotes:NewListedPlayer(name, realm) + PersonalPlayerNotes.db.profile.listedPlayer.id = new_player.id + PersonalPlayerNotes.db.profile.listedPlayer.name = new_player.name + PersonalPlayerNotes.db.profile.listedPlayer.realm = new_player.realm + PersonalPlayerNotes.db.profile.listedPlayer.reason = new_player.reason + PersonalPlayerNotes.db.profile.listedPlayer.description = new_player.description + PersonalPlayerNotes.db.profile.listedPlayer.color = new_player.color + PersonalPlayerNotes.db.profile.listedPlayer.alert = new_player.alert AceConfigDialog:CloseAll() - local AceGUI = Shitlist:AceGUIDefaults() + local AceGUI = PersonalPlayerNotes:AceGUIDefaults() AceGUI:SetTitle(L["SHITLIST_LISTED_PLAYERS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Listed_Players", 500, 300) - AceConfigDialog:Open("ShitlistSettings Listed_Players") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Listed_Players", 500, 300) + AceConfigDialog:Open("PersonalPlayerNotesSettings Listed_Players") end) else - local submenu = rootDescription:CreateButton(shitlist); - submenu:CreateTitle(shitlist) - submenu:CreateDivider() - submenu:CreateButton(L["SHITLIST_POPUP_EDIT"], function() - Shitlist.db.profile.listedPlayer.id = listedPlayer.id - Shitlist.db.profile.listedPlayer.name = listedPlayer.name - Shitlist.db.profile.listedPlayer.realm = listedPlayer.realm - Shitlist.db.profile.listedPlayer.reason = listedPlayer.reason - Shitlist.db.profile.listedPlayer.description = listedPlayer.description - Shitlist.db.profile.listedPlayer.color = listedPlayer.color - Shitlist.db.profile.listedPlayer.alert = listedPlayer.alert + rootDescription:CreateDivider() + rootDescription:CreateTitle(L["SHITLIST"]) + --local submenu = rootDescription:CreateButton(L["SHITLIST"]); + rootDescription:CreateButton(L["SHITLIST_POPUP_EDIT"], function() + PersonalPlayerNotes.db.profile.listedPlayer.id = listedPlayer.id + PersonalPlayerNotes.db.profile.listedPlayer.name = listedPlayer.name + PersonalPlayerNotes.db.profile.listedPlayer.realm = listedPlayer.realm + PersonalPlayerNotes.db.profile.listedPlayer.reason = listedPlayer.reason + PersonalPlayerNotes.db.profile.listedPlayer.description = listedPlayer.description + PersonalPlayerNotes.db.profile.listedPlayer.color = listedPlayer.color + PersonalPlayerNotes.db.profile.listedPlayer.alert = listedPlayer.alert AceConfigDialog:CloseAll() - local AceGUI = Shitlist:AceGUIDefaults() + local AceGUI = PersonalPlayerNotes:AceGUIDefaults() AceGUI:SetTitle(L["SHITLIST_LISTED_PLAYERS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Listed_Players", 500, 300) - AceConfigDialog:Open("ShitlistSettings Listed_Players") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Listed_Players", 500, 300) + AceConfigDialog:Open("PersonalPlayerNotesSettings Listed_Players") end) end end @@ -225,9 +259,9 @@ function Shitlist:DropDownMenuInitialize() end -- Classic Deprecated -function Shitlist:UnitPopup_ShowMenu(target, unit, menuList) +function PersonalPlayerNotes:UnitPopup_ShowMenu(target, unit, menuList) --@debug@ - Shitlist:PrintDebug("Unit: ", unit, ", Target: ", target) + PersonalPlayerNotes:PrintDebug("Unit: ", unit, ", Target: ", target) --@end-debug@ -- verify the target @@ -242,17 +276,17 @@ function Shitlist:UnitPopup_ShowMenu(target, unit, menuList) local name, realm = UnitName(unit) -- if the unit is from the same realm then realm is empty, use current realm instead if realm == nil then realm = GetRealmName() end - local listedPlayer = Shitlist:GetListedPlayer(name, realm) + local listedPlayer = PersonalPlayerNotes:GetListedPlayer(name, realm) --@debug@ - Shitlist:PrintDebug("Name: ", name, ", Realm: ", realm) + PersonalPlayerNotes:PrintDebug("Name: ", name, ", Realm: ", realm) --@end-debug@ -- Check if this is the root level of the dropdown menu if UIDROPDOWNMENU_MENU_LEVEL == 1 then if (listedPlayer) then UIDropDownMenu_AddButton({ - text = shitlist, + text = personalPlayerNotes, notCheckable = true, hasArrow = true, keepShownOnClick = true, @@ -261,37 +295,37 @@ function Shitlist:UnitPopup_ShowMenu(target, unit, menuList) UIDropDownMenu_AddButton({ text = L["SHITLIST_POPUP_ADD"], notCheckable = true, - icon = Shitlist.db.profile.icon, + icon = PersonalPlayerNotes.db.profile.icon, value = { name, realm }, func = function() - Shitlist:Print(L["SHITLIST_POPUP_NEW_ADDED"], name, realm) - local new_player = Shitlist:NewListedPlayer(name, realm) - Shitlist.db.profile.listedPlayer.id = new_player.id - Shitlist.db.profile.listedPlayer.name = new_player.name - Shitlist.db.profile.listedPlayer.realm = new_player.realm - Shitlist.db.profile.listedPlayer.reason = new_player.reason - Shitlist.db.profile.listedPlayer.description = new_player.description - Shitlist.db.profile.listedPlayer.color = new_player.color - Shitlist.db.profile.listedPlayer.alert = new_player.alert + PersonalPlayerNotes:Print(L["SHITLIST_POPUP_NEW_ADDED"], name, realm) + local new_player = PersonalPlayerNotes:NewListedPlayer(name, realm) + PersonalPlayerNotes.db.profile.listedPlayer.id = new_player.id + PersonalPlayerNotes.db.profile.listedPlayer.name = new_player.name + PersonalPlayerNotes.db.profile.listedPlayer.realm = new_player.realm + PersonalPlayerNotes.db.profile.listedPlayer.reason = new_player.reason + PersonalPlayerNotes.db.profile.listedPlayer.description = new_player.description + PersonalPlayerNotes.db.profile.listedPlayer.color = new_player.color + PersonalPlayerNotes.db.profile.listedPlayer.alert = new_player.alert AceConfigDialog:CloseAll() - local AceGUI = Shitlist:AceGUIDefaults() + local AceGUI = PersonalPlayerNotes:AceGUIDefaults() AceGUI:SetTitle(L["SHITLIST_LISTED_PLAYERS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Listed_Players", 500, 300) - AceConfigDialog:Open("ShitlistSettings Listed_Players") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Listed_Players", 500, 300) + AceConfigDialog:Open("PersonalPlayerNotesSettings Listed_Players") end, }, UIDROPDOWNMENU_MENU_LEVEL) end - elseif UIDROPDOWNMENU_MENU_VALUE == shitlist then + elseif UIDROPDOWNMENU_MENU_VALUE == personalPlayerNotes then -- Add the submenu local menuItem = UIDropDownMenu_CreateInfo() - menuItem.text = shitlist + menuItem.text = personalPlayerNotes menuItem.notCheckable = true menuItem.keepShownOnClick = true menuItem.hasArrow = false menuItem.isTitle = true menuItem.disabled = true - menuItem.icon = Shitlist.db.profile.icon + menuItem.icon = PersonalPlayerNotes.db.profile.icon UIDropDownMenu_AddButton(menuItem, UIDROPDOWNMENU_MENU_LEVEL) menuItem = UIDropDownMenu_CreateInfo() @@ -301,27 +335,26 @@ function Shitlist:UnitPopup_ShowMenu(target, unit, menuList) menuItem.value = listedPlayer menuItem.func = function() if (listedPlayer) then - Shitlist.db.profile.listedPlayer.id = listedPlayer.id - Shitlist.db.profile.listedPlayer.name = listedPlayer.name - Shitlist.db.profile.listedPlayer.realm = listedPlayer.realm - Shitlist.db.profile.listedPlayer.reason = listedPlayer.reason - Shitlist.db.profile.listedPlayer.description = listedPlayer.description - Shitlist.db.profile.listedPlayer.color = listedPlayer.color - Shitlist.db.profile.listedPlayer.alert = listedPlayer.alert + PersonalPlayerNotes.db.profile.listedPlayer.id = listedPlayer.id + PersonalPlayerNotes.db.profile.listedPlayer.name = listedPlayer.name + PersonalPlayerNotes.db.profile.listedPlayer.realm = listedPlayer.realm + PersonalPlayerNotes.db.profile.listedPlayer.reason = listedPlayer.reason + PersonalPlayerNotes.db.profile.listedPlayer.description = listedPlayer.description + PersonalPlayerNotes.db.profile.listedPlayer.color = listedPlayer.color + PersonalPlayerNotes.db.profile.listedPlayer.alert = listedPlayer.alert AceConfigDialog:CloseAll() - local AceGUI = Shitlist:AceGUIDefaults() + local AceGUI = PersonalPlayerNotes:AceGUIDefaults() AceGUI:SetTitle(L["SHITLIST_LISTED_PLAYERS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Listed_Players", 500, 300) - AceConfigDialog:Open("ShitlistSettings Listed_Players") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Listed_Players", 500, 300) + AceConfigDialog:Open("PersonalPlayerNotesSettings Listed_Players") end end UIDropDownMenu_AddButton(menuItem, UIDROPDOWNMENU_MENU_LEVEL) - end end -function Shitlist:GameTooltip() +function PersonalPlayerNotes:GameTooltip() local _name, unit = self:GetUnit() if not (unit and UnitIsPlayer(unit)) then return end @@ -330,15 +363,16 @@ function Shitlist:GameTooltip() if (realm == nil) then realm = GetRealmName() end - local listedPlayer = Shitlist:GetListedPlayer(name, realm) + local listedPlayer = PersonalPlayerNotes:GetListedPlayer(name, realm) if (not listedPlayer) then return end - local reason = Shitlist:GetReasons()[listedPlayer.reason] + local reason = PersonalPlayerNotes:GetReasons()[listedPlayer.reason] local _reason = reason local _listedPlayer = listedPlayer --@debug@ - Shitlist:PrintDebug("|cffff0000|cffffffff Playername:", name, "Realm:", realm, "Reason:", _reason + PersonalPlayerNotes:PrintDebug("|cffff0000|cffffffff Playername:", name, "Realm:", realm, "Reason:", + _reason .reason, "Note:", _listedPlayer.description) --@end-debug@ @@ -346,7 +380,7 @@ function Shitlist:GameTooltip() -- Tooltip if not (_reason.reason == "None" and _listedPlayer.description == "") then self:AddLine("\n") - self:AddDoubleLine(_reason.reason:gsub("None", ""), "|T" .. Shitlist.db.profile.icon .. ":0|t", + self:AddDoubleLine(_reason.reason:gsub("None", ""), "|T" .. PersonalPlayerNotes.db.profile.icon .. ":0|t", _reason.color.r or 1, _reason.color.g or 1, _reason.color.b or 1) self:AddLine(_listedPlayer.description, _listedPlayer.color.r or 1, _listedPlayer.color.g or 1, _listedPlayer.color.b or 1, false) @@ -354,60 +388,62 @@ function Shitlist:GameTooltip() -- Alert local time = time() - local alert = Shitlist.db.profile.alert + local alert = PersonalPlayerNotes.db.profile.alert if (alert.enabled and reason.alert) then if (listedPlayer.alert and not alert.last[name]) then alert.last[name] = time + alert.delay - Shitlist:ScheduleTimer("AlertDelayTimer", alert.delay, name) - Shitlist:PlayAlertSoundEffect() + PersonalPlayerNotes:ScheduleTimer("AlertDelayTimer", alert.delay, name) + PersonalPlayerNotes:PlayAlertSoundEffect() --@debug@ - Shitlist:PrintDebug("|cffff0000|cffffffff Sound effect disabled for player", name, "for", alert.delay, + PersonalPlayerNotes:PrintDebug("|cffff0000|cffffffff Sound effect disabled for player", name, "for", + alert.delay, "seconds.") --@end-debug@ end end end -function Shitlist:AlertDelayTimer(name) +function PersonalPlayerNotes:AlertDelayTimer(name) -- Called within ScheduleTimer and fires when timer ends. --@debug@ - Shitlist:PrintDebug("|cffff0000|cffffffff Sound effect is now enabled for player", name) + PersonalPlayerNotes:PrintDebug("|cffff0000|cffffffff Sound effect is now enabled for player", name) --@end-debug@ - Shitlist.db.profile.alert.last[name] = nil + PersonalPlayerNotes.db.profile.alert.last[name] = nil end -function Shitlist:MiniMapIcon() +function PersonalPlayerNotes:MiniMapIcon() -- Create minimap launcher -- https://github.com/tekkub/libdatabroker-1-1/wiki/How-to-provide-a-dataobject - return LibDataBroker:NewDataObject(shitlist, { + return LibDataBroker:NewDataObject(personalPlayerNotes, { type = "launcher", - text = shitlist, - icon = Shitlist.db.profile.icon, + text = personalPlayerNotes, + icon = PersonalPlayerNotes.db.profile.icon, OnClick = function(clickedframe, button) - AceConfigDialog:Close("ShitlistSettings Options") + AceConfigDialog:Close("PersonalPlayerNotesSettings Options") AceConfigDialog:CloseAll() - local AceGUI = Shitlist:AceGUIDefaults() + local AceGUI = PersonalPlayerNotes:AceGUIDefaults() if button == "RightButton" then - InterfaceOptionsFrame_OpenToCategory(shitlist) + InterfaceOptionsFrame_OpenToCategory(personalPlayerNotes) elseif button == "LeftButton" then if IsShiftKeyDown() then AceGUI:SetTitle(L["SHITLIST_REASONS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Reasons", 500, 200) - AceConfigDialog:Open("ShitlistSettings Reasons") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Reasons", 500, 200) + AceConfigDialog:Open("PersonalPlayerNotesSettings Reasons") elseif IsControlKeyDown() then AceGUI:SetTitle(L["SHITLIST_LISTED_PLAYERS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Listed_Players", 500, 300) - AceConfigDialog:Open("ShitlistSettings Listed_Players") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Listed_Players", 500, 300) + AceConfigDialog:Open("PersonalPlayerNotesSettings Listed_Players") else AceGUI:SetTitle(L["SHITLIST_SETTINGS_TITLE"]) - AceConfigDialog:SetDefaultSize("ShitlistSettings Options", 500, 350) - AceConfigDialog:Open("ShitlistSettings Options") + AceConfigDialog:SetDefaultSize("PersonalPlayerNotesSettings Options", 500, 350) + AceConfigDialog:Open("PersonalPlayerNotesSettings Options") end end end, OnTooltipShow = function(tooltip) - tooltip:AddDoubleLine("|T" .. Shitlist.db.profile.icon .. ":0|t " .. L["SHITLIST_MINIMAP_TOOLTIP_TITLE"], - Shitlist:GetVersion()) + tooltip:AddDoubleLine( + "|T" .. PersonalPlayerNotes.db.profile.icon .. ":0|t " .. L["SHITLIST_MINIMAP_TOOLTIP_TITLE"], + PersonalPlayerNotes:GetVersion()) tooltip:AddLine("\n") tooltip:AddLine(L["SHITLIST_MINIMAP_TOOLTIP_RIGHT_CLICK"]) tooltip:AddLine(L["SHITLIST_MINIMAP_TOOLTIP_LEFT_CLICK"]) @@ -417,14 +453,15 @@ function Shitlist:MiniMapIcon() }) end -function Shitlist:ToggleMiniMapIcon() +function PersonalPlayerNotes:ToggleMiniMapIcon() self.db.profile.minimap.hide = not self.db.profile.minimap.hide - self:RefreshConfig() + self:LoadConfig() end --@debug@ -function Shitlist:ToggleDebug() +function PersonalPlayerNotes:ToggleDebug() self.db.profile.debug = not self.db.profile.debug - self:RefreshConfig() + self:LoadConfig() end + --@end-debug@ diff --git a/PersonalPlayerNotes.toc b/PersonalPlayerNotes.toc index f191d25..634a7b0 100644 --- a/PersonalPlayerNotes.toc +++ b/PersonalPlayerNotes.toc @@ -1,10 +1,10 @@ ## Interface: 110002 ## Title : Personal Player Notes -## Notes: Set a personal comment on players and show it on the player information tooltip window. +## Notes: Set a personal comment on players and adding it to player information tooltip. ## Author: Limmek ## Version: @project-version@ ## Dependencies: -## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1, LibDBIcon-1.0, CallbackHandler-1.0 +## OptionalDeps: Shitlist, Ace3, LibStub, LibDataBroker-1.1, LibDBIcon-1.0, CallbackHandler-1.0 ## SavedVariables: PersonalPlayerNotesDB ## DefaultState: enabled ## X-Category: Tooltip, Miscellaneous, PvP, Quests & Leveling, Unit Frames @@ -12,7 +12,7 @@ ## X-Localizations: enUS, zhCN ## X-Website: https://github.com/Limmek/Shitlist ## X-License: MIT -## IconTexture: Interface\AddOns\Shitlist\Images\icon.png +## IconTexture: Interface\AddOns\PersonalPlayerNotes\Images\icon.png embeds.xml diff --git a/PersonalPlayerNotesConfig.lua b/PersonalPlayerNotesConfig.lua index 31d9738..0ebbde3 100644 --- a/PersonalPlayerNotesConfig.lua +++ b/PersonalPlayerNotesConfig.lua @@ -1,9 +1,9 @@ -local shitlist = ... -local L = LibStub("AceLocale-3.0"):GetLocale(shitlist, true) +local personalPlayerNotes = ... +local L = LibStub("AceLocale-3.0"):GetLocale(personalPlayerNotes, true) -Shitlist.defaults = { +PersonalPlayerNotes.defaults = { profile = { - icon = "Interface\\AddOns\\" .. shitlist .. "\\Images\\shitlist.png", + icon = "Interface\\AddOns\\" .. personalPlayerNotes .. "\\Images\\icon.png", debug = false, minimap = { hide = false, minimapPos = 240 }, announcement = { delay = 10, guild = true, party = true, raid = true, instance = true }, @@ -46,7 +46,7 @@ Shitlist.defaults = { } -- https://www.wowace.com/projects/ace3/pages/ace-config-3-0-options-tables -Shitlist.options = { +PersonalPlayerNotes.options = { Info = { type = "group", order = 0, @@ -58,7 +58,7 @@ Shitlist.options = { order = 1, type = "description", fontSize = "medium", - name = Shitlist:GetNotes() .. "\n\n\n", + name = PersonalPlayerNotes:GetNotes() .. "\n\n\n", }, Commands = { name = L["SHITLIST_INFO_COMMANDS_TITLE"], @@ -105,7 +105,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_VERSION"] .. - ": |cffff8c00" .. Shitlist:GetVersion() + ": |cffff8c00" .. PersonalPlayerNotes:GetVersion() }, author = { type = "description", @@ -113,7 +113,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_AUTHOR"] .. - ": |cffffffff" .. Shitlist:GetAuthor() + ": |cffffffff" .. PersonalPlayerNotes:GetAuthor() }, category = { type = "description", @@ -121,7 +121,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_CATEGORY"] .. - ": |cffffffff" .. Shitlist:GetCategory() + ": |cffffffff" .. PersonalPlayerNotes:GetCategory() }, localizations = { type = "description", @@ -129,7 +129,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_LOCALIZATION"] .. - ": |cffffffff" .. Shitlist:GetLocalizations() + ": |cffffffff" .. PersonalPlayerNotes:GetLocalizations() }, license = { type = "description", @@ -137,7 +137,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_LICENSE"] .. - ": |cffffffff" .. Shitlist:GetLicense() + ": |cffffffff" .. PersonalPlayerNotes:GetLicense() }, website = { type = "description", @@ -145,7 +145,7 @@ Shitlist.options = { width = "full", fontSize = "medium", name = "|cffffd700" .. L["SHITLIST_INFO_ABOUT_WEB"] .. - ": |cffffffff" .. Shitlist:GetWebsite() + ": |cffffffff" .. PersonalPlayerNotes:GetWebsite() }, } } @@ -157,7 +157,7 @@ Shitlist.options = { name = L["SHITLIST_SETTINGS_TITLE"], inline = true, childGroups = "tab", - handler = Shitlist, + handler = PersonalPlayerNotes, args = { minimap = { name = L["SHITLIST_SETTINGS_MINIMAP"], @@ -171,11 +171,11 @@ Shitlist.options = { name = L["SHITLIST_SETTINGS_MINIMAP_ICON"], desc = L["SHITLIST_SETTINGS_MINIMAP_ICON_DESC"], get = function(info) - return Shitlist.db.profile.minimap.hide; + return PersonalPlayerNotes.db.profile.minimap.hide; end, set = function(info, value) - Shitlist.db.profile.minimap.hide = value; - Shitlist:RefreshConfig(); + PersonalPlayerNotes.db.profile.minimap.hide = value; + PersonalPlayerNotes:LoadConfig(); end }, minimapPos = { @@ -185,11 +185,11 @@ Shitlist.options = { desc = L["SHITLIST_SETTINGS_MINIMAP_POS_DESC"], width = 1.5, get = function(info) - return Shitlist.db.profile.minimap.minimapPos; + return PersonalPlayerNotes.db.profile.minimap.minimapPos; end, set = function(info, value) - Shitlist.db.profile.minimap.minimapPos = value; - Shitlist:RefreshConfig(); + PersonalPlayerNotes.db.profile.minimap.minimapPos = value; + PersonalPlayerNotes:LoadConfig(); end, min = 0, max = 360, @@ -224,7 +224,7 @@ Shitlist.options = { name = L["SHITLIST_SETTINGS_ALERT_SOUNDS"], desc = L["SHITLIST_SETTINGS_ALERT_SOUNDS_DESC"], values = function() - return Shitlist.db.profile.alert.sounds + return PersonalPlayerNotes.db.profile.alert.sounds end, width = 1, set = "SetAlertSoundEffect", @@ -249,7 +249,7 @@ Shitlist.options = { order = 2, name = L["SHITLIST_REASONS_TITLE"], inline = false, - handler = Shitlist, + handler = PersonalPlayerNotes, args = { description = { type = "description", @@ -264,13 +264,13 @@ Shitlist.options = { name = L["SHITLIST_REASONS"], values = function() local _return = {} - for key, value in pairs(Shitlist.db.profile.reasons) do + for key, value in pairs(PersonalPlayerNotes.db.profile.reasons) do _return[key] = value.reason end return _return end, - get = "GetReasonSelected", - set = "SetReasonSelected", + get = "GetReason", + set = "SelectedReason", }, remove = { type = "execute", @@ -279,11 +279,11 @@ Shitlist.options = { cmdHidden = true, name = L["SHITLIST_REASON_REMOVE"], confirm = function() - return L["SHITLIST_REASON_REMOVE_CONFIRMATION"] .. Shitlist.db.profile.reason.reason .. "|cffffffff?"; + return L["SHITLIST_REASON_REMOVE_CONFIRMATION"] .. PersonalPlayerNotes.db.profile.reason.reason .. "|cffffffff?"; end, func = "RemoveReason", disabled = function() - if (Shitlist.db.profile.reason.id <= #Shitlist.defaults.profile.reasons) then + if (PersonalPlayerNotes.db.profile.reason.id <= #PersonalPlayerNotes.defaults.profile.reasons) then return true end return false @@ -322,7 +322,7 @@ Shitlist.options = { order = 3, name = L["SHITLIST_LISTED_PLAYERS_TITLE"], inline = true, - handler = Shitlist, + handler = PersonalPlayerNotes, args = { id = { type = "select", @@ -331,7 +331,7 @@ Shitlist.options = { name = L["SHITLIST_LISTED_PLAYERS"], values = function() local _return = {} - for key, value in pairs(Shitlist:GetListedPlayers()) do + for key, value in pairs(PersonalPlayerNotes:GetListedPlayers()) do _return[key] = value.name .. "-" .. value.realm end return _return @@ -347,8 +347,8 @@ Shitlist.options = { name = L["SHITLIST_LISTED_PLAYER_REMOVE"], confirm = function() return L["SHITLIST_LISTED_PLAYER_REMOVE_CONFIRMATION"] .. - Shitlist.db.profile.listedPlayer.name .. - "-" .. Shitlist.db.profile.listedPlayer.realm .. "|cffffffff?"; + PersonalPlayerNotes.db.profile.listedPlayer.name .. + "-" .. PersonalPlayerNotes.db.profile.listedPlayer.realm .. "|cffffffff?"; end, func = "RemoveListedPlayer", }, @@ -375,7 +375,7 @@ Shitlist.options = { name = L["SHITLIST_LISTED_PLAYER_REASON"], values = function() local _return = {} - for key, value in pairs(Shitlist:GetReasons()) do + for key, value in pairs(PersonalPlayerNotes:GetReasons()) do _return[key] = value.reason end return _return @@ -409,7 +409,7 @@ Shitlist.options = { get = "GetListedPlayerAlert", set = "SetListedPlayerAlert", disabled = function() - return not Shitlist.db.profile.reasons[Shitlist.db.profile.listedPlayer.reason].alert + return not PersonalPlayerNotes.db.profile.reasons[PersonalPlayerNotes.db.profile.listedPlayer.reason].alert end, }, } @@ -418,27 +418,27 @@ Shitlist.options = { --#region Sound -function Shitlist:GetAlert(info) +function PersonalPlayerNotes:GetAlert(info) return self.db.profile.alert[info[#info]] end -function Shitlist:SetAlert(info, value) +function PersonalPlayerNotes:SetAlert(info, value) self.db.profile.alert[info[#info]] = value end -function Shitlist:GetAlertSoundEffect(info) +function PersonalPlayerNotes:GetAlertSoundEffect(info) return self.db.profile.alert.sound end -function Shitlist:SetAlertSoundEffect(info, value) +function PersonalPlayerNotes:SetAlertSoundEffect(info, value) self:PlayAlertSoundEffect(value) self.db.profile.alert.sound = value end -function Shitlist:PlayAlertSoundEffect(effect, channel) +function PersonalPlayerNotes:PlayAlertSoundEffect(effect, channel) PlaySoundFile( "Interface\\AddOns\\" .. - shitlist .. "\\Sounds\\" .. Shitlist.db.profile.alert.sounds[effect or self:GetAlertSoundEffect()] .. ".ogg", + personalPlayerNotes .. "\\Sounds\\" .. PersonalPlayerNotes.db.profile.alert.sounds[effect or self:GetAlertSoundEffect()] .. ".ogg", channel or "master" ) end @@ -450,31 +450,19 @@ end --[[ Returns all reasons ]] --- -function Shitlist:GetReasons() +function PersonalPlayerNotes:GetReasons() return self.db.profile.reasons end -function Shitlist:GetReasonSelected(info) - return self.db.profile.reason[info[#info]] +function PersonalPlayerNotes:SetReasons(data) + self.db.profile.reasons = data end -function Shitlist:SetReasonSelected(info, value) - local r = self.db.profile.reasons[value] - if (not r) then - return - end - self.db.profile.reason[info[#info]] = value - self.db.profile.reason.reason = r.reason - self.db.profile.reason.color = r.color - self.db.profile.reason.alert = r.alert -end - -function Shitlist:GetReason(info) +function PersonalPlayerNotes:GetReason(info) return self.db.profile.reason[info[#info]] end -function Shitlist:SetReason(info, value) +function PersonalPlayerNotes:SetReason(info, value) self.db.profile.reason[info[#info]] = value if (self.db.profile.reasons[self.db.profile.reason.id].reason == value) then return @@ -488,39 +476,47 @@ function Shitlist:SetReason(info, value) alert = true }) self.db.profile.reason.id = #self.db.profile.reasons - -- self.db.profile.reason.color = { r = 1, g = 1, b = 1 } - -- self.db.profile.reason.alert = { r = 1, g = 1, b = 1 } - self:SetReasonSelected(info, self.db.profile.reason.id) - self:GetReasonSelected(info) + self:SelectedReason(info, self.db.profile.reason.id) + self:GetReason(info) + end +end + +function PersonalPlayerNotes:SelectedReason(info, value) + local r = self.db.profile.reasons[value] + if (not r) then + return end + self.db.profile.reason[info[#info]] = value + self.db.profile.reason.reason = r.reason + self.db.profile.reason.color = r.color + self.db.profile.reason.alert = r.alert end -function Shitlist:RemoveReason() - tremove(Shitlist.db.profile.reasons, Shitlist.db.profile.reason.id) - --Shitlist.db.profile.reasons[Shitlist.db.profile.reason.id] = nil - local reasons = Shitlist:GetReasons() - Shitlist.db.profile.reason.id = #reasons - Shitlist.db.profile.reason.reason = reasons[#reasons].reason - Shitlist.db.profile.reason.color = reasons[#reasons].color - Shitlist.db.profile.reason.alert = reasons[#reasons].alert +function PersonalPlayerNotes:RemoveReason() + tremove(PersonalPlayerNotes.db.profile.reasons, PersonalPlayerNotes.db.profile.reason.id) + local reasons = PersonalPlayerNotes:GetReasons() + PersonalPlayerNotes.db.profile.reason.id = #reasons + PersonalPlayerNotes.db.profile.reason.reason = reasons[#reasons].reason + PersonalPlayerNotes.db.profile.reason.color = reasons[#reasons].color + PersonalPlayerNotes.db.profile.reason.alert = reasons[#reasons].alert return true; end -function Shitlist:GetReasonColor(info) +function PersonalPlayerNotes:GetReasonColor(info) local c = self.db.profile.reason[info[#info]] return c.r or 1, c.g or 1, c.b or 1 end -function Shitlist:SetReasonColor(info, r, g, b) +function PersonalPlayerNotes:SetReasonColor(info, r, g, b) local c = self.db.profile.reason[info[#info]] c.r, c.g, c.b = r or 1, g or 1, b or 1 end -function Shitlist:GetReasonAlert(info) +function PersonalPlayerNotes:GetReasonAlert(info) return self.db.profile.reason[info[#info]] end -function Shitlist:SetReasonAlert(info, value) +function PersonalPlayerNotes:SetReasonAlert(info, value) self.db.profile.reason[info[#info]] = value local reason = self:GetReasons()[self.db.profile.reason.id] reason.alert = value @@ -532,15 +528,15 @@ end --[[ Returns all listed players. -]]-- -function Shitlist:GetListedPlayers() +]] +function PersonalPlayerNotes:GetListedPlayers() return self.db.profile.listedPlayers end --[[ Return listed player data by name and realm. -]]-- -function Shitlist:GetListedPlayer(name, realm) +]] +function PersonalPlayerNotes:GetListedPlayer(name, realm) for index, value in pairs(self.db.profile.listedPlayers) do if (tostring(name) == value.name and tostring(realm) == value.realm) then return self.db.profile.listedPlayers[index] @@ -551,15 +547,15 @@ end --[[ Return the current selected player data. -]]-- -function Shitlist:GetListedPlayerSelected(info) +]] +function PersonalPlayerNotes:GetListedPlayerSelected(info) return self.db.profile.listedPlayer[info[#info]] end --[[ Set player data by current selected player data. -]]-- -function Shitlist:SetListedPlayerSelected(info, value) +]] +function PersonalPlayerNotes:SetListedPlayerSelected(info, value) self.db.profile.listedPlayer[info[#info]] = value local player = self.db.profile.listedPlayers[self.db.profile.listedPlayer.id] if (player) then @@ -573,14 +569,14 @@ function Shitlist:SetListedPlayerSelected(info, value) end end -function Shitlist:GetListedPlayerRealm(info) +function PersonalPlayerNotes:GetListedPlayerRealm(info) return self.db.profile.listedPlayer[info[#info]] end -function Shitlist:SetListedPlayerRealm(info, value) +function PersonalPlayerNotes:SetListedPlayerRealm(info, value) self.db.profile.listedPlayer[info[#info]] = value - local player = Shitlist:GetListedPlayers()[self.db.profile.listedPlayer.id] - --local player = Shitlist:GetListedPlayer(self.db.profile.listedPlayer.name, value) + local player = PersonalPlayerNotes:GetListedPlayers()[self.db.profile.listedPlayer.id] + --local player = PersonalPlayerNotes:GetListedPlayer(self.db.profile.listedPlayer.name, value) if (player) then player.id = self.db.profile.listedPlayer.id player.name = self.db.profile.listedPlayer.name @@ -592,14 +588,14 @@ function Shitlist:SetListedPlayerRealm(info, value) end end -function Shitlist:GetListedPlayerName(info) +function PersonalPlayerNotes:GetListedPlayerName(info) return self.db.profile.listedPlayer[info[#info]] end -function Shitlist:SetListedPlayerName(info, value) +function PersonalPlayerNotes:SetListedPlayerName(info, value) self.db.profile.listedPlayer[info[#info]] = value - --local player = Shitlist:GetListedPlayers()[self.db.profile.listedPlayer.id] - local player = Shitlist:GetListedPlayer(value, self.db.profile.listedPlayer.realm) + --local player = PersonalPlayerNotes:GetListedPlayers()[self.db.profile.listedPlayer.id] + local player = PersonalPlayerNotes:GetListedPlayer(value, self.db.profile.listedPlayer.realm) if (player) then player.id = self.db.profile.listedPlayer.id player.name = value @@ -609,15 +605,15 @@ function Shitlist:SetListedPlayerName(info, value) player.color = self.db.profile.listedPlayer.color player.alert = self.db.profile.listedPlayer.alert else - local new = Shitlist:NewListedPlayer(value, self.db.profile.listedPlayer.realm) - Shitlist:SetListedPlayerSelected(info, new.id) - Shitlist:GetListedPlayerSelected(info) + local new = PersonalPlayerNotes:NewListedPlayer(value, self.db.profile.listedPlayer.realm) + PersonalPlayerNotes:SetListedPlayerSelected(info, new.id) + PersonalPlayerNotes:GetListedPlayerSelected(info) end end -function Shitlist:RemoveListedPlayer() +function PersonalPlayerNotes:RemoveListedPlayer() tremove(self.db.profile.listedPlayers, self.db.profile.listedPlayer.id) - local listedPlayers = Shitlist:GetListedPlayers() + local listedPlayers = PersonalPlayerNotes:GetListedPlayers() self.db.profile.listedPlayer.id = #listedPlayers self.db.profile.listedPlayer.name = listedPlayers[#listedPlayers].name self.db.profile.listedPlayer.realm = listedPlayers[#listedPlayers].realm @@ -628,37 +624,37 @@ function Shitlist:RemoveListedPlayer() return true end -function Shitlist:GetListedPlayerSelectedReason(info) +function PersonalPlayerNotes:GetListedPlayerSelectedReason(info) return self.db.profile.listedPlayer[info[#info]] end -function Shitlist:SetListedPlayerSelectedReason(info, value) +function PersonalPlayerNotes:SetListedPlayerSelectedReason(info, value) self.db.profile.listedPlayer[info[#info]] = value - local player = Shitlist:GetListedPlayers()[self.db.profile.listedPlayer.id] + local player = PersonalPlayerNotes:GetListedPlayers()[self.db.profile.listedPlayer.id] player.reason = value end -function Shitlist:GetListedPlayerSelectedDescription(info) +function PersonalPlayerNotes:GetListedPlayerSelectedDescription(info) return self.db.profile.listedPlayer[info[#info]] end -function Shitlist:SetListedPlayerSelectedDescription(info, value) +function PersonalPlayerNotes:SetListedPlayerSelectedDescription(info, value) self.db.profile.listedPlayer[info[#info]] = value - local player = Shitlist:GetListedPlayers()[self.db.profile.listedPlayer.id] + local player = PersonalPlayerNotes:GetListedPlayers()[self.db.profile.listedPlayer.id] player.description = value end -function Shitlist:GetListedPlayerColor(info) +function PersonalPlayerNotes:GetListedPlayerColor(info) local c = self.db.profile.listedPlayer[info[#info]] return c.r or 1, c.g or 1, c.b or 1 end -function Shitlist:SetListedPlayerColor(info, r, g, b) +function PersonalPlayerNotes:SetListedPlayerColor(info, r, g, b) local c = self.db.profile.listedPlayer[info[#info]] c.r, c.g, c.b = r or 1, g or 1, b or 1 end -function Shitlist:NewListedPlayer(name, realm, reason, description) +function PersonalPlayerNotes:NewListedPlayer(name, realm, reason, description) self.db.profile.listedPlayer.id = #self.db.profile.listedPlayers + 1 local newPlayer = { id = self.db.profile.listedPlayer.id, @@ -673,13 +669,13 @@ function Shitlist:NewListedPlayer(name, realm, reason, description) return newPlayer end -function Shitlist:GetListedPlayerAlert(info) +function PersonalPlayerNotes:GetListedPlayerAlert(info) return self.db.profile.listedPlayer[info[#info]] end -function Shitlist:SetListedPlayerAlert(info, value) +function PersonalPlayerNotes:SetListedPlayerAlert(info, value) self.db.profile.listedPlayer[info[#info]] = value - local player = Shitlist:GetListedPlayers()[self.db.profile.listedPlayer.id] + local player = PersonalPlayerNotes:GetListedPlayers()[self.db.profile.listedPlayer.id] player.alert = value end diff --git a/PersonalPlayerNotesUtils.lua b/PersonalPlayerNotesUtils.lua index b778f38..7335d03 100644 --- a/PersonalPlayerNotesUtils.lua +++ b/PersonalPlayerNotesUtils.lua @@ -1,39 +1,39 @@ -local shitlist = ... -local L = LibStub("AceLocale-3.0"):GetLocale(shitlist, true) +local personalPlayerNotes = ... +local L = LibStub("AceLocale-3.0"):GetLocale(personalPlayerNotes, true) -function Shitlist:GetVersion() - return tostring(GetAddOnMetadata(shitlist, "Version")) or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetVersion() + return tostring(GetAddOnMetadata(personalPlayerNotes, "Version")) or L["SHITLIST_NA"]; end -function Shitlist:GetTitle() - return GetAddOnMetadata(shitlist, "Title") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetTitle() + return GetAddOnMetadata(personalPlayerNotes, "Title") or L["SHITLIST_NA"]; end -function Shitlist:GetAuthor() - return GetAddOnMetadata(shitlist, "Author") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetAuthor() + return GetAddOnMetadata(personalPlayerNotes, "Author") or L["SHITLIST_NA"]; end -function Shitlist:GetNotes() - return GetAddOnMetadata(shitlist, "Notes") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetNotes() + return GetAddOnMetadata(personalPlayerNotes, "Notes") or L["SHITLIST_NA"]; end -function Shitlist:GetLocalizations() - return GetAddOnMetadata(shitlist, "X-Localizations") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetLocalizations() + return GetAddOnMetadata(personalPlayerNotes, "X-Localizations") or L["SHITLIST_NA"]; end -function Shitlist:GetCategory() - return GetAddOnMetadata(shitlist, "X-Category") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetCategory() + return GetAddOnMetadata(personalPlayerNotes, "X-Category") or L["SHITLIST_NA"]; end -function Shitlist:GetWebsite() - return GetAddOnMetadata(shitlist, "X-Website") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetWebsite() + return GetAddOnMetadata(personalPlayerNotes, "X-Website") or L["SHITLIST_NA"]; end -function Shitlist:GetLicense() - return GetAddOnMetadata(shitlist, "X-License") or L["SHITLIST_NA"]; +function PersonalPlayerNotes:GetLicense() + return GetAddOnMetadata(personalPlayerNotes, "X-License") or L["SHITLIST_NA"]; end -function Shitlist:AceGUIDefaults() +function PersonalPlayerNotes:AceGUIDefaults() local aceGUI = LibStub("AceGUI-3.0"):Create("Frame") aceGUI:SetCallback("OnClose", function(widget) aceGUI:Release() end) aceGUI:SetLayout("Fill") @@ -44,7 +44,7 @@ function Shitlist:AceGUIDefaults() return aceGUI end -function Shitlist:Print(...) +function PersonalPlayerNotes:Print(...) if (self.db and self.db.profile.debug) then return print(L["SHITLIST_DEBUG"], ...) end @@ -52,7 +52,7 @@ function Shitlist:Print(...) end --@debug@ -function Shitlist:PrintDebug(...) +function PersonalPlayerNotes:PrintDebug(...) if (self.db and self.db.profile.debug) then self:Print(...) end diff --git a/PersonalPlayerNotes_Cata.toc b/PersonalPlayerNotes_Cata.toc index 803069e..2419622 100644 --- a/PersonalPlayerNotes_Cata.toc +++ b/PersonalPlayerNotes_Cata.toc @@ -1,11 +1,11 @@ ## Interface: 40400 ## Title : Personal Player Notes -## Notes: Set a personal comment on players and show it on the player information tooltip window. +## Notes: Set a personal comment on players and adding it to player information tooltip. ## Author: Limmek ## Version: @project-version@ ## Dependencies: ## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1, LibDBIcon-1.0, CallbackHandler-1.0 -## SavedVariables: PersonalPlayerNotesDB +## SavedVariables: PersonalPlayerNotesDB, ShitlistDB ## DefaultState: enabled ## X-Category: Tooltip, Miscellaneous, PvP, Quests & Leveling, Unit Frames ## X-Curse-Project-ID: 344967 diff --git a/PersonalPlayerNotes_Vanilla.toc b/PersonalPlayerNotes_Vanilla.toc index 98cbff3..98f8ae9 100644 --- a/PersonalPlayerNotes_Vanilla.toc +++ b/PersonalPlayerNotes_Vanilla.toc @@ -1,11 +1,11 @@ ## Interface: 11503 ## Title : Personal Player Notes -## Notes: Set a personal comment on players and show it on the player information tooltip window. +## Notes: Set a personal comment on players and adding it to player information tooltip. ## Author: Limmek ## Version: @project-version@ ## Dependencies: ## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1, LibDBIcon-1.0, CallbackHandler-1.0 -## SavedVariables: PersonalPlayerNotesDB +## SavedVariables: PersonalPlayerNotesDB, ShitlistDB ## DefaultState: enabled ## X-Category: Tooltip, Miscellaneous, PvP, Quests & Leveling, Unit Frames ## X-Curse-Project-ID: 344967 diff --git a/PersonalPlayerNotes_Wrath.toc b/PersonalPlayerNotes_Wrath.toc index 435e9f4..e6d3508 100644 --- a/PersonalPlayerNotes_Wrath.toc +++ b/PersonalPlayerNotes_Wrath.toc @@ -1,11 +1,11 @@ ## Interface: 30403 ## Title : Personal Player Notes -## Notes: Set a personal comment on players and show it on the player information tooltip window. +## Notes: Set a personal comment on players and adding it to player information tooltip. ## Author: Limmek ## Version: @project-version@ ## Dependencies: ## OptionalDeps: Ace3, LibStub, LibDataBroker-1.1, LibDBIcon-1.0, CallbackHandler-1.0 -## SavedVariables: PersonalPlayerNotesDB +## SavedVariables: PersonalPlayerNotesDB, ShitlistDB ## DefaultState: enabled ## X-Category: Tooltip, Miscellaneous, PvP, Quests & Leveling, Unit Frames ## X-Curse-Project-ID: 344967 diff --git a/README.md b/README.md index 27c62e0..6146296 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,13 @@ [![Check formating](https://github.com/Limmek/Shitlist/actions/workflows/luacheck.yml/badge.svg)](https://github.com/Limmek/Shitlist/actions/workflows/luacheck.yml) [![Interface versions](https://github.com/Limmek/Shitlist/actions/workflows/interface-version.yml/badge.svg)](https://github.com/Limmek/Shitlist/actions/workflows/interface-version.yml) [![Package and release](https://github.com/Limmek/Shitlist/actions/workflows/build.yml/badge.svg)](https://github.com/Limmek/Shitlist/actions/workflows/build.yml) -# Shitlist -Tired of encountering players who've made your gaming experiences less enjoyable? Whether remembering the heroes or the not-so-great allies, **#Shitlist** is the solution. This WoW addon lets you create different preset reasons and personalized comments on players, tracking the good, the bad, and everything in between. +# Personal Player Notes *(former #Shitlist)* +Set personal notes and pre-defined descriptions on players to remind your self in the future. The note and pre-defined description is displayed in the game tooltip. Both descriptions and notes support different colors and a alert sound. -## Features to Enhance Your Gaming Experience - -- **Player Note Tracking**: Reasons and player notes are conveniently displayed on tooltips. -- **Personalized Player Notes**: Craft colored notes and preset reason with alert effect to tailor your gaming experiences. -- **Effortless Player Management**: Easily add, edit, or remove players and their associated reasons, even if they're offline or not your current target. -- **Accessible Minimap Icon**: Swiftly access Shitlist options, reasons, and listed players through the minimap icon for seamless on-the-go management. -- **Alert System**: Set up sound alerts for listed players or specific reasons, ensuring you're promptly informed when encountering them. - -## How to Utilize - -- **Options**: Navigate to **Interface Options -> Addons -> Shitlist -> Options** or access if from the **Minimap Icon**. -- **Customizing Reasons**: Modify preset reasons by visiting **Interface Options -> Addons -> Shitlist -> Reasons**. -- **Adding/Editing Players**: Right-click a player to add or remove them from the #Shitlist. Alternatively, Modify listed players by visiting **Interface Options -> Addons -> Shitlist -> Listed Players** for comprehensive player management. - -## Versatile Applications - -This addon proves invaluable across various in-game scenarios: - -- **Questing**: Recall helpful or troublesome players encountered during quests. -- **Raids & Dungeons**: Track valuable teammates or identify those causing issues. -- **World & PvP**: Easily identify players during intense battles or tricky situations. -- **Preventing Hassles**: Avoid repeated encounters with troublesome players. -- **Blacklisting Capability**: Use #Shitlist as a blacklist, steering clear of unwanted interactions. - -## Download & Contribution +### Notes and pre-defined Descriptions can be set and managed: +- By right-clicking on a unit frame or in chat +- From a GUI interface or addon options +- Minimap button to GUI interface or to open addon options - **Download Now**: Latest release can be found on [Github](https://github.com/Limmek/Shitlist/releases) or ~~[Curse Forge](https://www.curseforge.com/wow/addons/shitlist)~~(*They removed it due to violating their ToS*)..