聊天重做前缓存

This commit is contained in:
rucky
2026-04-09 09:46:47 +08:00
parent 6e18269bfd
commit e915bbd74a
39 changed files with 8501 additions and 2308 deletions

View File

@@ -52,6 +52,26 @@ local function HookScript(frame, script, fn)
end)
end
local function SafeSetMapToCurrentZone()
if not SetMapToCurrentZone then
return
end
if SFrames and SFrames.CallWithPreservedBattlefieldMinimap then
return SFrames:CallWithPreservedBattlefieldMinimap(SetMapToCurrentZone)
end
return pcall(SetMapToCurrentZone)
end
local function SafeSetMapZoom(continent, zone)
if not SetMapZoom then
return
end
if SFrames and SFrames.CallWithPreservedBattlefieldMinimap then
return SFrames:CallWithPreservedBattlefieldMinimap(SetMapZoom, continent, zone)
end
return pcall(SetMapZoom, continent, zone)
end
--------------------------------------------------------------------------------
-- 1. Hide Blizzard Decorations
-- Called at init AND on every WorldMapFrame:OnShow to counter Blizzard resets
@@ -951,12 +971,18 @@ local function CreateWaypointPin()
pinLabel:SetText("")
local btnW, btnH = 52, 18
local PIN_BTN_BACKDROP = {
bgFile = "Interface\\Buttons\\WHITE8X8",
edgeFile = "Interface\\Buttons\\WHITE8X8",
edgeSize = 1,
insets = { left = 1, right = 1, top = 1, bottom = 1 },
}
pinShareBtn = CreateFrame("Button", nil, pinFrame)
pinShareBtn:SetWidth(btnW)
pinShareBtn:SetHeight(btnH)
pinShareBtn:SetPoint("TOPLEFT", pinFrame, "BOTTOMLEFT", -10, -8)
pinShareBtn:SetBackdrop(PANEL_BACKDROP)
pinShareBtn:SetPoint("TOP", pinLabel, "BOTTOM", -(btnW / 2 + 2), -4)
pinShareBtn:SetBackdrop(PIN_BTN_BACKDROP)
pinShareBtn:SetBackdropColor(_A.btnBg[1], _A.btnBg[2], _A.btnBg[3], _A.btnBg[4])
pinShareBtn:SetBackdropBorderColor(_A.btnBorder[1], _A.btnBorder[2], _A.btnBorder[3], _A.btnBorder[4])
local shareFS = pinShareBtn:CreateFontString(nil, "OVERLAY")
@@ -966,9 +992,11 @@ local function CreateWaypointPin()
shareFS:SetTextColor(_A.btnText[1], _A.btnText[2], _A.btnText[3])
pinShareBtn:SetScript("OnEnter", function()
this:SetBackdropColor(_A.btnHoverBg[1], _A.btnHoverBg[2], _A.btnHoverBg[3], _A.btnHoverBg[4])
this:SetBackdropBorderColor(_A.btnHoverBd[1], _A.btnHoverBd[2], _A.btnHoverBd[3], _A.btnHoverBd[4])
end)
pinShareBtn:SetScript("OnLeave", function()
this:SetBackdropColor(_A.btnBg[1], _A.btnBg[2], _A.btnBg[3], _A.btnBg[4])
this:SetBackdropBorderColor(_A.btnBorder[1], _A.btnBorder[2], _A.btnBorder[3], _A.btnBorder[4])
end)
pinShareBtn:SetScript("OnClick", function()
WM:ShareWaypoint()
@@ -978,7 +1006,7 @@ local function CreateWaypointPin()
pinClearBtn:SetWidth(btnW)
pinClearBtn:SetHeight(btnH)
pinClearBtn:SetPoint("LEFT", pinShareBtn, "RIGHT", 4, 0)
pinClearBtn:SetBackdrop(PANEL_BACKDROP)
pinClearBtn:SetBackdrop(PIN_BTN_BACKDROP)
pinClearBtn:SetBackdropColor(_A.buttonDownBg[1], _A.buttonDownBg[2], _A.buttonDownBg[3], _A.buttonDownBg[4])
pinClearBtn:SetBackdropBorderColor(_A.btnBorder[1], _A.btnBorder[2], _A.btnBorder[3], _A.btnBorder[4])
local clearFS = pinClearBtn:CreateFontString(nil, "OVERLAY")
@@ -988,9 +1016,11 @@ local function CreateWaypointPin()
clearFS:SetTextColor(_A.dimText[1], _A.dimText[2], _A.dimText[3])
pinClearBtn:SetScript("OnEnter", function()
this:SetBackdropColor(_A.btnHoverBg[1], _A.btnHoverBg[2], _A.btnHoverBg[3], _A.btnHoverBg[4])
this:SetBackdropBorderColor(_A.btnHoverBd[1], _A.btnHoverBd[2], _A.btnHoverBd[3], _A.btnHoverBd[4])
end)
pinClearBtn:SetScript("OnLeave", function()
this:SetBackdropColor(_A.buttonDownBg[1], _A.buttonDownBg[2], _A.buttonDownBg[3], _A.buttonDownBg[4])
this:SetBackdropBorderColor(_A.btnBorder[1], _A.btnBorder[2], _A.btnBorder[3], _A.btnBorder[4])
end)
pinClearBtn:SetScript("OnClick", function()
WM:ClearWaypoint()
@@ -1099,7 +1129,7 @@ function WM:HandleWaypointLink(data)
if waited >= 0.05 then
timer:SetScript("OnUpdate", nil)
if SetMapZoom then
SetMapZoom(pending.continent, pending.zone)
SafeSetMapZoom(pending.continent, pending.zone)
end
WM:SetWaypoint(pending.continent, pending.zone, pending.x, pending.y, pending.name)
end
@@ -1138,7 +1168,7 @@ local function DiscoverDmfZoneIndices()
local target = string.lower(loc.zone)
local zones = { GetMapZones(loc.cont) }
for idx = 1, table.getn(zones) do
SetMapZoom(loc.cont, idx)
SafeSetMapZoom(loc.cont, idx)
local mf = GetMapInfo and GetMapInfo() or ""
if mf ~= "" then
if mf == loc.zone then
@@ -1158,11 +1188,11 @@ local function DiscoverDmfZoneIndices()
end
end
if savedZ > 0 then
SetMapZoom(savedC, savedZ)
SafeSetMapZoom(savedC, savedZ)
elseif savedC > 0 then
SetMapZoom(savedC, 0)
SafeSetMapZoom(savedC, 0)
else
if SetMapToCurrentZone then SetMapToCurrentZone() end
SafeSetMapToCurrentZone()
end
end
@@ -1390,7 +1420,7 @@ SlashCmdList["DMFMAP"] = function(msg)
cf:AddMessage("|cffffcc66[DMF Scan] " .. cname .. " (cont=" .. c .. "):|r")
local zones = { GetMapZones(c) }
for idx = 1, table.getn(zones) do
SetMapZoom(c, idx)
SafeSetMapZoom(c, idx)
local mf = GetMapInfo and GetMapInfo() or "(nil)"
local zname = zones[idx] or "?"
if string.find(string.lower(mf), "elwynn") or string.find(string.lower(zname), "elwynn")
@@ -1401,9 +1431,9 @@ SlashCmdList["DMFMAP"] = function(msg)
end
end
end
if savedZ > 0 then SetMapZoom(savedC, savedZ)
elseif savedC > 0 then SetMapZoom(savedC, 0)
else if SetMapToCurrentZone then SetMapToCurrentZone() end end
if savedZ > 0 then SafeSetMapZoom(savedC, savedZ)
elseif savedC > 0 then SafeSetMapZoom(savedC, 0)
else SafeSetMapToCurrentZone() end
return
end
local ai, iw, dl, ds = GetDmfSchedule()
@@ -1931,7 +1961,7 @@ local function UpdateNavMap()
if not N.frame or not N.tiles or not N.frame:IsVisible() then return end
if WorldMapFrame and WorldMapFrame:IsVisible() then return end
if SetMapToCurrentZone then SetMapToCurrentZone() end
SafeSetMapToCurrentZone()
local mapFile = GetMapInfo and GetMapInfo() or ""
if mapFile ~= "" and mapFile ~= N.curMap then