generated from Exiles/coa-template
upstream: https://github.com/Nevcairiel/Mapster tag: 1.3.9 commit: 1c451d24d299d44002b1e182f848aa3a3e7faa6b interface: 30300 (WotLK 3.3.5 — last Mapster version targeting our client)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package-as: Mapster
|
||||
externals:
|
||||
Libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/tags/1.0
|
||||
Libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/trunk/CallbackHandler-1.0
|
||||
Libs/AceAddon-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
|
||||
Libs/AceEvent-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
|
||||
Libs/AceHook-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceHook-3.0
|
||||
Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
|
||||
Libs/AceDBOptions-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDBOptions-3.0
|
||||
Libs/AceLocale-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
|
||||
Libs/AceGUI-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
|
||||
Libs/AceConsole-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0
|
||||
Libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
|
||||
Libs/LibBabble-Zone-3.0: svn://svn.wowace.com/wow/libbabble-zone-3-0/mainline/trunk
|
||||
Libs/LibWindow-1.1: svn://svn.wowace.com/wow/libwindow-1-1/mainline/trunk/LibWindow-1.1
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,141 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local MODNAME = "BattleMap"
|
||||
local BattleMap = Mapster:NewModule(MODNAME, "AceEvent-3.0")
|
||||
local FogClear
|
||||
|
||||
-- Make sure to get the global before FogClear loads and overwrites it
|
||||
local GetNumMapOverlays = GetNumMapOverlays
|
||||
|
||||
local db
|
||||
local defaults = {
|
||||
profile = {
|
||||
hideTextures = false,
|
||||
}
|
||||
}
|
||||
|
||||
local optGetter, optSetter
|
||||
do
|
||||
local mod = BattleMap
|
||||
function optGetter(info)
|
||||
local key = info[#info]
|
||||
return db[key]
|
||||
end
|
||||
|
||||
function optSetter(info, value)
|
||||
local key = info[#info]
|
||||
db[key] = value
|
||||
mod:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
local options
|
||||
local function getOptions()
|
||||
if not options then
|
||||
options = {
|
||||
type = "group",
|
||||
name = L["BattleMap"],
|
||||
arg = MODNAME,
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
args = {
|
||||
intro = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["The BattleMap module allows you to change the style of the BattlefieldMinimap, removing unnecessary textures or PvP Objectives."],
|
||||
},
|
||||
enabled = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = L["Enable BattleMap"],
|
||||
get = function() return Mapster:GetModuleEnabled(MODNAME) end,
|
||||
set = function(info, value) Mapster:SetModuleEnabled(MODNAME, value) end,
|
||||
},
|
||||
texturesdesc = {
|
||||
order = 3,
|
||||
type = "description",
|
||||
name = "\n" .. L["Hide the surrounding textures around the BattleMap, only leaving you with the pure map overlays."],
|
||||
},
|
||||
hideTextures = {
|
||||
order = 4,
|
||||
type = "toggle",
|
||||
name = L["Hide Textures"],
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
function BattleMap:OnInitialize()
|
||||
self.db = Mapster.db:RegisterNamespace(MODNAME, defaults)
|
||||
db = self.db.profile
|
||||
|
||||
self:SetEnabledState(Mapster:GetModuleEnabled(MODNAME))
|
||||
Mapster:RegisterModuleOptions(MODNAME, getOptions, L["BattleMap"])
|
||||
|
||||
FogClear = Mapster:GetModule("FogClear", true)
|
||||
end
|
||||
|
||||
function BattleMap:OnEnable()
|
||||
if not IsAddOnLoaded("Blizzard_BattlefieldMinimap") then
|
||||
self:RegisterEvent("ADDON_LOADED", function(event, addon)
|
||||
if addon == "Blizzard_BattlefieldMinimap" then
|
||||
BattleMap:UnregisterEvent("ADDON_LOADED")
|
||||
BattleMap:SetupMap()
|
||||
end
|
||||
end)
|
||||
else
|
||||
self:SetupMap()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleMap:OnDisable()
|
||||
if BattlefieldMinimap then
|
||||
BattlefieldMinimapCorner:Show()
|
||||
BattlefieldMinimapBackground:Show()
|
||||
BattlefieldMinimapCloseButton:Show()
|
||||
BattlefieldMinimapTab:Show()
|
||||
end
|
||||
|
||||
self:UpdateTextureVisibility()
|
||||
end
|
||||
|
||||
function BattleMap:SetupMap()
|
||||
BattlefieldMinimapCorner:Hide()
|
||||
BattlefieldMinimapBackground:Hide()
|
||||
BattlefieldMinimapCloseButton:Hide()
|
||||
BattlefieldMinimapTab:Hide()
|
||||
|
||||
self:RegisterEvent("WORLD_MAP_UPDATE", "UpdateTextureVisibility")
|
||||
self:UpdateTextureVisibility()
|
||||
end
|
||||
|
||||
function BattleMap:Refresh()
|
||||
db = self.db.profile
|
||||
if not self:IsEnabled() then return end
|
||||
|
||||
self:UpdateTextureVisibility()
|
||||
end
|
||||
|
||||
function BattleMap:UpdateTextureVisibility()
|
||||
if not BattlefieldMinimap then return end
|
||||
local hasOverlays
|
||||
if FogClear and FogClear:IsEnabled() then hasOverlays = FogClear:RealHasOverlays() else hasOverlays = GetNumMapOverlays() > 0 end
|
||||
if hasOverlays and db.hideTextures and self:IsEnabled() then
|
||||
for i=1,12 do
|
||||
_G["BattlefieldMinimap"..i]:Hide()
|
||||
end
|
||||
else
|
||||
for i=1,12 do
|
||||
_G["BattlefieldMinimap"..i]:Show()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,205 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local optGetter, optSetter
|
||||
do
|
||||
function optGetter(info)
|
||||
local key = info[#info]
|
||||
if key:sub(0,5) == "mini_" then
|
||||
return Mapster.db.profile.mini[key:sub(6)]
|
||||
else
|
||||
return Mapster.db.profile[key]
|
||||
end
|
||||
end
|
||||
|
||||
function optSetter(info, value)
|
||||
local key = info[#info]
|
||||
if key:sub(0,5) == "mini_" then
|
||||
Mapster.db.profile.mini[key:sub(6)] = value
|
||||
else
|
||||
Mapster.db.profile[key] = value
|
||||
end
|
||||
Mapster:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
local options, moduleOptions = nil, {}
|
||||
local function getOptions()
|
||||
if not options then
|
||||
options = {
|
||||
type = "group",
|
||||
name = "Mapster",
|
||||
args = {
|
||||
general = {
|
||||
order = 1,
|
||||
type = "group",
|
||||
name = "General Settings",
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
args = {
|
||||
intro = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["Mapster allows you to control various aspects of your World Map. You can change the style of the map, control the plugins that extend the map with new functionality, and configure different profiles for every of your characters."],
|
||||
},
|
||||
alphadesc = {
|
||||
order = 2,
|
||||
type = "description",
|
||||
name = L["You can change the transparency of the world map to allow you to continue seeing the world environment while your map is open for navigation."],
|
||||
},
|
||||
alpha = {
|
||||
order = 3,
|
||||
name = L["Alpha"],
|
||||
desc = L["The transparency of the big map."],
|
||||
type = "range",
|
||||
min = 0, max = 1, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
mini_alpha = {
|
||||
order = 4,
|
||||
name = L["Minimized Alpha"],
|
||||
desc = L["The transparency of the minimized map."],
|
||||
type = "range",
|
||||
min = 0, max = 1, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
scaledesc = {
|
||||
order = 5,
|
||||
type = "description",
|
||||
name = L["Change the scale of the world map if you do not want the whole screen filled while the map is open."],
|
||||
},
|
||||
scale = {
|
||||
order = 6,
|
||||
name = L["Scale"],
|
||||
desc = L["Scale of the big map."],
|
||||
type = "range",
|
||||
min = 0.1, max = 2, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
mini_scale = {
|
||||
order = 7,
|
||||
name = L["Minimized Scale"],
|
||||
desc = L["Scale of the minimized map."],
|
||||
type = "range",
|
||||
min = 0.1, max = 2, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
nl = {
|
||||
order = 10,
|
||||
type = "description",
|
||||
name = "",
|
||||
},
|
||||
arrowScale = {
|
||||
order = 11,
|
||||
name = L["PlayerArrow Scale"],
|
||||
desc = L["Adjust the size of the Player Arrow on the Map for better visibility."],
|
||||
type = "range",
|
||||
min = 0.5, max = 2, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
poiScale = {
|
||||
order = 12,
|
||||
type = "range",
|
||||
name = L["POI Scale"],
|
||||
desc = L["Scale of the POI Icons on the Map."],
|
||||
min = 0.1, max = 2, bigStep = 0.01,
|
||||
isPercent = true,
|
||||
},
|
||||
nl2 = {
|
||||
order = 20,
|
||||
type = "description",
|
||||
name = "",
|
||||
},
|
||||
hideMapButton = {
|
||||
order = 21,
|
||||
type = "toggle",
|
||||
name = L["Hide Map Button"],
|
||||
},
|
||||
nl3 = {
|
||||
order = 30,
|
||||
type = "description",
|
||||
name = "",
|
||||
},
|
||||
hideBorder = {
|
||||
order = 31,
|
||||
type = "toggle",
|
||||
name = L["Hide Border"],
|
||||
desc = L["Hide the borders of the big map."],
|
||||
disabled = true,
|
||||
},
|
||||
mini_hideBorder = {
|
||||
order = 32,
|
||||
type = "toggle",
|
||||
name = L["(Mini) Hide Border"],
|
||||
desc = L["Hide the borders of the minimized map."],
|
||||
},
|
||||
disableMouse = {
|
||||
order = 33,
|
||||
type = "toggle",
|
||||
name = L["Disable Mouse"],
|
||||
desc = L["Disable the mouse interactivity of the main map, eg. to change zones."],
|
||||
},
|
||||
mini_disableMouse = {
|
||||
order = 34,
|
||||
type = "toggle",
|
||||
name = L["(Mini) Disable Mouse"],
|
||||
desc = L["Disable the mouse interactivity of the main map when in minimized mode, eg. to change zones."],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for k,v in pairs(moduleOptions) do
|
||||
options.args[k] = (type(v) == "function") and v() or v
|
||||
end
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
local function optFunc()
|
||||
-- open the profiles tab before, so the menu expands
|
||||
InterfaceOptionsFrame_OpenToCategory(Mapster.optionsFrames.Profiles)
|
||||
InterfaceOptionsFrame_OpenToCategory(Mapster.optionsFrames.Mapster)
|
||||
InterfaceOptionsFrame:Raise()
|
||||
end
|
||||
|
||||
function Mapster:SetupOptions()
|
||||
self.optionsFrames = {}
|
||||
|
||||
-- setup options table
|
||||
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("Mapster", getOptions)
|
||||
self.optionsFrames.Mapster = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Mapster", nil, nil, "general")
|
||||
|
||||
self:RegisterModuleOptions("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), "Profiles")
|
||||
|
||||
LibStub("AceConsole-3.0"):RegisterChatCommand( "mapster", optFunc)
|
||||
end
|
||||
|
||||
function Mapster:RegisterModuleOptions(name, optionTbl, displayName)
|
||||
moduleOptions[name] = optionTbl
|
||||
self.optionsFrames[name] = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Mapster", displayName, "Mapster", name)
|
||||
end
|
||||
|
||||
function Mapster:SetupMapButton()
|
||||
-- create button on the worldmap to toggle the options
|
||||
self.optionsButton = CreateFrame("Button", "MapsterOptionsButton", WorldMapFrame, "UIPanelButtonTemplate")
|
||||
self.optionsButton:SetWidth(95)
|
||||
self.optionsButton:SetHeight(18)
|
||||
self.optionsButton:SetText("Mapster")
|
||||
self.optionsButton:ClearAllPoints()
|
||||
self.optionsButton:SetPoint("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -43, -2)
|
||||
|
||||
if self.db.profile.hideMapButton then
|
||||
self.optionsButton:Hide()
|
||||
else
|
||||
self.optionsButton:Show()
|
||||
end
|
||||
|
||||
self.optionsButton:SetScript("OnClick", optFunc)
|
||||
end
|
||||
@@ -0,0 +1,174 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local MODNAME = "Coords"
|
||||
local Coords = Mapster:NewModule(MODNAME)
|
||||
|
||||
local GetCursorPosition = GetCursorPosition
|
||||
local GetPlayerMapPosition = GetPlayerMapPosition
|
||||
local WorldMapDetailFrame = WorldMapDetailFrame
|
||||
local display, cursortext, playertext
|
||||
local texttemplate, text = "%%s: %%.%df, %%.%df"
|
||||
|
||||
local MouseXY, OnUpdate
|
||||
|
||||
local db
|
||||
local defaults = {
|
||||
profile = {
|
||||
accuracy = 1,
|
||||
}
|
||||
}
|
||||
|
||||
local optGetter, optSetter
|
||||
do
|
||||
local mod = Coords
|
||||
function optGetter(info)
|
||||
local key = info[#info]
|
||||
return db[key]
|
||||
end
|
||||
|
||||
function optSetter(info, value)
|
||||
local key = info[#info]
|
||||
db[key] = value
|
||||
mod:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
local options
|
||||
local function getOptions()
|
||||
if not options then
|
||||
options = {
|
||||
type = "group",
|
||||
name = L["Coordinates"],
|
||||
arg = MODNAME,
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
args = {
|
||||
intro = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["The Coordinates module adds a display of your current location, and the coordinates of your mouse cursor to the World Map frame."],
|
||||
},
|
||||
enabled = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = L["Enable Coordinates"],
|
||||
get = function() return Mapster:GetModuleEnabled(MODNAME) end,
|
||||
set = function(info, value) Mapster:SetModuleEnabled(MODNAME, value) end,
|
||||
},
|
||||
accuracydesc = {
|
||||
order = 3,
|
||||
type = "description",
|
||||
name = "\n" .. L["You can control the accuracy of the coordinates, e.g. if you need very exact coordinates you can set this to 2."],
|
||||
},
|
||||
accuracy = {
|
||||
order = 4,
|
||||
type = "range",
|
||||
name = L["Accuracy"],
|
||||
min = 0, max = 2, step = 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
function Coords:OnInitialize()
|
||||
self.db = Mapster.db:RegisterNamespace(MODNAME, defaults)
|
||||
db = self.db.profile
|
||||
|
||||
self:SetEnabledState(Mapster:GetModuleEnabled(MODNAME))
|
||||
Mapster:RegisterModuleOptions(MODNAME, getOptions, L["Coordinates"])
|
||||
end
|
||||
|
||||
function Coords:OnEnable()
|
||||
if not display then
|
||||
display = CreateFrame("Frame", "Mapster_CoordsFrame", WorldMapFrame)
|
||||
|
||||
cursortext = display:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
playertext = display:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
|
||||
self:UpdateMapsize(Mapster.miniMap)
|
||||
end
|
||||
display:SetScript("OnUpdate", OnUpdate)
|
||||
if Mapster.bordersVisible then
|
||||
display:Show()
|
||||
else
|
||||
display:Hide()
|
||||
end
|
||||
|
||||
self:Refresh()
|
||||
end
|
||||
|
||||
function Coords:OnDisable()
|
||||
display:SetScript("OnUpdate", nil)
|
||||
display:Hide()
|
||||
end
|
||||
|
||||
function Coords:Refresh()
|
||||
db = self.db.profile
|
||||
if not self:IsEnabled() then return end
|
||||
|
||||
local acc = tonumber(db.accuracy) or 1
|
||||
text = texttemplate:format(acc, acc)
|
||||
end
|
||||
|
||||
function Coords:UpdateMapsize(mini)
|
||||
-- map was minimized, fix display position
|
||||
if mini then
|
||||
cursortext:SetPoint("BOTTOMLEFT", WorldMapPositioningGuide, "BOTTOM", 15, -2)
|
||||
playertext:SetPoint("BOTTOMRIGHT", WorldMapPositioningGuide, "BOTTOM", -30, -2)
|
||||
else
|
||||
cursortext:SetPoint("BOTTOMLEFT", WorldMapPositioningGuide, "BOTTOM", 50, 10)
|
||||
playertext:SetPoint("BOTTOMRIGHT", WorldMapPositioningGuide, "BOTTOM", -50, 10)
|
||||
end
|
||||
end
|
||||
|
||||
function Coords:BorderVisibilityChanged(visible)
|
||||
if not display then return end
|
||||
if visible then
|
||||
display:Show()
|
||||
else
|
||||
display:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function MouseXY()
|
||||
local left, top = WorldMapDetailFrame:GetLeft(), WorldMapDetailFrame:GetTop()
|
||||
local width, height = WorldMapDetailFrame:GetWidth(), WorldMapDetailFrame:GetHeight()
|
||||
local scale = WorldMapDetailFrame:GetEffectiveScale()
|
||||
|
||||
local x, y = GetCursorPosition()
|
||||
local cx = (x/scale - left) / width
|
||||
local cy = (top - y/scale) / height
|
||||
|
||||
if cx < 0 or cx > 1 or cy < 0 or cy > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
return cx, cy
|
||||
end
|
||||
|
||||
local cursor, player = L["Cursor"], L["Player"]
|
||||
function OnUpdate()
|
||||
local cx, cy = MouseXY()
|
||||
local px, py = GetPlayerMapPosition("player")
|
||||
|
||||
if cx then
|
||||
cursortext:SetFormattedText(text, cursor, 100 * cx, 100 * cy)
|
||||
else
|
||||
cursortext:SetText("")
|
||||
end
|
||||
|
||||
if px == 0 then
|
||||
playertext:SetText("")
|
||||
else
|
||||
playertext:SetFormattedText(text, player, 100 * px, 100 * py)
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,176 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local MODNAME = "GroupIcons"
|
||||
local GroupIcons = Mapster:NewModule(MODNAME, "AceEvent-3.0", "AceHook-3.0")
|
||||
|
||||
local fmt = string.format
|
||||
local sub = string.sub
|
||||
local find = string.find
|
||||
|
||||
local _G = _G
|
||||
|
||||
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
|
||||
|
||||
local UnitClass = UnitClass
|
||||
local GetRaidRosterInfo = GetRaidRosterInfo
|
||||
local UnitAffectingCombat = UnitAffectingCombat
|
||||
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
|
||||
local MapUnit_IsInactive = MapUnit_IsInactive
|
||||
|
||||
--Artwork taken from Cartographer
|
||||
local path = "Interface\\AddOns\\Mapster\\Artwork\\"
|
||||
|
||||
local FixUnit, FixWorldMapUnits, FixBattlefieldUnits, OnUpdate, UpdateUnitIcon
|
||||
|
||||
local options
|
||||
local function getOptions()
|
||||
if not options then
|
||||
options = {
|
||||
order = 20,
|
||||
type = "group",
|
||||
name = L["Group Icons"],
|
||||
arg = MODNAME,
|
||||
args = {
|
||||
intro = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["The Group Icons module converts the player icons on the World Map and the Zone/Battlefield map to more meaningful icons, showing their class and (in raids) their sub-group."],
|
||||
},
|
||||
enabled = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = L["Enable Group Icons"],
|
||||
get = function() return Mapster:GetModuleEnabled(MODNAME) end,
|
||||
set = function(info, value) Mapster:SetModuleEnabled(MODNAME, value) end,
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
function GroupIcons:OnInitialize()
|
||||
self:SetEnabledState(Mapster:GetModuleEnabled(MODNAME))
|
||||
Mapster:RegisterModuleOptions(MODNAME, getOptions, L["Group Icons"])
|
||||
end
|
||||
|
||||
function GroupIcons:OnEnable()
|
||||
-- Support for !Class Colors
|
||||
if CUSTOM_CLASS_COLORS then
|
||||
RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS
|
||||
end
|
||||
|
||||
if not IsAddOnLoaded("Blizzard_BattlefieldMinimap") then
|
||||
self:RegisterEvent("ADDON_LOADED", function(event, addon)
|
||||
if addon == "Blizzard_BattlefieldMinimap" then
|
||||
GroupIcons:UnregisterEvent("ADDON_LOADED")
|
||||
FixBattlefieldUnits(true)
|
||||
self:UnregisterEvent("ADDON_LOADED")
|
||||
end
|
||||
end)
|
||||
else
|
||||
FixBattlefieldUnits(true)
|
||||
end
|
||||
FixWorldMapUnits(true)
|
||||
self:RawHook("WorldMapUnit_Update", true)
|
||||
end
|
||||
|
||||
function GroupIcons:OnDisable()
|
||||
FixWorldMapUnits(false)
|
||||
FixBattlefieldUnits(false)
|
||||
end
|
||||
|
||||
function FixUnit(unit, state, isNormal)
|
||||
local frame = _G[unit]
|
||||
local icon = frame.icon
|
||||
if state then
|
||||
frame.elapsed = 0.5
|
||||
frame:SetScript("OnUpdate", OnUpdate)
|
||||
frame:SetScript("OnEvent", nil)
|
||||
if isNormal then
|
||||
icon:SetTexture(path .. "Normal")
|
||||
end
|
||||
else
|
||||
frame.elapsed = nil
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
frame:SetScript("OnEvent", WorldMapUnit_OnEvent)
|
||||
icon:SetVertexColor(1, 1, 1)
|
||||
icon:SetTexture("Interface\\WorldMap\\WorldMapPartyIcon")
|
||||
end
|
||||
end
|
||||
|
||||
function FixWorldMapUnits(state)
|
||||
for i = 1, 4 do
|
||||
FixUnit(fmt("WorldMapParty%d", i), state, true)
|
||||
end
|
||||
for i = 1,40 do
|
||||
FixUnit(fmt("WorldMapRaid%d", i), state)
|
||||
end
|
||||
end
|
||||
|
||||
function FixBattlefieldUnits(state)
|
||||
if BattlefieldMinimap then
|
||||
for i = 1, 4 do
|
||||
FixUnit(fmt("BattlefieldMinimapParty%d", i), state, true)
|
||||
end
|
||||
for i = 1, 40 do
|
||||
FixUnit(fmt("BattlefieldMinimapRaid%d", i), state)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function OnUpdate(self, elapsed)
|
||||
self.elapsed = self.elapsed - elapsed
|
||||
if self.elapsed <= 0 then
|
||||
self.elapsed = 0.5
|
||||
UpdateUnitIcon(self.icon, self.unit)
|
||||
end
|
||||
end
|
||||
|
||||
local grouptex = path .. "Group%d"
|
||||
function UpdateUnitIcon(tex, unit)
|
||||
-- sanity check
|
||||
if not (tex and unit) then return end
|
||||
|
||||
-- grab the class filename
|
||||
local _, fileName = UnitClass(unit)
|
||||
if not fileName then return end
|
||||
|
||||
-- handle raid units, and set the correct subgroup texture
|
||||
if find(unit, "raid", 1, true) then
|
||||
local _, _, subgroup = GetRaidRosterInfo(sub(unit, 5))
|
||||
if not subgroup then return end
|
||||
tex:SetTexture(fmt(grouptex, subgroup))
|
||||
end
|
||||
|
||||
-- color the texture
|
||||
-- either by flash color
|
||||
local t = RAID_CLASS_COLORS[fileName]
|
||||
if (GetTime() % 1 < 0.5) then
|
||||
if UnitAffectingCombat(unit) then
|
||||
-- red flash for units in combat
|
||||
tex:SetVertexColor(0.8, 0, 0)
|
||||
elseif UnitIsDeadOrGhost(unit) then
|
||||
-- dark grey flash for dead units
|
||||
tex:SetVertexColor(0.2, 0.2, 0.2)
|
||||
elseif PlayerIsPVPInactive(unit) then
|
||||
tex:SetVertexColor(0.5, 0.2, 0.8)
|
||||
end
|
||||
-- or class color
|
||||
elseif t then
|
||||
tex:SetVertexColor(t.r, t.g, t.b)
|
||||
else --fallback grey, you never know what happens
|
||||
tex:SetVertexColor(0.8, 0.8, 0.8)
|
||||
end
|
||||
end
|
||||
|
||||
function GroupIcons:WorldMapUnit_Update(unitFrame)
|
||||
UpdateUnitIcon(unitFrame.icon, unitFrame.unit)
|
||||
end
|
||||
@@ -0,0 +1,225 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local MODNAME = "InstanceMaps"
|
||||
local Maps = Mapster:NewModule(MODNAME, "AceHook-3.0")
|
||||
|
||||
local LBZ = LibStub("LibBabble-Zone-3.0", true)
|
||||
local BZ = LBZ and LBZ:GetLookupTable() or setmetatable({}, {__index = function(t,k) return k end})
|
||||
|
||||
-- Data mostly from http://www.wowwiki.com/API_SetMapByID
|
||||
local data = {
|
||||
-- Northrend Instances
|
||||
instances = {
|
||||
["The Nexus"] = 520,
|
||||
["The Culling of Stratholme"] = 521,
|
||||
["Ahn'kahet: The Old Kingdom"] = 522,
|
||||
["Utgarde Keep"] = 523,
|
||||
["Utgarde Pinnacle"] = 524,
|
||||
["Halls of Lightning"] = 525,
|
||||
["Halls of Stone"] = 526,
|
||||
["The Oculus"] = 528,
|
||||
["Gundrak"] = 530,
|
||||
["Azjol-Nerub"] = 533,
|
||||
["Drak'Tharon Keep"] = 534,
|
||||
["The Violet Hold"] = 536,
|
||||
-- 3.2
|
||||
["Trial of the Champion"] = 542,
|
||||
-- 3.3
|
||||
["The Forge of Souls"] = 601,
|
||||
["Pit of Saron"] = 602,
|
||||
["Halls of Reflection"] = 603,
|
||||
},
|
||||
|
||||
-- Northrend Raids
|
||||
raids = {
|
||||
["The Eye of Eternity"] = 527,
|
||||
["Ulduar"] = 529,
|
||||
["The Obsidian Sanctum"] = 531,
|
||||
["Vault of Archavon"] = 532,
|
||||
["Naxxramas"] = 535,
|
||||
-- 3.2
|
||||
["Trial of the Crusader"] = 543,
|
||||
-- 3.3
|
||||
["Icecrown Citadel"] = 604,
|
||||
-- 3.3.5
|
||||
["The Ruby Sanctum"] = 609,
|
||||
},
|
||||
bgs = {
|
||||
["Alterac Valley"] = 401,
|
||||
["Warsong Gulch"] = 443,
|
||||
["Arathi Basin"] = 461,
|
||||
["Eye of the Storm"] = 482,
|
||||
["Strand of the Ancients"] = 512,
|
||||
["Isle of Conquest"] = 540,
|
||||
},
|
||||
}
|
||||
|
||||
--[[
|
||||
local db
|
||||
local defaults = {
|
||||
profile = {
|
||||
}
|
||||
}
|
||||
]]
|
||||
|
||||
local options
|
||||
local function getOptions()
|
||||
if not options then
|
||||
options = {
|
||||
type = "group",
|
||||
name = L["Instance Maps"],
|
||||
arg = MODNAME,
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
args = {
|
||||
intro = {
|
||||
order = 1,
|
||||
type = "description",
|
||||
name = L["The Instance Maps module allows you to view the Instance and Battleground Maps provided by the game without being in the instance yourself."],
|
||||
},
|
||||
enabled = {
|
||||
order = 2,
|
||||
type = "toggle",
|
||||
name = L["Enable Instance Maps"],
|
||||
get = function() return Mapster:GetModuleEnabled(MODNAME) end,
|
||||
set = function(info, value) Mapster:SetModuleEnabled(MODNAME, value) end,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
local zoomOverride
|
||||
|
||||
function Maps:OnInitialize()
|
||||
--[[
|
||||
self.db = Mapster.db:RegisterNamespace(MODNAME, defaults)
|
||||
db = self.db.profile
|
||||
]]
|
||||
|
||||
self:SetEnabledState(Mapster:GetModuleEnabled(MODNAME))
|
||||
Mapster:RegisterModuleOptions(MODNAME, getOptions, L["Instance Maps"])
|
||||
|
||||
self.zone_names = {}
|
||||
self.zone_data = {}
|
||||
|
||||
for key, idata in pairs(data) do
|
||||
local names = {}
|
||||
local name_data = {}
|
||||
for name, zdata in pairs(idata) do
|
||||
tinsert(names, BZ[name])
|
||||
name_data[BZ[name]] = zdata
|
||||
end
|
||||
table.sort(names)
|
||||
self.zone_names[key] = names
|
||||
|
||||
local zone_data = {}
|
||||
for k,v in pairs(names) do
|
||||
zone_data[k] = name_data[v]
|
||||
end
|
||||
self.zone_data[key] = zone_data
|
||||
end
|
||||
data = nil
|
||||
end
|
||||
|
||||
function Maps:OnEnable()
|
||||
self:SecureHook("WorldMapContinentsDropDown_Update")
|
||||
self:SecureHook("WorldMapFrame_LoadContinents")
|
||||
|
||||
self:SecureHook("WorldMapZoneDropDown_Update")
|
||||
self:RawHook("WorldMapZoneDropDown_Initialize", true)
|
||||
|
||||
self:SecureHook("SetMapZoom")
|
||||
self:SecureHook("SetMapToCurrentZone", "SetMapZoom")
|
||||
end
|
||||
|
||||
function Maps:OnDisable()
|
||||
self:UnhookAll()
|
||||
self.mapCont, self.mapContId, self.mapZone = nil, nil, nil
|
||||
WorldMapContinentsDropDown_Update()
|
||||
WorldMapZoneDropDown_Update()
|
||||
end
|
||||
|
||||
function Maps:GetZoneData()
|
||||
return self.zone_data[self.mapCont][self.mapZone]
|
||||
end
|
||||
|
||||
function Maps:WorldMapContinentsDropDown_Update()
|
||||
if self.mapCont then
|
||||
UIDropDownMenu_SetSelectedID(WorldMapContinentDropDown, self.mapContId)
|
||||
end
|
||||
end
|
||||
|
||||
local function MapsterContinentButton_OnClick(frame)
|
||||
UIDropDownMenu_SetSelectedID(WorldMapContinentDropDown, frame:GetID())
|
||||
Maps.mapCont = frame.arg1
|
||||
Maps.mapContId = frame:GetID()
|
||||
zoomOverride = true
|
||||
SetMapZoom(-1)
|
||||
zoomOverride = nil
|
||||
end
|
||||
|
||||
function Maps:WorldMapFrame_LoadContinents()
|
||||
local info = UIDropDownMenu_CreateInfo()
|
||||
info.text = L["Northrend Instances"]
|
||||
info.func = MapsterContinentButton_OnClick
|
||||
info.checked = nil
|
||||
info.arg1 = "instances"
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
info.text = L["Northrend Raids"]
|
||||
info.func = MapsterContinentButton_OnClick
|
||||
info.checked = nil
|
||||
info.arg1 = "raids"
|
||||
UIDropDownMenu_AddButton(info)
|
||||
|
||||
info.text = L["Battlegrounds"]
|
||||
info.func = MapsterContinentButton_OnClick
|
||||
info.checked = nil
|
||||
info.arg1 = "bgs"
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
|
||||
function Maps:WorldMapZoneDropDown_Update()
|
||||
if self.mapZone then
|
||||
UIDropDownMenu_SetSelectedID(WorldMapZoneDropDown, self.mapZone)
|
||||
end
|
||||
end
|
||||
|
||||
local function MapsterZoneButton_OnClick(frame)
|
||||
UIDropDownMenu_SetSelectedID(WorldMapZoneDropDown, frame:GetID())
|
||||
Maps.mapZone = frame:GetID()
|
||||
SetMapByID(Maps:GetZoneData())
|
||||
end
|
||||
|
||||
local function Mapster_LoadZones(...)
|
||||
local info = UIDropDownMenu_CreateInfo()
|
||||
for i=1, select("#", ...), 1 do
|
||||
info.text = select(i, ...)
|
||||
info.func = MapsterZoneButton_OnClick
|
||||
info.checked = nil
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end
|
||||
|
||||
function Maps:WorldMapZoneDropDown_Initialize()
|
||||
if self.mapCont then
|
||||
Mapster_LoadZones(unpack(self.zone_names[self.mapCont]))
|
||||
else
|
||||
self.hooks.WorldMapZoneDropDown_Initialize()
|
||||
end
|
||||
end
|
||||
|
||||
function Maps:SetMapZoom()
|
||||
if not zoomOverride then
|
||||
self.mapCont, self.mapContId, self.mapZone = nil, nil, nil
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/local/bin/lua
|
||||
|
||||
-- CONFIG --
|
||||
|
||||
--[[
|
||||
Prefix to all files if this script is run from a subdir, for example
|
||||
]]
|
||||
local filePrefix = "../"
|
||||
|
||||
--[[
|
||||
List of all files to parse
|
||||
]]
|
||||
local files = {
|
||||
"BattleMap.lua",
|
||||
"Config.lua",
|
||||
"Coords.lua",
|
||||
"FogClear.lua",
|
||||
"GroupIcons.lua",
|
||||
"InstanceMaps.lua",
|
||||
"Mapster.lua",
|
||||
"Scaling.lua",
|
||||
}
|
||||
|
||||
local out = "Strings.lua"
|
||||
-- CODE --
|
||||
|
||||
local strings = {}
|
||||
|
||||
-- extract data from specified lua files
|
||||
for idx,filename in pairs(files) do
|
||||
local file = io.open(string.format("%s%s", filePrefix or "", filename), "r")
|
||||
assert(file, "Could not open " .. filename)
|
||||
local text = file:read("*all")
|
||||
|
||||
for match in string.gmatch(text, "L%[\"(.-)\"%]") do
|
||||
strings[match] = true
|
||||
end
|
||||
end
|
||||
|
||||
local work = {}
|
||||
|
||||
for k,v in pairs(strings) do table.insert(work, k) end
|
||||
table.sort(work)
|
||||
|
||||
-- Write locale files
|
||||
local file = io.open(out, "w")
|
||||
for idx, match in ipairs(work) do
|
||||
file:write(string.format("L[\"%s\"] = true\n", match))
|
||||
end
|
||||
file:close()
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "deDE")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local debug = false
|
||||
--@debug@
|
||||
debug = true
|
||||
--@end-debug@
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "enUS", true, debug)
|
||||
|
||||
--@localization(locale="enUS", format="lua_additive_table", same-key-is-true=true)@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "esES")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="esES", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "esMX")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="esMX", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "frFR")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "koKR")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="koKR", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,12 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\FrameXML\UI.xsd">
|
||||
<Script file="enUS.lua"/>
|
||||
<Script file="deDE.lua"/>
|
||||
<Script file="frFR.lua"/>
|
||||
<Script file="esES.lua"/>
|
||||
<Script file="esMX.lua"/>
|
||||
<Script file="zhTW.lua"/>
|
||||
<Script file="zhCN.lua"/>
|
||||
<Script file="koKR.lua"/>
|
||||
<Script file="ruRU.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "ruRU")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="ruRU", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "zhCN")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="zhCN", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Mapster Locale
|
||||
-- Please use the Localization App on WoWAce to Update this
|
||||
-- http://www.wowace.com/projects/mapster/localization/ ;¶
|
||||
|
||||
local L = LibStub("AceLocale-3.0"):NewLocale("Mapster", "zhTW")
|
||||
if not L then return end
|
||||
|
||||
--@localization(locale="zhTW", format="lua_additive_table", handle-unlocalized="comment")@
|
||||
@@ -0,0 +1,690 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):NewAddon("Mapster", "AceEvent-3.0", "AceHook-3.0")
|
||||
|
||||
local LibWindow = LibStub("LibWindow-1.1")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Mapster")
|
||||
|
||||
local defaults = {
|
||||
profile = {
|
||||
strata = "HIGH",
|
||||
hideMapButton = false,
|
||||
arrowScale = 0.88,
|
||||
questObjectives = 2,
|
||||
modules = {
|
||||
['*'] = true,
|
||||
},
|
||||
x = 0,
|
||||
y = 0,
|
||||
points = "CENTER",
|
||||
scale = 0.75,
|
||||
poiScale = 0.8,
|
||||
alpha = 1,
|
||||
hideBorder = false,
|
||||
disableMouse = false,
|
||||
miniMap = false,
|
||||
mini = {
|
||||
x = 0,
|
||||
y = 0,
|
||||
point = "CENTER",
|
||||
scale = 1,
|
||||
alpha = 0.9,
|
||||
hideBorder = true,
|
||||
disableMouse = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Variables that are changed on "mini" mode
|
||||
local miniList = { x = true, y = true, point = true, scale = true, alpha = true, hideBorder = true, disableMouse = true }
|
||||
|
||||
local db_
|
||||
local db = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
if Mapster.miniMap and miniList[k] then
|
||||
return db_.mini[k]
|
||||
else
|
||||
return db_[k]
|
||||
end
|
||||
end,
|
||||
__newindex = function(t, k, v)
|
||||
if Mapster.miniMap and miniList[k] then
|
||||
db_.mini[k] = v
|
||||
else
|
||||
db_[k] = v
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local format = string.format
|
||||
|
||||
local wmfOnShow, wmfStartMoving, wmfStopMoving, dropdownScaleFix
|
||||
local questObjDropDownInit, questObjDropDownUpdate
|
||||
|
||||
function Mapster:OnInitialize()
|
||||
self.db = LibStub("AceDB-3.0"):New("MapsterDB", defaults, true)
|
||||
db_ = self.db.profile
|
||||
|
||||
self.db.RegisterCallback(self, "OnProfileChanged", "Refresh")
|
||||
self.db.RegisterCallback(self, "OnProfileCopied", "Refresh")
|
||||
self.db.RegisterCallback(self, "OnProfileReset", "Refresh")
|
||||
|
||||
self.elementsToHide = {}
|
||||
|
||||
self:SetupOptions()
|
||||
end
|
||||
|
||||
local realZone
|
||||
function Mapster:OnEnable()
|
||||
local advanced, mini = GetCVarBool("advancedWorldMap"), GetCVarBool("miniWorldMap")
|
||||
SetCVar("miniWorldMap", nil)
|
||||
SetCVar("advancedWorldMap", nil)
|
||||
InterfaceOptionsObjectivesPanelAdvancedWorldMap:Disable()
|
||||
InterfaceOptionsObjectivesPanelAdvancedWorldMapText:SetTextColor(0.5,0.5,0.5)
|
||||
-- restore map to its vanilla state
|
||||
if mini then
|
||||
WorldMap_ToggleSizeUp()
|
||||
end
|
||||
if advanced then
|
||||
WorldMapFrame_ToggleAdvanced()
|
||||
end
|
||||
|
||||
self:SetupMapButton()
|
||||
|
||||
LibWindow.RegisterConfig(WorldMapFrame, db)
|
||||
|
||||
local vis = WorldMapFrame:IsVisible()
|
||||
if vis then
|
||||
HideUIPanel(WorldMapFrame)
|
||||
end
|
||||
|
||||
UIPanelWindows["WorldMapFrame"] = nil
|
||||
WorldMapFrame:SetAttribute("UIPanelLayout-enabled", false)
|
||||
WorldMapFrame:HookScript("OnShow", wmfOnShow)
|
||||
WorldMapFrame:HookScript("OnHide", wmfOnHide)
|
||||
BlackoutWorld:Hide()
|
||||
WorldMapTitleButton:Hide()
|
||||
|
||||
WorldMapFrame:SetScript("OnKeyDown", nil)
|
||||
|
||||
WorldMapFrame:SetMovable(true)
|
||||
WorldMapFrame:RegisterForDrag("LeftButton")
|
||||
WorldMapFrame:SetScript("OnDragStart", wmfStartMoving)
|
||||
WorldMapFrame:SetScript("OnDragStop", wmfStopMoving)
|
||||
|
||||
WorldMapFrame:SetParent(UIParent)
|
||||
WorldMapFrame:SetToplevel(true)
|
||||
WorldMapFrame:SetWidth(1024)
|
||||
WorldMapFrame:SetHeight(768)
|
||||
WorldMapFrame:SetClampedToScreen(false)
|
||||
|
||||
WorldMapContinentDropDownButton:SetScript("OnClick", dropdownScaleFix)
|
||||
WorldMapZoneDropDownButton:SetScript("OnClick", dropdownScaleFix)
|
||||
WorldMapZoneMinimapDropDownButton:SetScript("OnClick", dropdownScaleFix)
|
||||
|
||||
WorldMapFrameSizeDownButton:SetScript("OnClick", function() Mapster:ToggleMapSize() end)
|
||||
WorldMapFrameSizeUpButton:SetScript("OnClick", function() Mapster:ToggleMapSize() end)
|
||||
|
||||
-- Hide Quest Objectives CheckBox and replace it with a DropDown
|
||||
WorldMapQuestShowObjectives:Hide()
|
||||
WorldMapQuestShowObjectives:SetChecked(db.questObjectives ~= 0)
|
||||
WorldMapQuestShowObjectives_Toggle()
|
||||
local questObj = CreateFrame("Frame", "MapsterQuestObjectivesDropDown", WorldMapFrame, "UIDropDownMenuTemplate")
|
||||
questObj:SetPoint("BOTTOMRIGHT", "WorldMapPositioningGuide", "BOTTOMRIGHT", -5, -2)
|
||||
|
||||
local text = questObj:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||
text:SetText(L["Quest Objectives"])
|
||||
text:SetPoint("RIGHT", questObj, "LEFT", 5, 3)
|
||||
-- Init DropDown
|
||||
UIDropDownMenu_Initialize(questObj, questObjDropDownInit)
|
||||
UIDropDownMenu_SetWidth(questObj, 150)
|
||||
questObjDropDownUpdate()
|
||||
|
||||
wmfOnShow(WorldMapFrame)
|
||||
hooksecurefunc(WorldMapTooltip, "Show", function(self)
|
||||
self:SetFrameStrata("TOOLTIP")
|
||||
end)
|
||||
|
||||
tinsert(UISpecialFrames, "WorldMapFrame")
|
||||
|
||||
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
|
||||
if db.miniMap then
|
||||
self:SizeDown()
|
||||
end
|
||||
self.miniMap = db.miniMap
|
||||
|
||||
self:SetPosition()
|
||||
self:SetAlpha()
|
||||
self:SetArrow()
|
||||
self:UpdateBorderVisibility()
|
||||
self:UpdateMouseInteractivity()
|
||||
|
||||
self:SecureHook("WorldMapFrame_DisplayQuestPOI")
|
||||
self:SecureHook("WorldMapFrame_DisplayQuests")
|
||||
self:SecureHook("WorldMapFrame_SetPOIMaxBounds")
|
||||
WorldMapFrame_SetPOIMaxBounds()
|
||||
|
||||
if vis then
|
||||
ShowUIPanel(WorldMapFrame)
|
||||
end
|
||||
end
|
||||
|
||||
local blobWasVisible, blobNewScale
|
||||
local blobHideFunc = function() blobWasVisible = nil end
|
||||
local blobShowFunc = function() blobWasVisible = true end
|
||||
local blobScaleFunc = function(self, scale) blobNewScale = scale end
|
||||
|
||||
function Mapster:PLAYER_REGEN_DISABLED()
|
||||
blobWasVisible = WorldMapBlobFrame:IsShown()
|
||||
blobNewScale = nil
|
||||
WorldMapBlobFrame:SetParent(nil)
|
||||
WorldMapBlobFrame:ClearAllPoints()
|
||||
-- dummy position, off screen, so calculations don't go boom
|
||||
WorldMapBlobFrame:SetPoint("TOP", UIParent, "BOTTOM")
|
||||
WorldMapBlobFrame:Hide()
|
||||
WorldMapBlobFrame.Hide = blobHideFunc
|
||||
WorldMapBlobFrame.Show = blobShowFunc
|
||||
WorldMapBlobFrame.SetScale = blobScaleFunc
|
||||
end
|
||||
|
||||
local updateFrame = CreateFrame("Frame")
|
||||
local function restoreBlobs()
|
||||
WorldMapBlobFrame_CalculateHitTranslations()
|
||||
if WorldMapQuestScrollChildFrame.selected and not WorldMapQuestScrollChildFrame.selected.completed then
|
||||
WorldMapBlobFrame:DrawQuestBlob(WorldMapQuestScrollChildFrame.selected.questId, true)
|
||||
end
|
||||
updateFrame:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
function Mapster:PLAYER_REGEN_ENABLED()
|
||||
WorldMapBlobFrame:SetParent(WorldMapFrame)
|
||||
WorldMapBlobFrame:ClearAllPoints()
|
||||
WorldMapBlobFrame:SetPoint("TOPLEFT", WorldMapDetailFrame)
|
||||
WorldMapBlobFrame.Hide = nil
|
||||
WorldMapBlobFrame.Show = nil
|
||||
WorldMapBlobFrame.SetScale = nil
|
||||
if blobWasVisible then
|
||||
WorldMapBlobFrame:Show()
|
||||
updateFrame:SetScript("OnUpdate", restoreBlobs)
|
||||
end
|
||||
if blobNewScale then
|
||||
WorldMapBlobFrame:SetScale(blobNewScale)
|
||||
WorldMapBlobFrame.xRatio = nil
|
||||
blobNewScale = nil
|
||||
end
|
||||
|
||||
if WorldMapQuestScrollChildFrame.selected then
|
||||
WorldMapBlobFrame:DrawQuestBlob(WorldMapQuestScrollChildFrame.selected.questId, false)
|
||||
end
|
||||
end
|
||||
|
||||
local WORLDMAP_POI_MIN_X = 12
|
||||
local WORLDMAP_POI_MIN_Y = -12
|
||||
local WORLDMAP_POI_MAX_X -- changes based on current scale, see WorldMapFrame_SetPOIMaxBounds
|
||||
local WORLDMAP_POI_MAX_Y -- changes based on current scale, see WorldMapFrame_SetPOIMaxBounds
|
||||
|
||||
function Mapster:WorldMapFrame_DisplayQuestPOI(questFrame, isComplete)
|
||||
-- Recalculate Position to adjust for Scale
|
||||
local _, posX, posY = QuestPOIGetIconInfo(questFrame.questId)
|
||||
if posX and posY then
|
||||
local POIscale = WORLDMAP_SETTINGS.size
|
||||
posX = posX * WorldMapDetailFrame:GetWidth() * POIscale
|
||||
posY = -posY * WorldMapDetailFrame:GetHeight() * POIscale
|
||||
|
||||
-- keep outlying POIs within map borders
|
||||
if ( posY > WORLDMAP_POI_MIN_Y ) then
|
||||
posY = WORLDMAP_POI_MIN_Y
|
||||
elseif ( posY < WORLDMAP_POI_MAX_Y ) then
|
||||
posY = WORLDMAP_POI_MAX_Y
|
||||
end
|
||||
if ( posX < WORLDMAP_POI_MIN_X ) then
|
||||
posX = WORLDMAP_POI_MIN_X
|
||||
elseif ( posX > WORLDMAP_POI_MAX_X ) then
|
||||
posX = WORLDMAP_POI_MAX_X
|
||||
end
|
||||
questFrame.poiIcon:SetPoint("CENTER", "WorldMapPOIFrame", "TOPLEFT", posX / db.poiScale, posY / db.poiScale)
|
||||
questFrame.poiIcon:SetScale(db.poiScale)
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:WorldMapFrame_SetPOIMaxBounds()
|
||||
WORLDMAP_POI_MAX_Y = WorldMapDetailFrame:GetHeight() * -WORLDMAP_SETTINGS.size + 12;
|
||||
WORLDMAP_POI_MAX_X = WorldMapDetailFrame:GetWidth() * WORLDMAP_SETTINGS.size + 12;
|
||||
end
|
||||
|
||||
function Mapster:Refresh()
|
||||
db_ = self.db.profile
|
||||
|
||||
for k,v in self:IterateModules() do
|
||||
if self:GetModuleEnabled(k) and not v:IsEnabled() then
|
||||
self:EnableModule(k)
|
||||
elseif not self:GetModuleEnabled(k) and v:IsEnabled() then
|
||||
self:DisableModule(k)
|
||||
end
|
||||
if type(v.Refresh) == "function" then
|
||||
v:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
if (db.miniMap and not self.miniMap) then
|
||||
self:SizeDown()
|
||||
elseif (not db.miniMap and self.miniMap) then
|
||||
self:SizeUp()
|
||||
end
|
||||
self.miniMap = db.miniMap
|
||||
|
||||
self:SetStrata()
|
||||
self:SetAlpha()
|
||||
self:SetArrow()
|
||||
self:SetScale()
|
||||
self:SetPosition()
|
||||
|
||||
if self.optionsButton then
|
||||
if db.hideMapButton then
|
||||
self.optionsButton:Hide()
|
||||
else
|
||||
self.optionsButton:Show()
|
||||
end
|
||||
end
|
||||
|
||||
self:UpdateBorderVisibility()
|
||||
self:UpdateMouseInteractivity()
|
||||
self:UpdateModuleMapsizes()
|
||||
WorldMapFrame_UpdateQuests()
|
||||
end
|
||||
|
||||
function Mapster:ToggleMapSize()
|
||||
self.miniMap = not self.miniMap
|
||||
db.miniMap = self.miniMap
|
||||
ToggleFrame(WorldMapFrame)
|
||||
if self.miniMap then
|
||||
self:SizeDown()
|
||||
else
|
||||
self:SizeUp()
|
||||
end
|
||||
self:SetAlpha()
|
||||
self:SetPosition()
|
||||
|
||||
-- Notify the modules about the map size change,
|
||||
-- so they can re-anchor frames or stuff like that.
|
||||
self:UpdateModuleMapsizes()
|
||||
|
||||
self:UpdateBorderVisibility()
|
||||
self:UpdateMouseInteractivity()
|
||||
|
||||
ToggleFrame(WorldMapFrame)
|
||||
WorldMapFrame_UpdateQuests()
|
||||
end
|
||||
|
||||
function Mapster:UpdateModuleMapsizes()
|
||||
for k,v in self:IterateModules() do
|
||||
if v:IsEnabled() and type(v.UpdateMapsize) == "function" then
|
||||
v:UpdateMapsize(self.miniMap)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:SizeUp()
|
||||
WORLDMAP_SETTINGS.size = WORLDMAP_QUESTLIST_SIZE
|
||||
-- adjust main frame
|
||||
WorldMapFrame:SetWidth(1024)
|
||||
WorldMapFrame:SetHeight(768)
|
||||
-- adjust map frames
|
||||
WorldMapPositioningGuide:ClearAllPoints()
|
||||
WorldMapPositioningGuide:SetPoint("CENTER")
|
||||
WorldMapDetailFrame:SetScale(WORLDMAP_QUESTLIST_SIZE)
|
||||
WorldMapDetailFrame:SetPoint("TOPLEFT", WorldMapPositioningGuide, "TOP", -726, -99)
|
||||
WorldMapButton:SetScale(WORLDMAP_QUESTLIST_SIZE)
|
||||
WorldMapFrameAreaFrame:SetScale(WORLDMAP_QUESTLIST_SIZE)
|
||||
WorldMapBlobFrame:SetScale(WORLDMAP_QUESTLIST_SIZE)
|
||||
WorldMapBlobFrame.xRatio = nil -- force hit recalculations
|
||||
-- show big window elements
|
||||
WorldMapZoneMinimapDropDown:Show()
|
||||
WorldMapZoomOutButton:Show()
|
||||
WorldMapZoneDropDown:Show()
|
||||
WorldMapContinentDropDown:Show()
|
||||
WorldMapQuestScrollFrame:Show()
|
||||
WorldMapQuestDetailScrollFrame:Show()
|
||||
WorldMapQuestRewardScrollFrame:Show()
|
||||
WorldMapFrameSizeDownButton:Show()
|
||||
-- hide small window elements
|
||||
WorldMapFrameMiniBorderLeft:Hide()
|
||||
WorldMapFrameMiniBorderRight:Hide()
|
||||
WorldMapFrameSizeUpButton:Hide()
|
||||
-- floor dropdown
|
||||
WorldMapLevelDropDown:SetPoint("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -50, -35)
|
||||
WorldMapLevelDropDown.header:Show()
|
||||
-- tiny adjustments
|
||||
WorldMapFrameCloseButton:SetPoint("TOPRIGHT", WorldMapPositioningGuide, 4, 4)
|
||||
WorldMapFrameSizeDownButton:SetPoint("TOPRIGHT", WorldMapPositioningGuide, -16, 4)
|
||||
WorldMapTrackQuest:SetPoint("BOTTOMLEFT", WorldMapPositioningGuide, "BOTTOMLEFT", 16, 4)
|
||||
WorldMapFrameTitle:ClearAllPoints()
|
||||
WorldMapFrameTitle:SetPoint("CENTER", 0, 372)
|
||||
|
||||
MapsterQuestObjectivesDropDown:Show()
|
||||
|
||||
WorldMapFrame_SetPOIMaxBounds()
|
||||
--WorldMapQuestShowObjectives_AdjustPosition()
|
||||
self:WorldMapFrame_DisplayQuests()
|
||||
|
||||
self.optionsButton:SetPoint("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -43, -2)
|
||||
end
|
||||
|
||||
function Mapster:SizeDown()
|
||||
WORLDMAP_SETTINGS.size = WORLDMAP_WINDOWED_SIZE
|
||||
-- adjust main frame
|
||||
WorldMapFrame:SetWidth(623)
|
||||
WorldMapFrame:SetHeight(437)
|
||||
-- adjust map frames
|
||||
WorldMapPositioningGuide:ClearAllPoints()
|
||||
WorldMapPositioningGuide:SetAllPoints()
|
||||
WorldMapDetailFrame:SetScale(WORLDMAP_WINDOWED_SIZE)
|
||||
WorldMapButton:SetScale(WORLDMAP_WINDOWED_SIZE)
|
||||
WorldMapFrameAreaFrame:SetScale(WORLDMAP_WINDOWED_SIZE)
|
||||
WorldMapBlobFrame:SetScale(WORLDMAP_WINDOWED_SIZE)
|
||||
WorldMapBlobFrame.xRatio = nil -- force hit recalculations
|
||||
WorldMapFrameMiniBorderLeft:SetPoint("TOPLEFT", 10, -14)
|
||||
WorldMapDetailFrame:SetPoint("TOPLEFT", 37, -66)
|
||||
-- hide big window elements
|
||||
WorldMapZoneMinimapDropDown:Hide()
|
||||
WorldMapZoomOutButton:Hide()
|
||||
WorldMapZoneDropDown:Hide()
|
||||
WorldMapContinentDropDown:Hide()
|
||||
WorldMapLevelDropDown:Hide()
|
||||
WorldMapLevelUpButton:Hide()
|
||||
WorldMapLevelDownButton:Hide()
|
||||
WorldMapQuestScrollFrame:Hide()
|
||||
WorldMapQuestDetailScrollFrame:Hide()
|
||||
WorldMapQuestRewardScrollFrame:Hide()
|
||||
WorldMapFrameSizeDownButton:Hide()
|
||||
-- show small window elements
|
||||
WorldMapFrameMiniBorderLeft:Show()
|
||||
WorldMapFrameMiniBorderRight:Show()
|
||||
WorldMapFrameSizeUpButton:Show()
|
||||
-- floor dropdown
|
||||
WorldMapLevelDropDown:SetPoint("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -441, -35)
|
||||
WorldMapLevelDropDown:SetFrameLevel(WORLDMAP_POI_FRAMELEVEL + 2)
|
||||
WorldMapLevelDropDown.header:Hide()
|
||||
-- tiny adjustments
|
||||
WorldMapFrameCloseButton:SetPoint("TOPRIGHT", WorldMapFrameMiniBorderRight, "TOPRIGHT", -44, 5)
|
||||
WorldMapFrameSizeDownButton:SetPoint("TOPRIGHT", WorldMapFrameMiniBorderRight, "TOPRIGHT", -66, 5)
|
||||
WorldMapTrackQuest:SetPoint("BOTTOMLEFT", WorldMapDetailFrame, "BOTTOMLeft", 2, -26)
|
||||
WorldMapFrameTitle:ClearAllPoints()
|
||||
WorldMapFrameTitle:SetPoint("TOP", WorldMapDetailFrame, 0, 20)
|
||||
|
||||
MapsterQuestObjectivesDropDown:Hide()
|
||||
|
||||
WorldMapFrame_SetPOIMaxBounds()
|
||||
--WorldMapQuestShowObjectives_AdjustPosition()
|
||||
|
||||
self.optionsButton:SetPoint("TOPRIGHT", WorldMapFrameMiniBorderRight, "TOPRIGHT", -93, -2)
|
||||
end
|
||||
|
||||
local function getZoneId()
|
||||
return (GetCurrentMapZone() + GetCurrentMapContinent() * 100)
|
||||
end
|
||||
|
||||
function Mapster:ZONE_CHANGED_NEW_AREA()
|
||||
local curZone = getZoneId()
|
||||
if realZone == curZone or ((curZone % 100) > 0 and (GetPlayerMapPosition("player")) ~= 0) then
|
||||
SetMapToCurrentZone()
|
||||
realZone = getZoneId()
|
||||
end
|
||||
end
|
||||
|
||||
local oldBFMOnUpdate
|
||||
function wmfOnShow(frame)
|
||||
Mapster:SetStrata()
|
||||
Mapster:SetScale()
|
||||
realZone = getZoneId()
|
||||
if BattlefieldMinimap then
|
||||
oldBFMOnUpdate = BattlefieldMinimap:GetScript("OnUpdate")
|
||||
BattlefieldMinimap:SetScript("OnUpdate", nil)
|
||||
end
|
||||
|
||||
if WORLDMAP_SETTINGS.selectedQuest then
|
||||
WorldMapFrame_SelectQuestFrame(WORLDMAP_SETTINGS.selectedQuest)
|
||||
end
|
||||
end
|
||||
|
||||
function wmfOnHide(frame)
|
||||
SetMapToCurrentZone()
|
||||
if BattlefieldMinimap then
|
||||
BattlefieldMinimap:SetScript("OnUpdate", oldBFMOnUpdate or BattlefieldMinimap_OnUpdate)
|
||||
end
|
||||
end
|
||||
|
||||
function wmfStartMoving(frame)
|
||||
Mapster:HideBlobs()
|
||||
|
||||
frame:StartMoving()
|
||||
end
|
||||
|
||||
function wmfStopMoving(frame)
|
||||
frame:StopMovingOrSizing()
|
||||
LibWindow.SavePosition(frame)
|
||||
|
||||
Mapster:ShowBlobs()
|
||||
end
|
||||
|
||||
function dropdownScaleFix(self)
|
||||
ToggleDropDownMenu(nil, nil, self:GetParent())
|
||||
DropDownList1:SetScale(db.scale)
|
||||
end
|
||||
|
||||
function Mapster:ShowBlobs()
|
||||
WorldMapBlobFrame_CalculateHitTranslations()
|
||||
if WORLDMAP_SETTINGS.selectedQuest and not WORLDMAP_SETTINGS.selectedQuest.completed then
|
||||
WorldMapBlobFrame:DrawQuestBlob(WORLDMAP_SETTINGS.selectedQuest.questId, true)
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:HideBlobs()
|
||||
if WORLDMAP_SETTINGS.selectedQuest then
|
||||
WorldMapBlobFrame:DrawQuestBlob(WORLDMAP_SETTINGS.selectedQuest.questId, false)
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:SetStrata()
|
||||
WorldMapFrame:SetFrameStrata(db.strata)
|
||||
end
|
||||
|
||||
function Mapster:SetAlpha()
|
||||
WorldMapFrame:SetAlpha(db.alpha)
|
||||
end
|
||||
|
||||
function Mapster:SetArrow()
|
||||
PlayerArrowFrame:SetModelScale(db.arrowScale)
|
||||
PlayerArrowEffectFrame:SetModelScale(db.arrowScale)
|
||||
end
|
||||
|
||||
function Mapster:SetScale()
|
||||
WorldMapFrame:SetScale(db.scale)
|
||||
end
|
||||
|
||||
function Mapster:SetPosition()
|
||||
LibWindow.RestorePosition(WorldMapFrame)
|
||||
end
|
||||
|
||||
function Mapster:GetModuleEnabled(module)
|
||||
return db.modules[module]
|
||||
end
|
||||
|
||||
function Mapster:UpdateBorderVisibility()
|
||||
if db.hideBorder then
|
||||
Mapster.bordersVisible = false
|
||||
if self.miniMap then
|
||||
WorldMapFrameMiniBorderLeft:Hide()
|
||||
WorldMapFrameMiniBorderRight:Hide()
|
||||
--WorldMapQuestShowObjectives:SetPoint("BOTTOMRIGHT", WorldMapDetailFrame, "TOPRIGHT", -50 - WorldMapQuestShowObjectivesText:GetWidth(), 2);
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
WorldMapFrameTitle:Hide()
|
||||
self:RegisterEvent("WORLD_MAP_UPDATE", "UpdateDetailTiles")
|
||||
self:UpdateDetailTiles()
|
||||
self.optionsButton:Hide()
|
||||
if not self.hookedOnUpdate then
|
||||
self:HookScript(WorldMapFrame, "OnUpdate", "UpdateMapElements")
|
||||
self.hookedOnUpdate = true
|
||||
end
|
||||
self:UpdateMapElements()
|
||||
else
|
||||
Mapster.bordersVisible = true
|
||||
if self.miniMap then
|
||||
WorldMapFrameMiniBorderLeft:Show()
|
||||
WorldMapFrameMiniBorderRight:Show()
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
--WorldMapQuestShowObjectives_AdjustPosition()
|
||||
WorldMapFrameTitle:Show()
|
||||
self:UnregisterEvent("WORLD_MAP_UPDATE")
|
||||
self:UpdateDetailTiles()
|
||||
if not db.hideMapButton then
|
||||
self.optionsButton:Show()
|
||||
end
|
||||
if self.hookedOnUpdate then
|
||||
self:Unhook(WorldMapFrame, "OnUpdate")
|
||||
self.hookedOnUpdate = nil
|
||||
end
|
||||
self:UpdateMapElements()
|
||||
end
|
||||
|
||||
for k,v in self:IterateModules() do
|
||||
if v:IsEnabled() and type(v.BorderVisibilityChanged) == "function" then
|
||||
v:BorderVisibilityChanged(not db.hideBorder)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:UpdateMapElements()
|
||||
local mouseOver = WorldMapFrame:IsMouseOver()
|
||||
if self.elementsHidden and (mouseOver or not db.hideBorder) then
|
||||
self.elementsHidden = nil
|
||||
(self.miniMap and WorldMapFrameSizeUpButton or WorldMapFrameSizeDownButton):Show()
|
||||
WorldMapFrameCloseButton:Show()
|
||||
--WorldMapQuestShowObjectives:Show()
|
||||
for _, frame in pairs(self.elementsToHide) do
|
||||
frame:Show()
|
||||
end
|
||||
elseif not self.elementsHidden and not mouseOver and db.hideBorder then
|
||||
self.elementsHidden = true
|
||||
WorldMapFrameSizeUpButton:Hide()
|
||||
WorldMapFrameSizeDownButton:Hide()
|
||||
WorldMapFrameCloseButton:Hide()
|
||||
--WorldMapQuestShowObjectives:Hide()
|
||||
for _, frame in pairs(self.elementsToHide) do
|
||||
frame:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:UpdateMouseInteractivity()
|
||||
if db.disableMouse then
|
||||
WorldMapButton:EnableMouse(false)
|
||||
WorldMapFrame:EnableMouse(false)
|
||||
else
|
||||
WorldMapButton:EnableMouse(true)
|
||||
WorldMapFrame:EnableMouse(true)
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:RefreshQuestObjectivesDisplay()
|
||||
WorldMapQuestShowObjectives:SetChecked(db.questObjectives ~= 0)
|
||||
WorldMapQuestShowObjectives:GetScript("OnClick")(WorldMapQuestShowObjectives)
|
||||
end
|
||||
|
||||
function Mapster:WorldMapFrame_DisplayQuests()
|
||||
if WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then return end
|
||||
if WatchFrame.showObjectives and WorldMapFrame.numQuests > 0 then
|
||||
if db.questObjectives == 1 then
|
||||
WorldMapFrame_SetFullMapView()
|
||||
|
||||
WorldMapBlobFrame:SetScale(WORLDMAP_FULLMAP_SIZE)
|
||||
WorldMapBlobFrame.xRatio = nil -- force hit recalculations
|
||||
WorldMapFrame_SetPOIMaxBounds()
|
||||
WorldMapFrame_UpdateQuests()
|
||||
elseif db.questObjectives == 2 then
|
||||
WorldMapFrame_SetQuestMapView()
|
||||
|
||||
WorldMapBlobFrame:SetScale(WORLDMAP_QUESTLIST_SIZE)
|
||||
WorldMapBlobFrame.xRatio = nil -- force hit recalculations
|
||||
WorldMapFrame_SetPOIMaxBounds()
|
||||
WorldMapFrame_UpdateQuests()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function hasOverlays()
|
||||
if Mapster:GetModuleEnabled("FogClear") then
|
||||
return Mapster:GetModule("FogClear"):RealHasOverlays()
|
||||
else
|
||||
return GetNumMapOverlays() > 0
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:UpdateDetailTiles()
|
||||
if db.hideBorder and GetCurrentMapZone() > 0 and hasOverlays() then
|
||||
for i=1, NUM_WORLDMAP_DETAIL_TILES do
|
||||
_G["WorldMapDetailTile"..i]:Hide()
|
||||
end
|
||||
else
|
||||
for i=1, NUM_WORLDMAP_DETAIL_TILES do
|
||||
_G["WorldMapDetailTile"..i]:Show()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Mapster:SetModuleEnabled(module, value)
|
||||
local old = db.modules[module]
|
||||
db.modules[module] = value
|
||||
if old ~= value then
|
||||
if value then
|
||||
self:EnableModule(module)
|
||||
else
|
||||
self:DisableModule(module)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function questObjDropDownOnClick(button)
|
||||
UIDropDownMenu_SetSelectedValue(MapsterQuestObjectivesDropDown, button.value)
|
||||
db.questObjectives = button.value
|
||||
Mapster:RefreshQuestObjectivesDisplay()
|
||||
end
|
||||
|
||||
local questObjTexts = {
|
||||
[0] = L["Hide Completely"],
|
||||
[1] = L["Only WorldMap Blobs"],
|
||||
[2] = L["Blobs & Panels"],
|
||||
}
|
||||
|
||||
function questObjDropDownInit()
|
||||
local info = UIDropDownMenu_CreateInfo()
|
||||
local value = db.questObjectives
|
||||
|
||||
for i=0,2 do
|
||||
info.value = i
|
||||
info.text = questObjTexts[i]
|
||||
info.func = questObjDropDownOnClick
|
||||
if ( value == i ) then
|
||||
info.checked = 1
|
||||
UIDropDownMenu_SetText(MapsterQuestObjectivesDropDown, info.text)
|
||||
else
|
||||
info.checked = nil
|
||||
end
|
||||
UIDropDownMenu_AddButton(info)
|
||||
end
|
||||
end
|
||||
|
||||
function questObjDropDownUpdate()
|
||||
UIDropDownMenu_SetSelectedValue(MapsterQuestObjectivesDropDown, db.questObjectives)
|
||||
UIDropDownMenu_SetText(MapsterQuestObjectivesDropDown,questObjTexts[db.questObjectives])
|
||||
end
|
||||
@@ -0,0 +1,43 @@
|
||||
## Interface: 30300
|
||||
## Notes: Simple Map Mod
|
||||
## Notes-zhCN: 简单实用的地图模块
|
||||
## Notes-frFR: Simples modifications de la carte.
|
||||
## Title: Mapster
|
||||
## Author: Nevcairiel
|
||||
## SavedVariables: MapsterDB
|
||||
## X-Category: Map
|
||||
## Version: @project-version@
|
||||
## X-License: All rights reserved.
|
||||
|
||||
## OptionalDeps: Ace3, LibBabble-Zone-3.0, LibWindow-1.1
|
||||
|
||||
#@no-lib-strip@
|
||||
Libs\LibStub\LibStub.lua
|
||||
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
|
||||
|
||||
Libs\AceAddon-3.0\AceAddon-3.0.xml
|
||||
Libs\AceEvent-3.0\AceEvent-3.0.xml
|
||||
Libs\AceHook-3.0\AceHook-3.0.xml
|
||||
Libs\AceDB-3.0\AceDB-3.0.xml
|
||||
Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
|
||||
Libs\AceLocale-3.0\AceLocale-3.0.xml
|
||||
|
||||
Libs\AceGUI-3.0\AceGUI-3.0.xml
|
||||
Libs\AceConsole-3.0\AceConsole-3.0.xml
|
||||
Libs\AceConfig-3.0\AceConfig-3.0.xml
|
||||
|
||||
Libs\LibBabble-Zone-3.0\lib.xml
|
||||
Libs\LibWindow-1.1\LibWindow-1.1.lua
|
||||
#@end-no-lib-strip@
|
||||
|
||||
Locale\locale.xml
|
||||
|
||||
Mapster.lua
|
||||
Config.lua
|
||||
|
||||
Coords.lua
|
||||
GroupIcons.lua
|
||||
BattleMap.lua
|
||||
FogClear.lua
|
||||
InstanceMaps.lua
|
||||
Scaling.lua
|
||||
@@ -0,0 +1,127 @@
|
||||
--[[
|
||||
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes@gmail.com >
|
||||
All rights reserved.
|
||||
|
||||
Initial implementation provided by yssaril
|
||||
]]
|
||||
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster")
|
||||
|
||||
local MODNAME= "Scale"
|
||||
local Scale = Mapster:NewModule(MODNAME)
|
||||
|
||||
local LibWindow = LibStub("LibWindow-1.1")
|
||||
|
||||
local scaler, mousetracker
|
||||
local SOS = { --Scaler Original State
|
||||
dist = 0,
|
||||
x = 0,
|
||||
y = 0,
|
||||
left = 0,
|
||||
top = 0,
|
||||
scale = 1,
|
||||
}
|
||||
|
||||
local GetScaleDistance, OnUpdate
|
||||
|
||||
function Scale:OnInitialize()
|
||||
self:SetEnabledState(Mapster:GetModuleEnabled(MODNAME))
|
||||
end
|
||||
|
||||
function Scale:OnEnable()
|
||||
if not scaler then
|
||||
scaler = WorldMapPositioningGuide:CreateTexture(nil, "OVERLAY")
|
||||
scaler:SetWidth(20)
|
||||
scaler:SetHeight(20)
|
||||
self:UpdateMapsize(Mapster.miniMap)
|
||||
scaler:SetTexture([[Interface\BUTTONS\UI-AutoCastableOverlay]])
|
||||
scaler:SetTexCoord(0.619, 0.760, 0.612, 0.762)
|
||||
scaler:SetDesaturated(true)
|
||||
|
||||
mousetracker = CreateFrame("Frame", nil, WorldMapPositioningGuide)
|
||||
mousetracker:SetFrameStrata("TOOLTIP")
|
||||
mousetracker:SetAllPoints(scaler)
|
||||
mousetracker:EnableMouse(true)
|
||||
mousetracker:SetScript("OnEnter", function()
|
||||
scaler:SetDesaturated(false)
|
||||
end)
|
||||
mousetracker:SetScript("OnLeave", function()
|
||||
scaler:SetDesaturated(true)
|
||||
end)
|
||||
mousetracker:SetScript("OnMouseUp", function(self)
|
||||
LibWindow.SavePosition(WorldMapFrame)
|
||||
self:SetScript("OnUpdate", nil)
|
||||
self:SetAllPoints(scaler)
|
||||
Mapster:ShowBlobs()
|
||||
end)
|
||||
mousetracker:SetScript("OnMouseDown",function(self)
|
||||
Mapster:HideBlobs()
|
||||
SOS.left, SOS.top = WorldMapFrame:GetLeft(), WorldMapFrame:GetTop()
|
||||
SOS.scale = WorldMapFrame:GetScale()
|
||||
SOS.x, SOS.y = SOS.left, SOS.top-(UIParent:GetHeight()/SOS.scale)
|
||||
SOS.EFscale = WorldMapFrame:GetEffectiveScale()
|
||||
SOS.dist = GetScaleDistance()
|
||||
self:SetScript("OnUpdate", OnUpdate)
|
||||
self:SetAllPoints(UIParent)
|
||||
end)
|
||||
tinsert(Mapster.elementsToHide, scaler)
|
||||
end
|
||||
scaler:Show()
|
||||
mousetracker:Show()
|
||||
end
|
||||
|
||||
function Scale:OnDisable()
|
||||
if scaler then
|
||||
scaler:Hide()
|
||||
moustracker:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function GetScaleDistance() -- distance from cursor to TopLeft :)
|
||||
local left, top = SOS.left, SOS.top
|
||||
local scale = SOS.EFscale
|
||||
|
||||
local x, y = GetCursorPosition()
|
||||
local x = x/scale - left
|
||||
local y = top - y/scale
|
||||
|
||||
return sqrt(x*x+y*y)
|
||||
end
|
||||
|
||||
function OnUpdate(self)
|
||||
local scale = GetScaleDistance()/SOS.dist*SOS.scale
|
||||
if scale < .2 then -- clamp min and max scale
|
||||
scale = .2
|
||||
elseif scale > 1.5 then
|
||||
scale = 1.5
|
||||
end
|
||||
WorldMapFrame:SetScale(scale)
|
||||
|
||||
local s = SOS.scale/WorldMapFrame:GetScale()
|
||||
local x = SOS.x*s
|
||||
local y = SOS.y*s
|
||||
WorldMapFrame:ClearAllPoints()
|
||||
WorldMapFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", x, y)
|
||||
end
|
||||
|
||||
function Scale:UpdateMapsize(mini)
|
||||
if not scaler then return end
|
||||
-- map was minimized, fix display position
|
||||
if mini then
|
||||
if Mapster.bordersVisible then
|
||||
scaler:SetPoint("BOTTOMRIGHT", -23, -12)
|
||||
else
|
||||
scaler:SetPoint("BOTTOMRIGHT", -26, 16)
|
||||
end
|
||||
else
|
||||
if Mapster.bordersVisible then
|
||||
scaler:SetPoint("BOTTOMRIGHT", -4, 4)
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Scale:BorderVisibilityChanged()
|
||||
self:UpdateMapsize(Mapster.miniMap)
|
||||
end
|
||||
Reference in New Issue
Block a user