📄 alphamap.lua
字号:
NUM_ALPHAMAP_DETAIL_TILES = 12;
NUM_ALPHAMAP_OVERLAYS = 40;
NUM_ALPHAMAP_POIS = 32;
ALPHAMAP_POI_TEXTURE_WIDTH = 64;
NUM_ALPHAMAP_POI_COLUMNS = 4;
NUM_ALPHAMAP_MAPNOTE_POIS = 100;
NUM_ALPHAMAP_GATHERNOTE_POIS = 200;
ALPHAMAP_INCREMENT = 0.10;
AlphaMapConfig = { enabled = true, alpha = 0.0, scale = 0.8, lock = false, combat = true,
ptips = true, gtips = false, mntips = false, mngtips = false,
wmclose = false, gathering = false, gatherer = false, mapnotes = false,
raid = true, sliderlock = true, slider = false };
-- This makes it so you can close the AlphaMap by hitting the ESC key
-- But if used, the world map will not open with AlphaMap open
-- UIPanelWindows["AlphaMapFrame"] = { area = "center", pushable = 0 };
-- Called whenever AlphaMap is loaded
function AlphaMapFrame_OnLoad()
SlashCmdList["ALPHAMAPSLASH"] = AlphaMap_Main_ChatCommandHandler;
SLASH_ALPHAMAPSLASH1 = "/AlphaMap";
SLASH_ALPHAMAPSLASH2 = "/am";
this:RegisterEvent( "WORLD_MAP_UPDATE" );
this:RegisterEvent( "ZONE_CHANGED_NEW_AREA" );
this:RegisterEvent( "VARIABLES_LOADED" );
this:RegisterEvent( "PLAYER_REGEN_DISABLED" );
this:RegisterEvent( "PLAYER_REGEN_ENABLED" );
AlphaMapFrame_Update();
end
function ChangeAlphaMapAlpha(toggle)
gLimAlphaMapAlpha = toggle;
-- Get the frames
alphaMapDetailFrame = getglobal( "AlphaMapDetailFrame" );
alphaMapSliderFrame = getglobal( "AlphaMapSliderFrame" );
-- Determine the transparency from the alpha slider
local alpha = 1.0 - alphaMapSliderFrame:GetValue();
-- Increment the opacity
alpha = toggle;
-- Clamp the opacity to 1.0
if alpha == "0" then
alpha = 0;
end;
if( alpha > 1.0 ) then
alpha = 1.0;
end
alphaMapDetailFrame:SetAlpha( alpha );
alphaMapSliderFrame:SetValue( 1 - alpha );
-- If there is 1 alpha, then hide the markers
end
function ChangeAlphaMapScale(toggle)
if ( toggle >= 0.1 and toggle <= 1) then
AlphaMapConfig.scale = toggle;
AlphaMapFrame:SetScale( AlphaMapConfig.scale );
end
end
function AlphaMap_Register()
gLim_RegisterButton (
"AlphaMap",
"透明地图设置",
"Interface\\AddOns\\AlphaMap\\Icon",
function()
gLimModSecBookShowConfig("gLimAlphaMap");
end,
1,
2
);
gLim_RegisterConfigClass(
"gLimAlphaMap",
"Alpha Map",
"Jeromy Walsh"
);
gLim_RegisterConfigSection(
"gLimAlphaMapSection",
"透明地图",
"透明地图设置",
"黑眼圈",
"gLimAlphaMap"
);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapShow",
"开启透明地图",
"选择开启游戏背景显示透明地图功能",
AlphaMapConfig.enabled,
ToggleAlphaMap,
"gLimAlphaMap"
);
ToggleAlphaMapMoveslider(AlphaMapConfig.enabled);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapLock",
"锁定透明地图",
"选择将锁定透明地图,使其无法移动",
AlphaMapConfig.lock,
function()
AlphaMap_Main_ChatCommandHandler("lock");
end,
"gLimAlphaMap"
);
--[[
gLim_RegisterConfigCheckBox(
"gLimAlphaMapSlider",
"开启透明度控制条",
"选择将在透明地图上显示透明度控制条.",
AlphaMapConfig.slider,
ToggleSlider,
"gLimAlphaMap"
);
]]
gLim_RegisterConfigSlider(
"gLimAlphaMapAlpha",
"设置透明地图的透明度",
"设置背景透明地图的透明度",
"透明度(0.0-1.0)",
"",
0.05,
0,
1,
AlphaMapConfig.alpha,
ChangeAlphaMapAlpha,
"gLimAlphaMap"
);
gLim_RegisterConfigSlider(
"gLimAlphaMapScale",
"缩放透明地图的大小",
"设置背景透明地图的大小.",
"尺寸(0.05-1.0)",
"",
0.05,
0.05,
1,
AlphaMapConfig.scale,
ChangeAlphaMapScale,
"gLimAlphaMap"
);
--[[
gLim_RegisterConfigCheckBox(
"gLimAlphaMapPtips",
"显示队伍标记",
"选择将在透明地图上显示队伍标记.",
AlphaMapConfig.ptips,
function()
AlphaMap_Main_ChatCommandHandler("ptips");
end,
"gLimAlphaMap"
);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapRaid",
"显示Raid标记",
"选择将在透明地图上显示Raid标记.",
AlphaMapConfig.raid,
function()
AlphaMap_Main_ChatCommandHandler("raid");
end,
"gLimAlphaMap"
);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapGtips",
"显示 Gatherer (原料采集) 标记",
"选择将在透明地图上显示原料采集的标记.",
AlphaMapConfig.gatherer,
function()
AlphaMap_Main_ChatCommandHandler("gatherer");
end,
"gLimAlphaMap"
);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapMntips",
"显示 MapNotes (地图标记) 标记",
"选择将在透明地图上显示地图标记的标记.",
AlphaMapConfig.mapnotes,
function()
AlphaMap_Main_ChatCommandHandler("mapnotes");
end,
"gLimAlphaMap"
);
---------------------
gLim_RegisterConfigCheckBox(
"gLimAlphaMapMngtips",
"显示 MapNotes Gathering 标记",
"选择将在透明地图上显示MapNotes Gathering的标记.",
AlphaMapConfig.gathering,
function()
AlphaMap_Main_ChatCommandHandler("gathering");
end,
"gLimAlphaMap"
);
---------------------
gLim_RegisterConfigCheckBox(
"gLimAlphaMapCombat",
"战斗自动隐藏",
"进入战斗状态战斗自动隐藏透明地图.",
AlphaMapConfig.combat,
function()
AlphaMap_Main_ChatCommandHandler("combat");
end,
"gLimAlphaMap"
);
gLim_RegisterConfigCheckBox(
"gLimAlphaMapWmClose",
"地图关闭时自动关闭",
"当关闭世界地图时自动关闭透明地图.",
AlphaMapConfig.wmclose,
function()
AlphaMap_Main_ChatCommandHandler("wmclose");
end,
"gLimAlphaMap"
);
]]
gLim_RegisterConfigButton(
"gLim_AlphaMap_bind",
"设置透明地图快捷键",
"设置透明背景地图",
"快捷键设置",
function()
gLimKeyBinding("HEADER_ALPHAMAP");
gLimConfigSubFrame:Hide();
end,
"gLimAlphaMap"
);
end
AlphaMap_LoadCount = 0;
function AlphaMap_Alpha_Set(checked, alpha)
AlphaMapConfig.slider = (checked==1);
if ( AlphaMapConfig.slider ) then
AlphaMapSliderFrame:Show();
else
AlphaMapSliderFrame:Hide();
end
if (AlphaMapConfig.alpha == alpha) then return; end
AlphaMapConfig.alpha = alpha;
if( not AlphaMapConfig.alpha or AlphaMapConfig.alpha < 0 ) then
AlphaMapConfig.alpha = 0.0;
end
if( AlphaMapConfig.alpha > 1.0 ) then
AlphaMapConfig.alpha = 1.0;
end
AlphaMapDetailFrame:SetAlpha( AlphaMapConfig.alpha );
AlphaMapSliderFrame:SetValue( 1 - AlphaMapConfig.alpha );
-- If there is 1 alpha, then hide the markers
if( AlphaMapConfig.alpha == 0.0 ) then
AlphaMapUnits:Hide();
else
AlphaMapUnits:Show();
end
if (Khaos) then
Khaos.setSetKeyParameter("AlphaMap", "AlphaMapAlpha", "checked", AlphaMapConfig.slider);
Khaos.setSetKeyParameter("AlphaMap", "AlphaMapAlpha", "slider", AlphaMapConfig.alpha);
end
if ( Cosmos_RegisterConfiguration ) then
Cosmos_UpdateValue("COS_ALPHAMAP_ALPHA",CSM_SLIDERVALUE,AlphaMapConfig.alpha);
end
if ( Cosmos_SetCVar ) then
Cosmos_SetCVar("COS_ALPHAMAP_ALPHA", AlphaMapConfig.alpha);
end
end
function AlphaMap_SCale_Set(checked, scale)
AlphaMapConfig.scale = scale;
if( not AlphaMapConfig.scale or AlphaMapConfig.scale < 0.0 ) then
AlphaMapConfig.scale = 1.0;
end
AlphaMapFrame:SetScale( AlphaMapConfig.scale );
end
function ToggleAlphaMapMoveslider(toggle)
if (toggle) then
AlphaMapConfig.sliderlock = (toggle==1);
else
AlphaMapConfig.sliderlock = not AlphaMapConfig.sliderlock;
end
end
function ToggleAlphaMapLock(toggle)
if (toggle) then
AlphaMapConfig.lock = (toggle==1);
else
AlphaMapConfig.lock = not AlphaMapConfig.lock;
end
end
function ToggleAlphaMapCombat(toggle)
if (toggle) then
AlphaMapConfig.combat = (toggle==1);
else
AlphaMapConfig.combat = not AlphaMapConfig.combat;
end
end
function ToggleAlphaMapRaid(toggle)
if (toggle) then
AlphaMapConfig.raid = (toggle==1);
else
AlphaMapConfig.raid = not AlphaMapConfig.raid;
end
end
function ToggleAlphaMapPtips(toggle)
if (toggle) then
AlphaMapConfig.ptips = (toggle==1);
else
AlphaMapConfig.ptips = not AlphaMapConfig.ptips;
end
end
function ToggleAlphaMapWmclose(toggle)
if (toggle) then
AlphaMapConfig.wmclose = (toggle==1);
else
AlphaMapConfig.wmclose = not AlphaMapConfig.wmclose;
end
end
function ToggleAlphaMapMapnotes(toggle)
if (toggle) then
AlphaMapConfig.mapnotes = (toggle==1);
else
AlphaMapConfig.mapnotes = not AlphaMapConfig.mapnotes;
end
end
function ToggleAlphaMapMntips(toggle)
if (toggle) then
AlphaMapConfig.mntips = (toggle==1);
else
AlphaMapConfig.mntips = not AlphaMapConfig.mntips;
end
end
function ToggleAlphaMapGathering(toggle)
if (toggle) then
AlphaMapConfig.gathering = (toggle==1);
else
AlphaMapConfig.gathering = not AlphaMapConfig.gathering;
end
end
function ToggleAlphaMapMngtips(toggle)
if (toggle) then
AlphaMapConfig.mngtips = (toggle==1);
else
AlphaMapConfig.mngtips = not AlphaMapConfig.mngtips;
end
end
function ToggleAlphaMapGatherer(toggle)
if (toggle) then
AlphaMapConfig.gatherer = (toggle==1);
else
AlphaMapConfig.gatherer = not AlphaMapConfig.gatherer;
end
end
function ToggleAlphaMapGtips(toggle)
if (toggle) then
AlphaMapConfig.gtips = (toggle==1);
else
AlphaMapConfig.gtips = not AlphaMapConfig.gtips;
end
end
function AlphaMap_RegisterCosmos()
if (Khaos) then
local optionSet={
id = "AlphaMap";
text = ALPHAMAP_CONFIG_HEADER;
helptext = ALPHAMAP_CONFIG_HEADER_INFO;
difficulty = 1;
default = false;
options = {
{
id="AlphaMapHeader";
type=K_HEADER;
text=ALPHAMAP_CONFIG_HEADER;
helptext=ALPHAMAP_CONFIG_HEADER_INFO;
difficulty = 1;
},
{
id="AlphaMapEnabled";
type=K_TEXT;
text=ALPHAMAP_ENABLED;
helptext=ALPHAMAP_ENABLED_INFO;
difficulty = 1;
callback=function(state) if (state.checked) then ToggleAlphaMap(1); else ToggleAlphaMap(0); end end;
feedback=function(state) if (state.checked) then return ALPHAMAP_TEXT_ENABLE; else return ALPHAMAP_TEXT_DISABLE; end end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -