⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alphamap.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 4 页
字号:
					temp:SetPoint("CENTER", "AlphaMapDetailFrame", "TOPLEFT", (MapNotesGathering_Data[continent][zone][i].xPos)*AlphaMapDetailFrame:GetWidth(), -(MapNotesGathering_Data[continent][zone][i].yPos)*AlphaMapDetailFrame:GetHeight());
					getglobal("AlphaMapGatheringPOI"..i.."Texture"):SetTexture("Interface\\AddOns\\MapNotesGathering\\POIIcons\\Icon"..icon);
					temp:Show();
				else
					temp:Hide();
				end
			else
				temp:Hide();
			end
		end
		for i=(getn( MapNotesGathering_Data[continent][zone])+1 ), NUM_ALPHAMAP_GATHERNOTE_POIS, 1 do
			getglobal("AlphaMapGatheringPOI"..i):Hide();
		end
	else
		for i=1, NUM_ALPHAMAP_GATHERNOTE_POIS, 1 do
			getglobal("AlphaMapGatheringPOI"..i):Hide();
		end
	end
	
	-- ////////////////////////////////////////////////////////////////
	-- Gatherer 1.9.12 Pins
	-- ////////////////////////////////////////////////////////////////
	
	DrawAlphaMapGatherer();
	
end


-- Helper function to set the opacity of the AlphaMap
function SetAlphaMapOpacity()

	-- Determine the transparency from the alpha slider
	local alpha = 1.0 - this:GetValue();	
	local slider = 0;
	if (AlphaMapConfig.slider) then
		slider = 1;
	end
	AlphaMap_Alpha_Set(slider,alpha);
end

-- Function to extract the next param from the command line
function AlphaMap_Extract_NextParameter(msg)
	local params = msg;
	local command = params;
	local index = strfind(command, " ");
	if ( index ) then
		command = strsub(command, 1, index-1);
		params = strsub(params, index+1);
	else
		params = "";
	end
	return command, params;
end

-- Function to handle slash commands
function AlphaMap_Main_ChatCommandHandler(msg)
	local commandName, params = AlphaMap_Extract_NextParameter(msg);
	if ((commandName) and (strlen(commandName) > 0)) then
		commandName = string.lower(commandName);
	else
		commandName = "";
	end
	
	-- Check if we should toggle on/off the AlphaMap
	if( strfind( commandName, "tog" ) ) then
		ToggleAlphaMap();
		
	-- Check if we should lock the UI
	elseif( strfind( commandName, "lock" ) ) then
	
		AlphaMapConfig.lock = not AlphaMapConfig.lock;
		
		 if( AlphaMapConfig.lock == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_UILOCKED );
		 else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_UIUNLOCKED );
		 end
		
	-- Check if we should scale the window
	elseif( strfind( commandName, "scale" ) ) then
		AlphaMapConfig.scale = tonumber(params);
		
		if( not AlphaMapConfig.scale or AlphaMapConfig.scale < 0.0 ) then 
			AlphaMapConfig.scale = 1.0; 
		end
		
		AlphaMapFrame:SetScale( AlphaMapConfig.scale );
		
	-- Check if we should allow movement of the slider
	-- NOTE: This must be checked BEFORE "slider"
	elseif( strfind(commandName, "moveslider" ) ) then
		AlphaMapConfig.sliderlock = not AlphaMapConfig.sliderlock;
		
		if( AlphaMapConfig.sliderlock == false ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_SLIDERUNLOCKED );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_SLIDERLOCKED );
		end	
		
	-- Check if we should Toggle on/off display of the slider
	elseif (strfind(commandName, "slider")) then
		 ToggleSlider();
	
	--  Check if we should autoclose AM on combat
	elseif (strfind(commandName, "combat")) then
		 AlphaMapConfig.combat = not AlphaMapConfig.combat;
		 
		 if( AlphaMapConfig.combat == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_COMBATCLOSEENABLE );
		 else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_COMBATCLOSEDISABLE );
		 end
		 
	--  Check if we should show raid pins
	elseif (strfind(commandName, "raid")) then
		 AlphaMapConfig.raid = not AlphaMapConfig.raid;
		 
		 if( AlphaMapConfig.raid == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_RAIDPINENABLE );
		 else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_RAIDPINDISABLE );
		 end
		 
	-- check if we should display party/raid tooltips
	elseif (strfind(commandName, "ptips")) then
		AlphaMapConfig.ptips = not AlphaMapConfig.ptips;
		
		if( AlphaMapConfig.ptips == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_PARTYTIPENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_PARTYTIPDISABLE );
		end
		
	-- check if we should display Gatherer tooltips
	elseif( strfind( commandName, "mntips" ) ) then
		AlphaMapConfig.mntips = not AlphaMapConfig.mntips;
		
		if( AlphaMapConfig.mntips == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MAPNOTETIPENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MAPNOTETIPDISABLE );
		end
		
	-- check if we should display Gatherer tooltips
	elseif( strfind( commandName, "mngtips" ) ) then
		AlphaMapConfig.mngtips = not AlphaMapConfig.mngtips;
		
		if( AlphaMapConfig.mngtips == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MNGTIPSENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MNGTIPSDISABLE );
		end
		
	-- check if we should display Gatherer tooltips
	elseif (strfind(commandName, "gtips")) then
		AlphaMapConfig.gtips = not AlphaMapConfig.gtips;
		
		if( AlphaMapConfig.gtips == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GTIPSENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GTIPSDISABLE );
		end
		 
	-- Check if we should set the alpha
	elseif (strfind(commandName, "alpha")) then
		AlphaMapConfig.alpha = tonumber(params);

		local slider = 0;
		if (AlphaMapConfig.slider) then
			slider = 1;
		end
		AlphaMap_Alpha_Set(slider,alpha);
	
	-- Check if we should close AlphaMap when the World Map Closes
	elseif (strfind(commandName, "wmclose")) then
		AlphaMapConfig.wmclose = not AlphaMapConfig.wmclose;
		
		if( AlphaMapConfig.wmclose == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_WMCLOSEENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_WMCLOSEDISABLE );
		end
		
	-- Check if we should show MapNotes Gathering Pins
	elseif (strfind(commandName, "gathering")) then
		AlphaMapConfig.gathering = not AlphaMapConfig.gathering;
		
		if( AlphaMapConfig.gathering == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GATHERINGENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GATHERINGDISABLE );
		end
		
	-- Check if we should show Gatherer Pins
	elseif (strfind(commandName, "gatherer")) then
		AlphaMapConfig.gatherer = not AlphaMapConfig.gatherer;
		
		if( AlphaMapConfig.gatherer == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GATHERERENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_GATHERERDISABLE );
		end
		
	-- Check if we should show MapNotes Pins
	elseif (strfind(commandName, "mapnotes")) then
		AlphaMapConfig.mapnotes = not AlphaMapConfig.mapnotes;
		
		if( AlphaMapConfig.mapnotes == true ) then
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MAPNOTESENABLE );
		else
			DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_MAPNOTESDISABLE );
		end
				
	else
		-- If all else fails, output the help info
		--DEFAULT_CHAT_FRAME:AddMessage( "AlphaMap: /am [tog/lock/scale/slider/alpha/combat/ptips/wmclose/gatherer/gathering/mapnotes]" );
		
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE1 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE2 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE3 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE4 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE5 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE6 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE7 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE8 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE9 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE10 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE11 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE12 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE13 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE14 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE15 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE16 );
		DEFAULT_CHAT_FRAME:AddMessage( ALPHAMAP_USAGE17 );
	end
