From 3035ca2d6d12494530a297a603759c3a7a5e6e5a Mon Sep 17 00:00:00 2001 From: Britt Yazel Date: Fri, 2 Sep 2022 21:30:27 -0700 Subject: [PATCH] Port to WotLK classic --- Neuron-Defaults.lua | 4 ++-- Neuron-GUI.lua | 4 ++-- Neuron-Startup.lua | 4 ++-- Neuron.lua | 10 +++++----- Neuron.toc | 1 + Objects/ACTIONBUTTON.lua | 4 ++-- Objects/ACTIONBUTTON_Flyout.lua | 6 +++--- Objects/BAGBTN.lua | 6 +++--- Objects/BUTTON.lua | 2 +- Objects/MENUBTN.lua | 6 +++--- Objects/PETBTN.lua | 2 +- Objects/STATUSBTN.lua | 21 ++++++++++++--------- 12 files changed, 37 insertions(+), 33 deletions(-) diff --git a/Neuron-Defaults.lua b/Neuron-Defaults.lua index abd629d..0fbc5e1 100644 --- a/Neuron-Defaults.lua +++ b/Neuron-Defaults.lua @@ -262,7 +262,7 @@ Neuron.DefaultBarOptions.PetBar = { ----------------------------------- ----------- Menu Bar -------------- ----------------------------------- -if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then +if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then Neuron.DefaultBarOptions.MenuBar = { [1] = { snapTo = false, @@ -310,7 +310,7 @@ end ----------------------------------- ------------ Bag Bar -------------- ----------------------------------- -if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then +if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then Neuron.DefaultBarOptions.BagBar = { [1] = { padH = 1, diff --git a/Neuron-GUI.lua b/Neuron-GUI.lua index 754e067..16c0f3b 100644 --- a/Neuron-GUI.lua +++ b/Neuron-GUI.lua @@ -98,7 +98,7 @@ function NeuronGUI:OnInitialize() NeuronGUI.interfaceOptions.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(Neuron.db) -- Per spec profiles - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then local LibDualSpec = LibStub('LibDualSpec-1.0') LibDualSpec:EnhanceDatabase(Neuron.db, addonName) --enhance the database object with per spec profile features LibDualSpec:EnhanceOptions(NeuronGUI.interfaceOptions.args.profile, Neuron.db) -- enhance the profiles config panel with per spec profile features @@ -131,7 +131,7 @@ function NeuronGUI:OnEnable() NeuronGUI:RegisterEvent("ADDON_LOADED") - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then NeuronGUI:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") end diff --git a/Neuron-Startup.lua b/Neuron-Startup.lua index 559fee8..763a42a 100644 --- a/Neuron-Startup.lua +++ b/Neuron-Startup.lua @@ -33,7 +33,7 @@ function Neuron:RegisterBars() --Neuron Pet Bar Neuron:RegisterBarClass("PetBar", "PetBar", L["Pet Bar"], "Pet Button", DB.PetBar, Neuron.PETBTN, 10, true) - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --Neuron Zone Ability Bar Neuron:RegisterBarClass("ZoneAbilityBar", "ZoneAbilityBar", L["Zone Action Bar"], "Zone Action Button", DB.ZoneAbilityBar, Neuron.ZONEABILITYBTN, 5, true) @@ -116,7 +116,7 @@ function Neuron:RegisterGUI() CDALPHA = true }, false, 65) - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --Neuron Zone Ability Bar Neuron:RegisterGUIOptions("ZoneAbilityBar", { AUTOHIDE = true, diff --git a/Neuron.lua b/Neuron.lua index 9dc1d45..23c752f 100644 --- a/Neuron.lua +++ b/Neuron.lua @@ -104,9 +104,9 @@ Neuron.SNAPTO_TOLLERANCE = 28 Neuron.enteredWorld = false --flag that gets set when the player enters the world. It's used primarily for throttling events so that the player doesn't crash on logging with too many processes if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then --boolean check to set a flag if the current session is WoW Classic. Retail == 1, Classic == 2 + Neuron.isWoWClassicEra = true +elseif WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC then Neuron.isWoWClassic = true -elseif WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC then - Neuron.isWoWClassic_TBC = true end Neuron.activeSpec = 1 @@ -203,7 +203,7 @@ function Neuron:OnEnable() end --set current spec before loading bars and buttons - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then Neuron.activeSpec = GetSpecialization() end @@ -353,7 +353,7 @@ function Neuron:LoginMessage() end --Shadowlands warning that will show as long as a player has one button on their ZoneAbilityBar for Shadowlands content - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC and UnitLevel("player") >= 50 and Neuron.db.profile.ZoneAbilityBar[1] and #Neuron.db.profile.ZoneAbilityBar[1].buttons == 1 then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic and UnitLevel("player") >= 50 and Neuron.db.profile.ZoneAbilityBar[1] and #Neuron.db.profile.ZoneAbilityBar[1].buttons == 1 then print(" ") Neuron:Print(WrapTextInColorCode("IMPORTANT: Shadowlands content now requires multiple Zone Ability Buttons. Please add at least 3 buttons to your Zone Ability Bar to support this new functionality.", "FF00FFEC")) print(" ") @@ -439,7 +439,7 @@ function Neuron:UpdateSpellCache() end end - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then for i = 1, select("#", GetProfessions()) do local index = select(i, GetProfessions()) diff --git a/Neuron.toc b/Neuron.toc index 5d33004..8fae0bb 100644 --- a/Neuron.toc +++ b/Neuron.toc @@ -1,6 +1,7 @@ ## Interface: 90207 ## Interface-Classic: 11403 ## Interface-BCC: 20504 +## Interface-Wrath: 30400 ## Title: Neuron ## Notes: A macro-based action bar and object manager add-on ## Author: Britt W. Yazel diff --git a/Objects/ACTIONBUTTON.lua b/Objects/ACTIONBUTTON.lua index c031a62..32c015f 100644 --- a/Objects/ACTIONBUTTON.lua +++ b/Objects/ACTIONBUTTON.lua @@ -130,7 +130,7 @@ function ACTIONBUTTON:SetupEvents() self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateAll") self:RegisterEvent("UNIT_PET", "UpdateAll") - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") self:RegisterEvent("EQUIPMENT_SETS_CHANGED") @@ -469,7 +469,7 @@ function ACTIONBUTTON:UpdateAll() --pass to parent UpdateAll function Neuron.BUTTON.UpdateAll(self) - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then self:UpdateGlow() end end diff --git a/Objects/ACTIONBUTTON_Flyout.lua b/Objects/ACTIONBUTTON_Flyout.lua index 69a7745..ab8fcb5 100644 --- a/Objects/ACTIONBUTTON_Flyout.lua +++ b/Objects/ACTIONBUTTON_Flyout.lua @@ -742,13 +742,13 @@ function ACTIONBUTTON:GetDataList(options) scanData = self:filter_spell(tooltip) elseif types:find("^i") then --Item scanData = self:filter_item(tooltip) - elseif types:find("^c") and not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then --Companion + elseif types:find("^c") and not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --Companion scanData = self:filter_pet() - elseif types:find("^f") and not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then --toy + elseif types:find("^f") and not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --toy scanData = self:filter_toy() elseif types:find("^m") then --Mount scanData = self:filter_mount() - elseif types:find("^p") and not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then --Profession + elseif types:find("^p") and not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --Profession scanData = self:filter_profession() elseif types:find("^t") then --Item Type scanData = self:filter_type() diff --git a/Objects/BAGBTN.lua b/Objects/BAGBTN.lua index 674311e..5508998 100644 --- a/Objects/BAGBTN.lua +++ b/Objects/BAGBTN.lua @@ -7,7 +7,7 @@ local BAGBTN = setmetatable({}, {__index = Neuron.BUTTON}) Neuron.BAGBTN = BAGBTN -if Neuron.isWoWClassic or Neuron.isWoWClassic_TBC then +if Neuron.isWoWClassicEra or Neuron.isWoWClassic then Neuron.NUM_BAG_BUTTONS = 6 else Neuron.NUM_BAG_BUTTONS = 5 @@ -15,7 +15,7 @@ end local blizzBagButtons -if Neuron.isWoWClassic or Neuron.isWoWClassic_TBC then +if Neuron.isWoWClassicEra or Neuron.isWoWClassic then blizzBagButtons = { KeyRingButton, --wow classic has a keyring button CharacterBag3Slot, @@ -58,7 +58,7 @@ function BAGBTN:SetType() self.hookedButton:ClearAllPoints() self.hookedButton:SetParent(self) self.hookedButton:Show() - if (Neuron.isWoWClassic or Neuron.isWoWClassic_TBC) and self.id==1 then --the keyring button should be aligned to the right because it's only 1/3 the width of the other bag buttons + if (Neuron.isWoWClassicEra or Neuron.isWoWClassic) and self.id==1 then --the keyring button should be aligned to the right because it's only 1/3 the width of the other bag buttons self.hookedButton:SetPoint("RIGHT", self, "RIGHT") else self.hookedButton:SetPoint("CENTER", self, "CENTER") diff --git a/Objects/BUTTON.lua b/Objects/BUTTON.lua index 558158a..724812a 100644 --- a/Objects/BUTTON.lua +++ b/Objects/BUTTON.lua @@ -755,7 +755,7 @@ function BUTTON:UpdateUsableItem() --for some reason toys don't show as usable items, so this is a workaround for that if not isUsable then local itemID = GetItemInfoInstant(self.item) - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC and itemID and PlayerHasToy(itemID) then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic and itemID and PlayerHasToy(itemID) then isUsable = true end end diff --git a/Objects/MENUBTN.lua b/Objects/MENUBTN.lua index 38c225b..25149f2 100644 --- a/Objects/MENUBTN.lua +++ b/Objects/MENUBTN.lua @@ -20,7 +20,7 @@ local blizzMenuButtons = { StoreMicroButton, MainMenuMicroButton} -if Neuron.isWoWClassic or Neuron.isWoWClassic_TBC then +if Neuron.isWoWClassicEra or Neuron.isWoWClassic then wipe(blizzMenuButtons) for i=1, #MICRO_BUTTONS do blizzMenuButtons[i] = _G[MICRO_BUTTONS[i]] @@ -47,8 +47,8 @@ end --------------------------------------------------------- function MENUBTN:SetType() - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then - if not self:IsEventRegistered("PET_BATTLE_CLOSE") and not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then --only run this code on the first SetType, not the reloads after pet battles and such + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then + if not self:IsEventRegistered("PET_BATTLE_CLOSE") and not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --only run this code on the first SetType, not the reloads after pet battles and such self:RegisterEvent("PET_BATTLE_CLOSE") end diff --git a/Objects/PETBTN.lua b/Objects/PETBTN.lua index cded6fc..e4805ad 100644 --- a/Objects/PETBTN.lua +++ b/Objects/PETBTN.lua @@ -40,7 +40,7 @@ function PETBTN:SetType() self:RegisterEvent("PLAYER_CONTROL_GAINED", "UpdateData") self:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED", "UpdateData") - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then self:RegisterEvent("PET_SPECIALIZATION_CHANGED", "PLAYER_ENTERING_WORLD") end diff --git a/Objects/STATUSBTN.lua b/Objects/STATUSBTN.lua index 2bb0865..af90275 100644 --- a/Objects/STATUSBTN.lua +++ b/Objects/STATUSBTN.lua @@ -302,7 +302,7 @@ function STATUSBTN:xpDropDown_Initialize() -- initialize the dropdown menu for c }) --wow classic doesn't have Honor points nor Azerite, carefull - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then if C_Covenants.GetActiveCovenantID() ~= 0 then table.insert(menu, { @@ -444,7 +444,7 @@ function STATUSBTN:repstrings_Update(repGainedString) if (not isHeader or hasRep) and not IsFactionInactive(i) then local friendID, standing, isParagon - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then --classic doesn't have Friendships or Paragon, carefull + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then --classic doesn't have Friendships or Paragon, carefull friendID, _, _, _, _, _, standing, _, _ = GetFriendshipReputation(factionID) isParagon = C_Reputation.IsFactionParagon(factionID) end @@ -529,7 +529,10 @@ function STATUSBTN:repDropDown_Initialize() --Initialize the dropdown menu for c for k,v in pairs(RepWatch) do --insert all factions and percentages into "data" if k > 0 then --skip the "0" entry which is our autowatch - if not repDataTable[v.header]then + if not v.header then --classic doesn't have headers, so this will give us a default header + v.header = "Core" + end + if not repDataTable[v.header] then repDataTable[v.header] = {} end table.insert(repDataTable[v.header], { ID=v.ID, name=v.name, standing=v.standing, percent=v.percent, hex=v.hex}) @@ -814,7 +817,7 @@ function STATUSBTN:CastBar_OnEvent(event, ...) local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo(unit) elseif unit == "player" then name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = CastingInfo() --classic doesn't have UnitCastingInfo() @@ -878,7 +881,7 @@ function STATUSBTN:CastBar_OnEvent(event, ...) local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo(unit) elseif unit == "player" then name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = ChannelInfo() @@ -973,7 +976,7 @@ function STATUSBTN:CastBar_OnEvent(event, ...) local name, text, texture, startTime, endTime, isTradeSkill - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then name, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(unit) elseif unit == "player" then name, text, texture, startTime, endTime, isTradeSkill = CastingInfo() --Classic doesn't have UnitCastingInfo() @@ -1009,7 +1012,7 @@ function STATUSBTN:CastBar_OnEvent(event, ...) local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo(unit) elseif unit == "player" then name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = ChannelInfo() @@ -1859,7 +1862,7 @@ function STATUSBTN:SetType() self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", "CastBar_OnEvent") self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", "CastBar_OnEvent") - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", "CastBar_OnEvent") self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "CastBar_OnEvent") end @@ -1897,7 +1900,7 @@ function STATUSBTN:SetType() self:RegisterEvent("PLAYER_ENTERING_WORLD", "XPBar_OnEvent") self:RegisterEvent("PLAYER_EQUIPMENT_CHANGED", "XPBar_OnEvent") - if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then + if not Neuron.isWoWClassicEra and not Neuron.isWoWClassic then self:RegisterEvent("HONOR_XP_UPDATE", "XPBar_OnEvent") self:RegisterEvent("COVENANT_SANCTUM_RENOWN_LEVEL_CHANGED", "XPBar_OnEvent") self:RegisterEvent("AZERITE_ITEM_EXPERIENCE_CHANGED", "XPBar_OnEvent")