完成多出修改
修复拾取界面点击无效问题 修复宠物训练界面不显示训练点问题 新增天赋分享到聊天界面 修复飞行界面无法关闭问题 修复术士宠物的显示问题 为天赋界面添加默认数据库支持 框架现在也可自主选择是否启用 玩家框架和目标框架可取消显示3D头像以及透明度修改 背包和银行也添加透明度自定义支持 优化tooltip性能和背包物品显示方式 修复布局模式在ui缩放后不能正常定位的问题 添加硬核模式危险和死亡的工会通报 添加拾取和已拾取的框体 等等
This commit is contained in:
225
MapReveal.lua
225
MapReveal.lua
@@ -16,6 +16,7 @@ local errata = {
|
||||
}
|
||||
|
||||
-- Turtle WoW new/modified zones not present in LibMapOverlayData
|
||||
-- Updated for latest Turtle WoW version
|
||||
local TurtleWoW_Zones = {
|
||||
["StonetalonMountains"] = {
|
||||
"SUNROCKRETREAT:512:256:256:256", "WINDSHEARCRAG:256:256:512:256",
|
||||
@@ -65,6 +66,9 @@ local TurtleWoW_Zones = {
|
||||
},
|
||||
}
|
||||
|
||||
-- Runtime-discovered overlay data (populated by ScanAllMaps)
|
||||
local scannedOverlays = {}
|
||||
|
||||
local function IsTurtleWoW()
|
||||
return TargetHPText and TargetHPPercText
|
||||
end
|
||||
@@ -85,6 +89,23 @@ local function PatchOverlayDB()
|
||||
for zone, data in pairs(TurtleWoW_Zones) do
|
||||
db[zone] = data
|
||||
end
|
||||
|
||||
for zone, data in pairs(scannedOverlays) do
|
||||
if not db[zone] then
|
||||
db[zone] = data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function MergeScannedData()
|
||||
local db = GetOverlayDB()
|
||||
if not db then return end
|
||||
|
||||
for zone, data in pairs(scannedOverlays) do
|
||||
if not db[zone] or table.getn(db[zone]) < table.getn(data) then
|
||||
db[zone] = data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function GetConfig()
|
||||
@@ -285,3 +306,207 @@ function MapReveal:Refresh()
|
||||
WorldMapFrame_Update()
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Map Scanner: enumerate all continents/zones, collect overlay data from
|
||||
-- explored areas, discover new zones, and merge into the overlay database.
|
||||
-- Usage: /nui mapscan or SFrames.MapReveal:ScanAllMaps()
|
||||
--------------------------------------------------------------------------------
|
||||
local scanFrame = nil
|
||||
local scanQueue = {}
|
||||
local scanIndex = 0
|
||||
local scanRunning = false
|
||||
local scanResults = {}
|
||||
local scanNewZones = {}
|
||||
local scanUpdatedZones = {}
|
||||
local savedMapC, savedMapZ = 0, 0
|
||||
|
||||
local function ExtractOverlayName(fullPath)
|
||||
if not fullPath or fullPath == "" then return nil end
|
||||
local _, _, name = string.find(fullPath, "\\([^\\]+)$")
|
||||
return name and string.upper(name) or nil
|
||||
end
|
||||
|
||||
local function ProcessScanZone()
|
||||
if scanIndex > table.getn(scanQueue) then
|
||||
MapReveal:FinishScan()
|
||||
return
|
||||
end
|
||||
|
||||
local entry = scanQueue[scanIndex]
|
||||
SetMapZoom(entry.cont, entry.zone)
|
||||
|
||||
local mapFile = GetMapInfo and GetMapInfo() or ""
|
||||
if mapFile == "" then
|
||||
scanIndex = scanIndex + 1
|
||||
return
|
||||
end
|
||||
|
||||
local numOverlays = GetNumMapOverlays and GetNumMapOverlays() or 0
|
||||
if numOverlays > 0 then
|
||||
local overlays = {}
|
||||
for i = 1, numOverlays do
|
||||
local texName, texW, texH, offX, offY = GetMapOverlayInfo(i)
|
||||
if texName and texName ~= "" then
|
||||
local name = ExtractOverlayName(texName)
|
||||
if name then
|
||||
table.insert(overlays, name .. ":" .. texW .. ":" .. texH .. ":" .. offX .. ":" .. offY)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if table.getn(overlays) > 0 then
|
||||
local db = GetOverlayDB()
|
||||
local existing = db and db[mapFile]
|
||||
local existingCount = existing and table.getn(existing) or 0
|
||||
|
||||
if not existing then
|
||||
scanNewZones[mapFile] = overlays
|
||||
scanResults[mapFile] = { overlays = overlays, status = "new", count = table.getn(overlays) }
|
||||
elseif table.getn(overlays) > existingCount then
|
||||
scanUpdatedZones[mapFile] = overlays
|
||||
scanResults[mapFile] = { overlays = overlays, status = "updated", count = table.getn(overlays), oldCount = existingCount }
|
||||
else
|
||||
scanResults[mapFile] = { status = "ok", count = existingCount }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scanIndex = scanIndex + 1
|
||||
end
|
||||
|
||||
function MapReveal:FinishScan()
|
||||
scanRunning = false
|
||||
if scanFrame then
|
||||
scanFrame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
if savedMapZ > 0 then
|
||||
SetMapZoom(savedMapC, savedMapZ)
|
||||
elseif savedMapC > 0 then
|
||||
SetMapZoom(savedMapC, 0)
|
||||
else
|
||||
if SetMapToCurrentZone then SetMapToCurrentZone() end
|
||||
end
|
||||
|
||||
local cf = DEFAULT_CHAT_FRAME
|
||||
local newCount = 0
|
||||
local updCount = 0
|
||||
|
||||
for zone, overlays in pairs(scanNewZones) do
|
||||
newCount = newCount + 1
|
||||
scannedOverlays[zone] = overlays
|
||||
end
|
||||
for zone, overlays in pairs(scanUpdatedZones) do
|
||||
updCount = updCount + 1
|
||||
scannedOverlays[zone] = overlays
|
||||
end
|
||||
|
||||
MergeScannedData()
|
||||
|
||||
cf:AddMessage("|cffffb3d9[Nanami-UI]|r 地图扫描完成!")
|
||||
cf:AddMessage(string.format(" 扫描了 |cff00ff00%d|r 个区域", table.getn(scanQueue)))
|
||||
|
||||
if newCount > 0 then
|
||||
cf:AddMessage(string.format(" 发现 |cff00ff00%d|r 个新区域 (已自动添加迷雾数据):", newCount))
|
||||
for zone, overlays in pairs(scanNewZones) do
|
||||
cf:AddMessage(" |cff00ffff" .. zone .. "|r (" .. table.getn(overlays) .. " 个覆盖层)")
|
||||
end
|
||||
end
|
||||
|
||||
if updCount > 0 then
|
||||
cf:AddMessage(string.format(" 更新了 |cffffff00%d|r 个区域 (发现更多已探索覆盖层):", updCount))
|
||||
for zone, info in pairs(scanResults) do
|
||||
if info.status == "updated" then
|
||||
cf:AddMessage(" |cffffff00" .. zone .. "|r (" .. (info.oldCount or 0) .. " -> " .. info.count .. ")")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if newCount == 0 and updCount == 0 then
|
||||
cf:AddMessage(" 所有区域数据已是最新,未发现变动。")
|
||||
end
|
||||
|
||||
cf:AddMessage(" 提示: 新发现的区域仅记录已探索区域的覆盖层,完全探索后再次扫描可获取完整数据。")
|
||||
|
||||
if WorldMapFrame and WorldMapFrame:IsShown() then
|
||||
WorldMapFrame_Update()
|
||||
end
|
||||
end
|
||||
|
||||
function MapReveal:ScanAllMaps()
|
||||
if scanRunning then
|
||||
SFrames:Print("地图扫描正在进行中...")
|
||||
return
|
||||
end
|
||||
|
||||
local db = GetOverlayDB()
|
||||
if not db then
|
||||
SFrames:Print("MapReveal: 未找到覆盖层数据库,无法扫描。")
|
||||
return
|
||||
end
|
||||
|
||||
scanRunning = true
|
||||
scanQueue = {}
|
||||
scanIndex = 1
|
||||
scanResults = {}
|
||||
scanNewZones = {}
|
||||
scanUpdatedZones = {}
|
||||
|
||||
savedMapC = GetCurrentMapContinent and GetCurrentMapContinent() or 0
|
||||
savedMapZ = GetCurrentMapZone and GetCurrentMapZone() or 0
|
||||
|
||||
local numContinents = 0
|
||||
if GetMapContinents then
|
||||
local continents = { GetMapContinents() }
|
||||
numContinents = table.getn(continents)
|
||||
end
|
||||
|
||||
for c = 1, numContinents do
|
||||
local zones = { GetMapZones(c) }
|
||||
for z = 1, table.getn(zones) do
|
||||
table.insert(scanQueue, { cont = c, zone = z, name = zones[z] or "" })
|
||||
end
|
||||
end
|
||||
|
||||
SFrames:Print("开始扫描所有地图... (共 " .. table.getn(scanQueue) .. " 个区域)")
|
||||
|
||||
if not scanFrame then
|
||||
scanFrame = CreateFrame("Frame")
|
||||
end
|
||||
|
||||
local scanElapsed = 0
|
||||
scanFrame:SetScript("OnUpdate", function()
|
||||
scanElapsed = scanElapsed + (arg1 or 0)
|
||||
if scanElapsed < 0.02 then return end
|
||||
scanElapsed = 0
|
||||
|
||||
if not scanRunning then return end
|
||||
local batch = 0
|
||||
while scanIndex <= table.getn(scanQueue) and batch < 5 do
|
||||
ProcessScanZone()
|
||||
batch = batch + 1
|
||||
end
|
||||
if scanIndex > table.getn(scanQueue) then
|
||||
MapReveal:FinishScan()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function MapReveal:ExportScannedData()
|
||||
local cf = DEFAULT_CHAT_FRAME
|
||||
local hasData = false
|
||||
|
||||
for zone, overlays in pairs(scannedOverlays) do
|
||||
hasData = true
|
||||
cf:AddMessage("|cffffb3d9[MapReveal Export]|r |cff00ffff" .. zone .. "|r = {")
|
||||
for _, entry in ipairs(overlays) do
|
||||
cf:AddMessage(' "' .. entry .. '",')
|
||||
end
|
||||
cf:AddMessage("}")
|
||||
end
|
||||
|
||||
if not hasData then
|
||||
cf:AddMessage("|cffffb3d9[MapReveal]|r 没有扫描到的新数据可导出。先运行 /nui mapscan")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user