end


function DrawAlphaMapGatherer()

	local maxNotes = 500;
	local i = 1;
	
	if( GatherConfig and GatherConfig.useMainmap and AlphaMapConfig.gatherer == true ) then
	
		-- Get Current Conteninent and Zone
		local mapContinent  = GetCurrentMapContinent();
		local mapZone		= GetCurrentMapZone();
		
		if ((mapContinent ~= 0) and (mapZone ~= 0) and ( GatherItems[mapContinent] ) and 
				( GatherItems[mapContinent][mapZone] )) then
				
			-- Iterate through all the pins in the current zone
			for gatherName, gatherData in GatherItems[mapContinent][mapZone] do
				
				local gatherType   = "Default";
				local specificType = "";
				local allowed      = true;

				-- Check for specific types
				specificType = Gatherer_FindOreType(gatherName);
				if (specificType) then
					gatherType = "Ore";
					allowed = Gatherer_GetFilter("mining");
				else
					specificType = Gatherer_FindTreasureType(gatherName);
					if (specificType) then
						gatherType = "Treasure";
						allowed = Gatherer_GetFilter("treasure");
					else
						specificType = gatherName;
						gatherType = "Herb"; 
						allowed = Gatherer_GetFilter("herbs");
					end
				end
				
				if( not specificType ) then
					specificType = "default";
				end

				if( allowed ) then
					for hPos, gatherInfo in gatherData do
						if ((gatherInfo.x)   and (gatherInfo.y) and (gatherInfo.x>0) and 
						    (gatherInfo.y>0) and ( i <= maxNotes)) then
							
							-- Get the frame
							local mainNote = getglobal( "AlphaMapGathererPOI"..i );

							-- Determine coordinates for note
							local mnX,mnY;
							mnX =  gatherInfo.x / 100 * AlphaMapDetailFrame:GetWidth();
							mnY = -gatherInfo.y / 100 * AlphaMapDetailFrame:GetHeight();
							
							-- Set note properties
							--mainNote:SetAlpha(0.8);							
							mainNote:SetPoint( "CENTER", "AlphaMapDetailFrame", "TOPLEFT", mnX, mnY );
							mainNote:SetFrameLevel( this:GetFrameLevel() + 1 );
							mainNote.toolTip = Gatherer_TitleCase(specificType);

							if( not Gather_IconSet["iconic"][gatherType] ) then 
								gatherType = "Default"; 
							end
							
							local texture = Gather_IconSet["iconic"][gatherType][specificType];
							if( not texture ) then
								texture = Gather_IconSet["iconic"][gatherType]["default"];
							end

							local gathererTexture = getglobal( "AlphaMapGathererPOI"..i.."Texture" );
							gathererTexture:SetTexture( texture );
														
							mainNote:Show();
							
							i = i + 1;
						end
					end
				end
			end
		end
	end
	for j=i, maxNotes, 1 do
		local mainNote = getglobal( "AlphaMapGathererPOI"..j );
		mainNote:Hide();
	end
