diff --git a/.luacheckrc b/.luacheckrc index ffe2831..f5e1750 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -508,6 +508,8 @@ new_read_globals = { 'CreateTexturePool', 'EditBox_ClearFocus', 'EquipmentManager_UnpackLocation', + 'EventRegistry.RegisterCallback', + 'EventRegistry.TriggerEvent', 'ExportUtil.MakeImportDataStream', 'FindSpellOverrideByID', 'FlagsUtil.IsSet', diff --git a/ActionBars.lua b/ActionBars.lua index a06d531..8617b87 100644 --- a/ActionBars.lua +++ b/ActionBars.lua @@ -745,7 +745,11 @@ local function RefreshActionBarSet(set) set.actions = actions - return UpdateSetFilters(set) + UpdateSetFilters(set) + + Internal.Call("ActionBarSetUpdated", set.setID); + + return set end local function AddActionBarSet() local classFile = select(2, UnitClass("player")) @@ -766,11 +770,13 @@ local function AddActionBarSet() ignored[slot] = true end - return Internal.AddSet(BtWLoadoutsSets.actionbars, UpdateSetFilters({ + local set = Internal.AddSet(BtWLoadoutsSets.actionbars, UpdateSetFilters({ name = name, ignored = ignored, actions = actions, })) + Internal.Call("ActionBarSetCreated", set.setID); + return set end local function GetActionBarSet(id) local set = Internal.GetSet(BtWLoadoutsSets.actionbars, id) @@ -833,6 +839,8 @@ local function DeleteActionBarSet(id) end end end + + Internal.Call("ActionBarSetDeleted", id); local frame = BtWLoadoutsFrame.ActionBars; local set = frame.set; @@ -1007,6 +1015,8 @@ function BtWLoadoutsActionButtonMixin:SetAction(actionType, ...) local set = self:GetActionBarFrame().set; if actionType == nil then -- Clearing slot set.actions[self:GetID()] = nil; + + Internal.Call("ActionBarSetUpdated", set.setID); self:Update(); return true; @@ -1016,12 +1026,15 @@ function BtWLoadoutsActionButtonMixin:SetAction(actionType, ...) tbl.type, tbl.id, tbl.subType, tbl.icon, tbl.name, tbl.macroText = actionType, ... set.actions[self:GetID()] = tbl; + + Internal.Call("ActionBarSetUpdated", set.setID); self:Update() end end function BtWLoadoutsActionButtonMixin:SetIgnored(ignored) local set = self:GetActionBarFrame().set; set.ignored[self:GetID()] = ignored and true or nil; + Internal.Call("ActionBarSetUpdated", set.setID); self:Update(); end function BtWLoadoutsActionButtonMixin:Update() @@ -1147,6 +1160,8 @@ function BtWLoadoutsIgnoreActionBarMixin:OnClick() set.ignored[id] = setIgnored self:GetParent().Slots[id]:Update() end + + Internal.Call("ActionBarSetUpdated", set.setID); end local function DropDown_Initialize(self, level, menuList) @@ -1160,6 +1175,8 @@ local function DropDown_Initialize(self, level, menuList) info.func = function (self, arg1, arg2, checked) set.settings = set.settings or {} set.settings.adjustCovenant = not checked + + Internal.Call("ActionBarSetUpdated", set.setID); BtWLoadoutsFrame:Update() end @@ -1172,6 +1189,8 @@ local function DropDown_Initialize(self, level, menuList) set.settings = set.settings or {} set.settings.createMissingMacros = not checked set.settings.createMissingMacrosCharacter = false + + Internal.Call("ActionBarSetUpdated", set.setID); BtWLoadoutsFrame:Update() end @@ -1184,6 +1203,8 @@ local function DropDown_Initialize(self, level, menuList) set.settings = set.settings or {} set.settings.createMissingMacrosCharacter = not checked set.settings.createMissingMacros = false + + Internal.Call("ActionBarSetUpdated", set.setID); BtWLoadoutsFrame:Update() end @@ -1205,6 +1226,8 @@ BtWLoadoutsActionBarsMixin = {} function BtWLoadoutsActionBarsMixin:OnLoad() self.SettingsDropDown:SetSupportedTypes("covenant", "spec", "race") self.SettingsDropDown:SetScript("OnChange", function () + Internal.Call("ActionBarSetUpdated", self.set.setID); + self:Update() end) end @@ -1218,6 +1241,7 @@ end function BtWLoadoutsActionBarsMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; + Internal.Call("ActionBarSetUpdated", self.set.setID); self:Update(); end end diff --git a/BtWLoadouts.lua b/BtWLoadouts.lua index 065f0e9..d236805 100644 --- a/BtWLoadouts.lua +++ b/BtWLoadouts.lua @@ -1943,6 +1943,12 @@ function BtWLoadoutsTalentButtonMixin:OnClick() selected[talentID] = true; end + if self.isPvP then + Internal.Call("PvPTalentSetUpdated", frame.set.setID); + else + Internal.Call("TalentSetUpdated", frame.set.setID); + end + grid:Update() end function BtWLoadoutsTalentButtonMixin:OnEnter() @@ -2125,25 +2131,11 @@ end -- [[ CUSTOM EVENT HANDLING ]] -local eventHandlers = {} function Internal.OnEvent(event, callback) - if not eventHandlers[event] then - eventHandlers[event] = {} - end - - eventHandlers[event][callback] = true + EventRegistry:RegisterCallback("BtWLoadouts." .. event, callback); end function Internal.Call(event, ...) - local callbacks = eventHandlers[event] - local result = true - if callbacks then - for callback in pairs(callbacks) do - if callback(event, ...) == false then - result = false - end - end - end - return result + EventRegistry:TriggerEvent("BtWLoadouts." .. event, ...); end -- [[ Slash Command ]] diff --git a/Characters.lua b/Characters.lua index a9ae49f..530b77d 100644 --- a/Characters.lua +++ b/Characters.lua @@ -8413,7 +8413,7 @@ do end end function Internal.DeleteCharacter(slug) - if Internal.Call("CHARACTER_DELETE", slug) then + if Internal.Call("CharacterDeleted", slug) then BtWLoadoutsCharacterInfo[slug] = nil end BtWLoadoutsFrame:Update(); diff --git a/Conditions.lua b/Conditions.lua index 9c5478e..6860917 100644 --- a/Conditions.lua +++ b/Conditions.lua @@ -297,6 +297,8 @@ local function RefreshConditionSet(set) UpdateSetFilters(set) + Internal.Call("ConditionUpdated", set.setID); + return set end local function AddConditionSet() @@ -310,6 +312,9 @@ local function AddConditionSet() }; UpdateSetFilters(set) BtWLoadoutsSets.conditions[set.setID] = set; + + Internal.Call("ConditionCreated", set.setID); + return set; end local function GetConditionSet(id) @@ -329,6 +334,8 @@ local function DeleteConditionSet(id) id = id.setID; end + Internal.Call("ConditionDeleted", id); + local frame = BtWLoadoutsFrame.Conditions; set = frame.set; if set.setID == id then @@ -590,6 +597,8 @@ local function ProfilesDropDown_OnClick(self, arg1, arg2, checked) set.character = tab.temp["NONE"] or shallowcopy(set.character) end + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function ProfilesDropDown_NewOnClick(self, arg1, arg2, checked) @@ -611,6 +620,8 @@ local function ProfilesDropDown_NewOnClick(self, arg1, arg2, checked) subset.useCount = (subset.useCount or 0) + 1; end + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame.Profiles.set = newSet; PanelTemplates_SetTab(BtWLoadoutsFrame, BtWLoadoutsFrame.Profiles:GetID()); @@ -732,6 +743,8 @@ local function ConditionTypeDropDown_OnClick(self, arg1, arg2, checked) set.bossID = nil; set.affixesID = nil; + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function ConditionTypeDropDownInit(self, level, menuList) @@ -782,6 +795,8 @@ local function InstanceDropDown_OnClick(self, arg1, arg2, checked) set.affixesID = nil; end + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function InstanceDropDownInit(self, level, menuList) @@ -854,6 +869,8 @@ local function DifficultyDropDown_OnClick(self, arg1, arg2, checked) set.affixesID = nil; end + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function DifficultyDropDownInit(self, level, menuList) @@ -923,6 +940,8 @@ local function BossDropDown_OnClick(self, arg1, arg2, checked) set.bossID = arg1; + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function BossDropDownInit(self, level, menuList) @@ -959,6 +978,8 @@ local function ScenarioDropDown_OnClick(self, arg1, arg2, checked) set.instanceID = arg1; set.difficultyID = arg2; + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function ScenarioDropDownInit(self, level, menuList) @@ -1002,6 +1023,8 @@ local function BattlegroundDropDown_OnClick(self, arg1, arg2, checked) set.instanceID = arg1; set.difficultyID = arg2; + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function BattlegroundDropDownInit(self, level, menuList) @@ -1049,6 +1072,8 @@ local function AffixDropDown_OnClick(self, arg1, arg2, checked) set.affixesID = nil end + Internal.Call("ConditionUpdated", set.setID); + BtWLoadoutsFrame:Update(); end @@ -1144,6 +1169,8 @@ function BtWLoadoutsConditionsMixin:OnShow() end end + Internal.Call("ConditionUpdated", frame.set.setID); + BtWLoadoutsFrame:Update() end end @@ -1192,12 +1219,16 @@ end function BtWLoadoutsConditionsMixin:UpdateSetEnabled(value) if self.set and self.set.disabled ~= value then self.set.disabled = value; + Internal.Call("ConditionUpdated", self.set.setID); self:Update(); end end function BtWLoadoutsConditionsMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; + + Internal.Call("ConditionUpdated", self.set.setID); + self:Update(); end end @@ -1219,6 +1250,9 @@ function BtWLoadoutsConditionsMixin:UpdateSetZone(value) if valid then --@TODO invalid zone? end + + Internal.Call("ConditionUpdated", self.set.setID); + self:Update(); end end diff --git a/DFTalents.lua b/DFTalents.lua index 7602b51..0be204f 100644 --- a/DFTalents.lua +++ b/DFTalents.lua @@ -20,7 +20,7 @@ BTWLOADOUTS_CLASS_TREE = " < " .. L["Class Tree"]; --@NOTE Copying parts of the original talents code over. Dont want to use wrong mixin local BtWLoadoutsTalentsMixin = false -Internal.OnEvent("LOADOUT_CHANGE_END", function () +Internal.OnEvent("LoadoutActivateEnd", function () if C_Traits then local configID = C_ClassTalents.GetActiveConfigID(); if configID then @@ -120,6 +120,8 @@ local function RefreshSet(set) end end set.nodes = nodes; + + Internal.Call("DFTalentSetUpdated", set.setID); return UpdateSetFilters(set) end @@ -130,13 +132,15 @@ local function AddSet() end local classID = select(3, UnitClass("player")) local specID, specName = GetSpecializationInfo(specIndex); - return Internal.AddSet("dftalents", RefreshSet({ + local set = Internal.AddSet("dftalents", RefreshSet({ classID = classID, specID = specID, name = format(L["New %s Set"], specName), useCount = 0, nodes = {}, })) + Internal.Call("DFTalentSetCreated", set.setID); + return set end local function DeleteSet(id) Internal.DeleteSet(BtWLoadoutsSets.dftalents, id); @@ -153,6 +157,8 @@ local function DeleteSet(id) end end end + + Internal.Call("DFTalentSetDeleted", id); local frame = BtWLoadoutsFrame.DFTalents; local set = frame.set; @@ -628,6 +634,7 @@ function BtWLoadoutsDFTalentsMixin:OnLoad() self.Scroll:RegisterForDrag("LeftButton"); self.RestrictionsDropDown:SetSupportedTypes("race") self.RestrictionsDropDown:SetScript("OnChange", function () + Internal.Call("DFTalentSetUpdated", self.set.setID); self:Update() end) @@ -686,6 +693,8 @@ function BtWLoadoutsDFTalentsMixin:OnShow() set.treeID = result.ID; set.nodes = temp[set.specID] or {}; + + Internal.Call("DFTalentSetUpdated", set.setID); self:Update(true); end @@ -711,6 +720,7 @@ function BtWLoadoutsDFTalentsMixin:UpdateSetName(value) return end self.set.name = value; + Internal.Call("DFTalentSetUpdated", self.set.setID); self:Update(false, true); end end @@ -1365,6 +1375,7 @@ function BtWLoadoutsDFTalentsMixin:PurchaseRank(nodeID) if nodeInfo.maxRanks > nodeInfo.activeRank then self.set.nodes[nodeID] = (self.set.nodes[nodeID] or 0) + 1; end + Internal.Call("DFTalentSetUpdated", self.set.setID); -- self:MarkNodeDirty(nodeID); -- self:RefreshButtons() self:Update(); @@ -1379,6 +1390,7 @@ function BtWLoadoutsDFTalentsMixin:RefundRank(nodeID) if self.set.nodes[nodeID] <= 0 then self.set.nodes[nodeID] = nil; end + Internal.Call("DFTalentSetUpdated", self.set.setID); -- self:MarkNodeDirty(nodeID); self:Update(); end @@ -1401,6 +1413,7 @@ function BtWLoadoutsDFTalentsMixin:SetSelection(nodeID, entryID) end end end + Internal.Call("DFTalentSetUpdated", self.set.setID); -- self:MarkNodeDirty(nodeID); self:Update(); end @@ -1441,7 +1454,7 @@ local function GetSetsForCharacter(tbl, slug) return tbl end -- Character deletion -Internal.OnEvent("CHARACTER_DELETE", function (event, slug) +Internal.OnEvent("CharacterDeleted", function (event, slug) local sets = GetSetsForCharacter({}, slug) for _,set in ipairs(sets) do DeleteSet(set.setID) diff --git a/Equipment.lua b/Equipment.lua index 0c529ef..8a0a626 100644 --- a/Equipment.lua +++ b/Equipment.lua @@ -1326,7 +1326,11 @@ local function RefreshEquipmentSet(set) C_EquipmentSet.SaveEquipmentSet(set.managerID) end - return UpdateSetFilters(set) + UpdateSetFilters(set) + + Internal.Call("EquipmentSetUpdated", set.setID); + + return set end local function AddEquipmentSet() local characterName, characterRealm = UnitFullName("player"); @@ -1344,6 +1348,7 @@ local function AddEquipmentSet() data = {}, })) AddSetToMapData(result) + Internal.Call("EquipmentSetCreated", result.setID); return result end local function GetEquipmentSetsByName(name) @@ -1457,6 +1462,8 @@ local function DeleteEquipmentSet(id) set.character = nil end end + + Internal.Call("EquipmentSetDeleted", id); local frame = BtWLoadoutsFrame.Equipment; local set = frame.set; @@ -1726,6 +1733,7 @@ function BtWLoadoutsItemSlotButtonMixin:SetItem(itemLink, bag, slot) Internal.UpdateEquipmentSetItemInMapData(set, self:GetID(), previousLocation, nil) + Internal.Call("EquipmentSetUpdated", set.setID); self:Update(); return true; else @@ -1764,6 +1772,8 @@ function BtWLoadoutsItemSlotButtonMixin:SetItem(itemLink, bag, slot) set.data[self:GetID()] = EncodeItemData(itemLink, set.extras[self:GetID()] and set.extras[self:GetID()].azerite); Internal.UpdateEquipmentSetItemInMapData(set, self:GetID(), previousLocation, set.locations[self:GetID()]) + + Internal.Call("EquipmentSetUpdated", set.setID); BtWLoadoutsFrame:Update(); -- Refresh everything, this'll update the error handling too return true; @@ -1774,6 +1784,7 @@ end function BtWLoadoutsItemSlotButtonMixin:SetIgnored(ignored) local set = self:GetParent().set; set.ignored[self:GetID()] = ignored and true or nil; + Internal.Call("EquipmentSetUpdated", set.setID); BtWLoadoutsFrame:Update(); -- Refresh everything, this'll update the error handling too end function BtWLoadoutsItemSlotButtonMixin:Update() @@ -1825,6 +1836,7 @@ BtWLoadoutsEquipmentMixin = {} function BtWLoadoutsEquipmentMixin:OnLoad() self.RestrictionsDropDown:SetSupportedTypes("covenant", "spec", "race") self.RestrictionsDropDown:SetScript("OnChange", function () + Internal.Call("EquipmentSetUpdated", self.set.setID); self:Update() end) end @@ -3039,7 +3051,7 @@ if LibStub and LibStub:GetLibrary("LibItemSearch-1.2", true) then end -- Character deletion -Internal.OnEvent("CHARACTER_DELETE", function (event, slug) +Internal.OnEvent("CharacterDeleted", function (event, slug) local sets = GetSetsForCharacter({}, slug) for _,set in ipairs(sets) do DeleteEquipmentSet(set.setID) diff --git a/Essences.lua b/Essences.lua index d328710..6893983 100644 --- a/Essences.lua +++ b/Essences.lua @@ -109,16 +109,22 @@ local function RefreshEssenceSet(set) set.essences = essences - return UpdateSetFilters(set) + UpdateSetFilters(set) + + Internal.Call("EssenceSetUpdated", set.setID); + + return set end local function AddEssenceSet() local role = select(5,GetSpecializationInfo(GetSpecialization())); - return AddSet("essences", RefreshEssenceSet({ + local set = AddSet("essences", RefreshEssenceSet({ role = role, name = format(L["New %s Set"], _G[role]); useCount = 0, essences = {}, })) + Internal.Call("EssenceSetCreated", set.setID); + return set end local function GetEssenceSetsByName(name) return Internal.GetSetsByName("essences", name) @@ -242,6 +248,8 @@ local function DeleteEssenceSet(id) end end end + + Internal.Call("EssenceSetDeleted", id); local frame = BtWLoadoutsFrame.Essences; local set = frame.set; @@ -391,6 +399,8 @@ function BtWLoadoutsAzeriteMilestoneSlotMixin:OnClick() selected[self.milestoneID] = nil; end + Internal.Call("EssenceSetUpdated", essences.set.setID); + BtWLoadoutsFrame:Update(); end @@ -443,6 +453,8 @@ local function RoleDropDown_OnClick(self, arg1, arg2, checked) end end + Internal.Call("EssenceSetUpdated", set.setID); + BtWLoadoutsFrame:Update(); end local function RoleDropDownInit(self, level, menuList) @@ -505,6 +517,7 @@ BtWLoadoutsEssencesMixin = {} function BtWLoadoutsEssencesMixin:OnLoad() self.RestrictionsDropDown:SetSupportedTypes("spec", "race") self.RestrictionsDropDown:SetScript("OnChange", function () + Internal.Call("EssenceSetUpdated", self.set.setID); self:Update() end) @@ -537,6 +550,7 @@ end function BtWLoadoutsEssencesMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; + Internal.Call("EssenceSetUpdated", self.set.setID); self:Update(); end end diff --git a/Events.lua b/Events.lua index c1ea7d8..9711445 100644 --- a/Events.lua +++ b/Events.lua @@ -536,6 +536,7 @@ function frame:EQUIPMENT_SETS_CHANGED(...) if isNewSet then Internal.AddEquipmentSetToMapData(set) + Internal.Call("EquipmentSetCreated", set.setID); end equipmentSetMap[managerID] = set; diff --git a/Loadouts.lua b/Loadouts.lua index 2611dc5..7ce8844 100644 --- a/Loadouts.lua +++ b/Loadouts.lua @@ -97,12 +97,13 @@ local function CancelActivateProfile() uiErrorTracking = nil end) + local setID = target.setID wipe(target); wipe(targetstate); HideLoadoutPopups() eventHandler:UnregisterAllEvents(); eventHandler:Hide(); - Internal.Call("LOADOUT_CHANGE_END") + Internal.Call("LoadoutActivateEnd", setID) Internal.LogMessage("--- END ---") end Internal.CancelActivateProfile = CancelActivateProfile; @@ -232,7 +233,11 @@ local function AddProfile() set[segment.id] = {} end - return AddSet("profiles", UpdateSetFilters(set)) + local set = AddSet("profiles", UpdateSetFilters(set)); + + Internal.Call("LoadoutCreated", set.setID); + + return set; end local function GetProfile(id) return BtWLoadoutsSets.profiles[id]; @@ -267,8 +272,12 @@ local function DeleteProfile(id) superset.profileSet = nil; end end + + id = set.setID; end DeleteSet(BtWLoadoutsSets.profiles, id); + + Internal.Call("LoadoutDeleted", id); local frame = BtWLoadoutsFrame.Loadouts; local set = frame.set; @@ -284,6 +293,7 @@ local function ActivateProfile(profile) return; end + target.setID = profile.setID target.name = profile.name target.state = targetstate @@ -302,12 +312,12 @@ local function ActivateProfile(profile) end if not target.active then - Internal.Call("LOADOUT_CHANGE_START") + Internal.Call("LoadoutActivateStart", target.setID) Internal.ClearLog() Internal.LogMessage("--- START ---") Internal.LogMessage(format("%s: %s", (select(2, GetAddOnInfo(ADDON_NAME))), (GetAddOnMetadata(ADDON_NAME, "Version")))) else - Internal.Call("LOADOUT_CHANGE_APPEND") + Internal.Call("LoadoutActivateAppend", target.setID) Internal.LogMessage("--- APPEND ---") end @@ -1024,6 +1034,8 @@ function BtWLoadoutsSetsScrollListItemMixin:OnEnter() frame.set[a.type][a.index], frame.set[a.type][b.index] = frame.set[a.type][b.index], frame.set[a.type][a.index] a.index, b.index = b.index, a.index + Internal.Call("LoadoutUpdated", frame.set.setID); + -- Update the buttons with the flipped sets self:Set(b) currentDrag:Set(a) @@ -1077,6 +1089,8 @@ function BtWLoadoutsSetsScrollListItemMixin:Remove() assert(type(set[self.type]) == "table" and index ~= nil and index >= 1 and index <= #set[self.type]) table.remove(set[self.type], index); + Internal.Call("LoadoutUpdated", set.setID); + tab:Update() end function BtWLoadoutsSetsScrollListItemMixin:MoveUp() @@ -1087,6 +1101,8 @@ function BtWLoadoutsSetsScrollListItemMixin:MoveUp() assert(type(set[self.type]) == "table" and index > 1 and index <= #set[self.type]) set[self.type][index-1], set[self.type][index] = set[self.type][index], set[self.type][index-1] + Internal.Call("LoadoutUpdated", set.setID); + tab:Update() end function BtWLoadoutsSetsScrollListItemMixin:MoveDown() @@ -1097,6 +1113,8 @@ function BtWLoadoutsSetsScrollListItemMixin:MoveDown() assert(type(set[self.type]) == "table" and index >= 1 and index < #set[self.type]) set[self.type][index+1], set[self.type][index] = set[self.type][index], set[self.type][index+1] + Internal.Call("LoadoutUpdated", set.setID); + tab:Update() end @@ -1249,6 +1267,8 @@ function BtWLoadoutsLoadoutsMixin:OnShow() classFile = set.specID and select(6, GetSpecializationInfoByID(set.specID)) set.character = self.temp[classFile or "NONE"] or shallowcopy(set.character) + Internal.Call("LoadoutUpdated", set.setID) + self:Update() end end @@ -1277,6 +1297,8 @@ function BtWLoadoutsLoadoutsMixin:OnShow() frame.set.character[arg1] = true end + Internal.Call("LoadoutUpdated", frame.set.setID) + BtWLoadoutsFrame:Update() end end @@ -1294,6 +1316,7 @@ end function BtWLoadoutsLoadoutsMixin:UpdateSetEnabled(value) if self.set and self.set.disabled ~= not value then self.set.disabled = not value; + Internal.Call("LoadoutUpdated", self.set.setID) self:Update(); end end @@ -1301,6 +1324,7 @@ function BtWLoadoutsLoadoutsMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; BtWLoadoutsHelpTipFlags["TUTORIAL_RENAME_SET"] = true + Internal.Call("LoadoutUpdated", self.set.setID) self:Update(); end end diff --git a/Minimap.lua b/Minimap.lua index c6e0e97..9b5828d 100644 --- a/Minimap.lua +++ b/Minimap.lua @@ -202,10 +202,10 @@ function BtWLoadoutsMinimapMenu_Init(self, level, menuList) end end -Internal.OnEvent("LOADOUT_CHANGE_START", function () +Internal.OnEvent("LoadoutActivateStart", function () BtWLoadoutsMinimapButton.ProgressAnim:Play() end) -Internal.OnEvent("LOADOUT_CHANGE_END", function () +Internal.OnEvent("LoadoutActivateEnd", function () BtWLoadoutsMinimapButton.ProgressAnim:Stop() end) diff --git a/PvPTalents.lua b/PvPTalents.lua index 730af7f..c5f65dc 100644 --- a/PvPTalents.lua +++ b/PvPTalents.lua @@ -212,6 +212,8 @@ local function RefreshPvPTalentSet(set) end set.talents = talents + + Internal.Call("PvPTalentSetUpdated", set.setID); return UpdateSetFilters(set) end @@ -221,12 +223,14 @@ local function AddPvPTalentSet() specIndex = 1 end local specID, specName = GetSpecializationInfo(specIndex); - return AddSet("pvptalents", RefreshPvPTalentSet({ + local set = AddSet("pvptalents", RefreshPvPTalentSet({ specID = specID, name = format(L["New %s Set"], specName), useCount = 0, talents = {}, })) + Internal.Call("PvPTalentSetCreated", set.setID); + return set end local function GetPvPTalentSetsByName(name) return Internal.GetSetsByName("pvptalents", name) @@ -288,6 +292,8 @@ local function DeletePvPTalentSet(id) end end end + + Internal.Call("PvPTalentSetDeleted", id); local frame = BtWLoadoutsFrame.PvPTalents; local set = frame.set; @@ -400,6 +406,7 @@ BtWLoadoutsPvPTalentsMixin = {} function BtWLoadoutsPvPTalentsMixin:OnLoad() self.RestrictionsDropDown:SetSupportedTypes("covenant", "race") self.RestrictionsDropDown:SetScript("OnChange", function () + Internal.Call("PvPTalentSetUpdated", self.set.setID); self:Update() end) @@ -449,6 +456,8 @@ function BtWLoadoutsPvPTalentsMixin:OnShow() end end + Internal.Call("PvPTalentSetUpdated", self.set.setID); + self:Update() end end @@ -464,6 +473,7 @@ end function BtWLoadoutsPvPTalentsMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; + Internal.Call("PvPTalentSetUpdated", self.set.setID); self:Update(); end end diff --git a/Sets.lua b/Sets.lua index a44968f..9d24434 100644 --- a/Sets.lua +++ b/Sets.lua @@ -167,6 +167,8 @@ local function SetDropDownInit(self, set, index, segment, tab) self:SetSelected(set[segment][index]) + Internal.Call("LoadoutUpdated", set.setID); + CloseDropDownMenus() BtWLoadoutsFrame:Update(); end) diff --git a/Soulbinds.lua b/Soulbinds.lua index 7f8dc3e..199ddcc 100644 --- a/Soulbinds.lua +++ b/Soulbinds.lua @@ -125,12 +125,14 @@ local function AddSet() soulbindID = 7 -- Default to pelagos because why not end local soulbindData = GetSoulbindData(soulbindID) - return Internal.AddSet("soulbinds", RefreshSet({ + local set = Internal.AddSet("soulbinds", RefreshSet({ soulbindID = soulbindID, name = format(L["New %s Set"], soulbindData.name), useCount = 0, nodes = {}, })) + Internal.Call("SoulbindSetCreated", set.setID); + return set end local function DeleteSet(id) Internal.DeleteSet(BtWLoadoutsSets.soulbinds, id); @@ -147,6 +149,8 @@ local function DeleteSet(id) end end end + + Internal.Call("SoulbindSetDeleted", id); local frame = BtWLoadoutsFrame.Soulbinds; local set = frame.set; @@ -3041,6 +3045,7 @@ BtWLoadoutsSoulbindsMixin = {} function BtWLoadoutsSoulbindsMixin:OnLoad() self.RestrictionsDropDown:SetSupportedTypes("spec", "race") self.RestrictionsDropDown:SetScript("OnChange", function () + Internal.Call("SoulbindSetUpdated", self.set.setID); self:Update() end) @@ -3111,6 +3116,8 @@ function BtWLoadoutsSoulbindsMixin:OnShow() self.tempConduits = {} end + Internal.Call("SoulbindSetUpdated", set.setID); + self:Update() end end @@ -3155,6 +3162,8 @@ function BtWLoadoutsSoulbindsMixin:OnShow() end end + Internal.Call("SoulbindSetUpdated", set.setID); + self:Update() end end @@ -3169,6 +3178,7 @@ end function BtWLoadoutsSoulbindsMixin:UpdateSetName(value) if self.set and self.set.name ~= not value then self.set.name = value; + Internal.Call("SoulbindSetUpdated", self.set.setID); self:Update(); end end @@ -3366,6 +3376,8 @@ function BtWLoadoutsSoulbindsMixin:SetNodeEnabled(nodeID, enabled) end nodes[targetNode.ID] = enabled and true or nil end + + Internal.Call("SoulbindSetUpdated", set.setID); self:Update() end @@ -3394,6 +3406,8 @@ function BtWLoadoutsSoulbindsMixin:SetNodeConduit(nodeID, conduitID) end end conduits[nodeID] = conduitID + + Internal.Call("SoulbindSetUpdated", self.set.setID); self:Update() diff --git a/Talents.lua b/Talents.lua index fd03518..d92c78f 100644 --- a/Talents.lua +++ b/Talents.lua @@ -49,21 +49,21 @@ do -- Filter chat spam return false, msg, ... end - Internal.OnEvent("LOADOUT_CHANGE_START", function () + Internal.OnEvent("LoadoutActivateStart", function () ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", ChatFrame_FilterTalentChanges) end) - Internal.OnEvent("LOADOUT_CHANGE_END", function () + Internal.OnEvent("LoadoutActivateEnd", function () ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", ChatFrame_FilterTalentChanges) end) end do -- Prevent new spells from flying to the action bar local WasEventRegistered - Internal.OnEvent("LOADOUT_CHANGE_START", function () + Internal.OnEvent("LoadoutActivateStart", function () WasEventRegistered = IconIntroTracker:IsEventRegistered("SPELL_PUSHED_TO_ACTIONBAR") IconIntroTracker:UnregisterEvent("SPELL_PUSHED_TO_ACTIONBAR") end) - Internal.OnEvent("LOADOUT_CHANGE_END", function () + Internal.OnEvent("LoadoutActivateEnd", function () if WasEventRegistered then IconIntroTracker:RegisterEvent("SPELL_PUSHED_TO_ACTIONBAR") end @@ -192,12 +192,14 @@ local function AddTalentSet() specIndex = 1 end local specID, specName = GetSpecializationInfo(specIndex); - return AddSet("talents", RefreshTalentSet({ + local set = AddSet("talents", RefreshTalentSet({ specID = specID, name = format(L["New %s Set"], specName), useCount = 0, talents = {}, })) + Internal.Call("TalentSetCreated", set.setID); + return set end local function TalentSetDelay(set) for talentID in pairs(set.talents) do @@ -330,6 +332,8 @@ local function DeleteTalentSet(id) end end end + + Internal.Call("TalentSetDeleted", id); local frame = BtWLoadoutsFrame.Talents; local set = frame.set;