diff --git a/.luacheckrc b/.luacheckrc index 3d378bf..a0c4b33 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -91,7 +91,7 @@ stds.wow = { "GossipFrame", "SlashCmdList", "StaticPopupDialogs", - "UnitPopupViewHousesButtonMixin", + "UIPanelWindows", "WardrobeItemModelMixin", "WardrobeItemsCollectionSlotButtonMixin", diff --git a/Art/Housing/HouseListFrame.png b/Art/Housing/HouseListFrame.png index c2472ca..ca52458 100644 Binary files a/Art/Housing/HouseListFrame.png and b/Art/Housing/HouseListFrame.png differ diff --git a/Initialization.lua b/Initialization.lua index 0794ecf..ed67459 100644 --- a/Initialization.lua +++ b/Initialization.lua @@ -1,5 +1,5 @@ -local VERSION_TEXT = "1.9.3"; -local VERSION_DATE = 1782600000; +local VERSION_TEXT = "1.9.3 b"; +local VERSION_DATE = 1782700000; local addonName, addon = ... diff --git a/Locales/enUS.lua b/Locales/enUS.lua index 36abbed..28b9c0a 100755 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -924,6 +924,7 @@ L["ModuleDescription BlizzFixActionBarArt"] = "Fixed an issue where Action Bar A --HouseList L["ModuleName Housing_HouseList"] = "House List"; L["ModuleDescription Housing_HouseList"] = "Improve the House List UI:\n\n- Indicate the house's faction with an image on the right.\n\n- Show both Visit House buttons if the player has two houses."; +L["View Houses In Combat Warning"] = "You cannot view houses while in combat."; --Generic diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua index 4271072..751833d 100755 --- a/Locales/zhCN.lua +++ b/Locales/zhCN.lua @@ -892,6 +892,7 @@ L["ModuleDescription BlizzFixActionBarArt"] = "修复被你隐藏的动作条装 --HouseList L["ModuleName Housing_HouseList"] = "房屋列表"; L["ModuleDescription Housing_HouseList"] = "改进房屋列表界面:\n\n- 用图片展示房屋所属的阵营。\n\n- 如果玩家有两栋房子,直接显示两个“访问住宅”按钮。"; +L["View Houses In Combat Warning"] = "你无法在战斗中查看住宅。"; --Generic diff --git a/Modules/ControlCenter/Changelog/enUS.lua b/Modules/ControlCenter/Changelog/enUS.lua index c187b15..ef25643 100644 --- a/Modules/ControlCenter/Changelog/enUS.lua +++ b/Modules/ControlCenter/Changelog/enUS.lua @@ -10,8 +10,8 @@ local changelogs = addon.ControlCenter.changelogs; changelogs[10903] = { { type = "date", - versionText = "1.9.3", - timestamp = 1782600000, + versionText = "1.9.3 b", + timestamp = 1782700000, }, { @@ -59,6 +59,18 @@ changelogs[10903] = { text = MISCELLANEOUS, }, + { + type = "p", + bullet = true, + text = "Plumber House List: Fixed an issue that prohibited you from clicking Copy Character Name if the View Houses button was also shown on the same context menu.", + }, + + { + type = "p", + bullet = true, + text = "Drawer Macro: Fixed an issue where the Summon Pet buttons didn't work if the text language was set to Spanish.", + }, + { type = "p", bullet = true, diff --git a/Modules/Housing/HouseList.lua b/Modules/Housing/HouseList.lua index e824ae6..bd9c388 100644 --- a/Modules/Housing/HouseList.lua +++ b/Modules/Housing/HouseList.lua @@ -2,6 +2,8 @@ local _, addon = ... local Def = { + FrameName = "PlumberHouseListFrame", + CardWidth = 480, CardHeight = 120, BackgroundWidth = 512, @@ -19,17 +21,26 @@ local Module = {}; do -- HouseListEntry + local NeighborhoodMapXTexCoord = { + --[uiMapID] = {top, bottom}, + + [0] = {304/512, 456/512}, -- Fallback, No Image + [2351] = {0/512, 152/512}, -- Razorwind Shores + [2352] = {152/512, 304/512}, -- Founder's Point + }; + local HouseListEntryMixin = {}; function HouseListEntryMixin:SetHouseInfo(houseInfo) if houseInfo then self.HouseNameText:SetText(houseInfo.houseName); self.HouseOwnerText:SetText(houseInfo.ownerName); - if addon.Housing.IsAllianceNeighborhood(houseInfo.neighborhoodGUID) then - self.Background:SetTexCoord(0, 1, 152/512, 304/512); - else - self.Background:SetTexCoord(0, 1, 0, 152/512); + -- Raeminder: There might be more neighborhood map in the future + local uiMapID = C_Housing.GetUIMapIDForNeighborhood(houseInfo.neighborhoodGUID); + if not (uiMapID and NeighborhoodMapXTexCoord[uiMapID]) then + uiMapID = 0; end + self.Background:SetTexCoord(0, 1, NeighborhoodMapXTexCoord[uiMapID][1], NeighborhoodMapXTexCoord[uiMapID][2]); self.VisitHouseButton:Show(); self.VisitHouseButton:SetupAction(houseInfo.neighborhoodGUID, houseInfo.houseGUID, houseInfo.plotID); else @@ -144,6 +155,10 @@ do end function MainFrameMixin:InitWithContextData(name, guid, bnetID, isGuildMember) + if (not self:IsShown()) and InCombatLockdown() then + addon.API.DisplayErrorMessage(addon.L["View Houses In Combat Warning"]); + end + self.Title:SetText(string.format(VIEW_HOUSES_TITLE, name)); self:OnHouseListUpdated(nil); self.LoadingSpinner:Show(); @@ -159,6 +174,15 @@ do function MainFrameMixin:OnHide() self:UnregisterEvent("VIEW_HOUSES_LIST_RECIEVED"); self.LoadingSpinner:Hide(); + self:StopMovingOrSizing(); + end + + function MainFrameMixin:OnDragStart() + self:StartMoving(); + end + + function MainFrameMixin:OnDragStop() + self:StopMovingOrSizing(); end function MainFrameMixin:OnEvent(event, ...) @@ -203,7 +227,7 @@ do end self:SetHeight(headerHeight + numEntries * (Def.CardEffectiveHeight + Def.CardSpacing) + Def.CardSpacing + 7 + extraHeight); - self:UpdatePosition(); + --self:UpdatePosition(); self:Raise(); end @@ -233,14 +257,15 @@ do function Module.InitMainFrame() if not MainFrame then - local frameName = "PlumberHouseListFrame"; - MainFrame = CreateFrame("Frame", frameName, UIParent, "PlumberHouseListFrameTemplate"); - table.insert(UISpecialFrames, frameName); + MainFrame = CreateFrame("Frame", Def.FrameName, UIParent, "PlumberHouseListFrameTemplate"); + table.insert(UISpecialFrames, Def.FrameName); Mixin(MainFrame, MainFrameMixin); MainFrame.cards = {}; MainFrame:SetScript("OnShow", MainFrame.OnShow); MainFrame:SetScript("OnHide", MainFrame.OnHide); MainFrame:SetScript("OnEvent", MainFrame.OnEvent); + MainFrame:SetScript("OnDragStart", MainFrame.OnDragStart); + MainFrame:SetScript("OnDragStop", MainFrame.OnDragStop); if MainFrame:IsShown() then MainFrame:OnShow(); @@ -273,10 +298,29 @@ do -- Module Control Module.InitWithContextData(name, guid, bnetID, isGuildMember); end + local function RegisterFrame() + -- Since overwriting UnitPopupViewHousesButtonMixin is unsafe + -- We use this less unsafe method by replacing HouseListFrame with ours + + C_AddOns.LoadAddOn("Blizzard_HouseList"); + + UIPanelWindows[Def.FrameName] = { + area = "left", + pushable = 1, + }; + + Module.InitMainFrame(); + if _G[Def.FrameName] then + _G.HouseListFrame = _G[Def.FrameName]; + end + end + local function EnableModule(state) if state then Module.enabled = true; - UnitPopupViewHousesButtonMixin.OnClick = OverrideOnClick; + -- This taint the Menu and prohibits Copy Character Name if View Houses is on the same menu. + --UnitPopupViewHousesButtonMixin.OnClick = OverrideOnClick; + RegisterFrame(); elseif Module.enabled then Module.enabled = false; -- Once tainted, it's irreversible and we ask the user to /reload diff --git a/Modules/Housing/Housing.xml b/Modules/Housing/Housing.xml index 32b955b..5a62717 100644 --- a/Modules/Housing/Housing.xml +++ b/Modules/Housing/Housing.xml @@ -148,7 +148,7 @@ - + diff --git a/Modules/Housing/Housing_API.lua b/Modules/Housing/Housing_API.lua index 5f79988..4f32f66 100644 --- a/Modules/Housing/Housing_API.lua +++ b/Modules/Housing/Housing_API.lua @@ -333,12 +333,6 @@ do --House Level / Info / Teleport button.Cooldown:Hide(); end - function Housing.IsAllianceNeighborhood(neighborhoodGUID) - local uiMapID = C_Housing.GetUIMapIDForNeighborhood(neighborhoodGUID); - local mapIndex = uiMapID and NeighborhoodMapIndex[uiMapID]; - return mapIndex == 1; - end - function Housing.RequestUpdateHouseInfo() if not Housing.isUpdatingHouseInfo then Housing.isUpdatingHouseInfo = true; diff --git a/Modules/Macros.lua b/Modules/Macros.lua index 48d1ab6..752889d 100644 --- a/Modules/Macros.lua +++ b/Modules/Macros.lua @@ -1027,7 +1027,7 @@ do --MacroInterpreter name, usable = API.GetPetNameAndUsability(id, true); id = name; if name then - macroText = "/sp "..name; + macroText = "/summonpet "..name; end end end