end



function AlphaMapNotes_OnEnter( id )

	if( MapNotes_Options and AlphaMapConfig.mntips == true ) then

		local x, y = this:GetCenter();
		local parentX, parentY = this:GetParent():GetCenter();
		
		if( x > parentX ) then
			AlphaMapTooltip:SetOwner( this, "ANCHOR_LEFT" );
		else
			AlphaMapTooltip:SetOwner( this, "ANCHOR_RIGHT" );
		end
			
		local zone		= MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()];
		local continent = GetCurrentMapContinent();
		local cNr		= MapNotes_Data[continent][zone][id].ncol;
		
		AlphaMapTooltip:SetText( MapNotes_Data[continent][zone][id].name, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b);
		
		if ((MapNotes_Data[continent][zone][id].inf1 ~= nil) and (MapNotes_Data[continent][zone][id].inf1 ~= "")) then
			cNr = MapNotes_Data[continent][zone][id].in1c;
			AlphaMapTooltip:AddLine(MapNotes_Data[continent][zone][id].inf1, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b);
		end
		if ((MapNotes_Data[continent][zone][id].inf2 ~= nil) and (MapNotes_Data[continent][zone][id].inf2 ~= "")) then
			cNr = MapNotes_Data[continent][zone][id].in2c;
			AlphaMapTooltip:AddLine(MapNotes_Data[continent][zone][id].inf2, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b);
		end
		
		AlphaMapTooltip:AddDoubleLine( MAPNOTES_CREATEDBY, MapNotes_Data[continent][zone][id].creator, 0.49, 0.39, 0.0, 0.49, 0.39, 0.0 );
		AlphaMapTooltip:Show();
	end
end

function AlphaMapNotes_OnLeave( id )
	AlphaMapTooltip:Hide();
end



function AlphaNotesGathering_OnEnter(id)

	if( MapNotesGathering_Data and AlphaMapConfig.gathering == true ) then
	
		local x, y = this:GetCenter();
		local parentX, parentY = this:GetParent():GetCenter();
		
		if( x > parentX ) then
			AlphaMapTooltip:SetOwner( this, "ANCHOR_LEFT" );
		else
			AlphaMapTooltip:SetOwner( this, "ANCHOR_RIGHT" );
		end
		
		local zone		= GetCurrentMapZone();
		local continent = GetCurrentMapContinent();
		
		AlphaMapTooltip:SetText(MapNotesGathering_Names[MapNotesGathering_Data[continent][zone][id].icon][MapNotesGathering_Data[continent][zone][id].subname], MapNotes_Colors[0].r, MapNotes_Colors[0].g, MapNotes_Colors[0].b);
		
		local xPos = MapNotesGathering_Data[continent][zone][id].xPos;
		local yPos = MapNotesGathering_Data[continent][zone][id].yPos;
		
		for i=1, getn(MapNotesGathering_Data[continent][zone]), 1 do
			if (i ~= id and abs(MapNotesGathering_Data[continent][zone][i].xPos - xPos) <= 0.0009765625 * MapNotes_MinDiff and abs(MapNotesGathering_Data[continent][zone][i].yPos - yPos) <= 0.0013020833 * MapNotes_MinDiff) then
				local icon = MapNotesGathering_Data[continent][zone][i].icon;
				
				if ((MapNotes_Options.showherbs and icon > 9 and icon <= 38 and MapNotes_Options["Gathering"][icon] ~= "off") or (MapNotes_Options.showveins and icon <= 9 and MapNotes_Options["Gathering"][icon] ~= "off") or (MapNotes_Options.showchests and icon == 39)) then
					AlphaMapTooltip:AddLine(MapNotesGathering_Names[icon][MapNotesGathering_Data[continent][zone][i].subname], MapNotes_Colors[0].r, MapNotes_Colors[0].g, MapNotes_Colors[0].b);
				end
			end
		end
		AlphaMapTooltip:Show();
	end
end

function AlphaNotesGathering_OnLeave(id)
	AlphaMapTooltip:Hide();
end






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -