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

📄 mapnotes.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 5 页
字号:
endfunction MapNotes_LoadZones2(...)	MapNotes_ZoneNames[2] = {};	for i=1, arg.n, 1 do		MapNotes_ZoneNames[2][MapNotes_ZoneShift[2][i]] = arg[i];	endendfunction MapNotes_GetZone() --because of the bug in SetToCurrentZone();      -- The texts of Ironforge don't match (Oystein). realzonetext returns the right one.      local zonetext = GetRealZoneText();     -- if( zonetext == "City of Ironforge") then      --   zonetext = "Ironforge";      --end	for i=1, 2, 1 do		local j = 1;		for k, value in MapNotes_ZoneNames[i] do			if (MapNotes_ZoneNames[i][j] == zonetext) then				return i, j;			end			j = j + 1;		end	end	return 0, 0;endfunction MapNotes_ImportCartoPlus()	if (CartoPlus_PointList) then		for z=101, 121, 1 do			local j = 1;			local continent = floor(z / 100);			local zone = z - (continent * 100);			if (CartoPlus_PointList[z] ~= nil) then				for k, value in CartoPlus_PointList[z] do					local i = 0;					for h, value in MapNotes_Data[continent][zone] do						i = i + 1;					end					if (i < MapNotes_NotesPerZone) then						local infotemp = gsub(CartoPlus_PointList[z][j].expla, string.char(10), " ");						local inf1temp;						local inf2temp;						if (strlen(infotemp) > 40) then							inf1temp = strsub(infotemp, 1, floor(strlen(infotemp)/2));							inf2temp = strsub(infotemp, floor(strlen(infotemp)/2 + 1));						else							inf1temp = infotemp;							inf2temp = "";						end						if (inf1temp == nil) then inf1temp = ""; end						if (inf2temp == nil) then inf2temp = ""; end						inf1temp = strsub(inf1temp, 1, 80);						inf2temp = strsub(inf2temp, 1, 80);						if (CartoPlus_PointList[z][j].icon > 9) then CartoPlus_PointList[z][j].icon = CartoPlus_PointList[z][j].icon - 10; end						MapNotes_TempData_Id = i + 1;						MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {};						MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = CartoPlus_PointList[z][j].title;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = inf1temp;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = inf2temp;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in2c = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].creator = UnitName("player");						MapNotes_Data[continent][zone][MapNotes_TempData_Id].icon = CartoPlus_PointList[z][j].icon;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = CartoPlus_PointList[z][j].x;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = CartoPlus_PointList[z][j].y;						CartoPlus_PointList[z][j] = nil;					end					j = j + 1;				end			end		end		for z=201, 225, 1 do			local j = 1;			local continent = floor(z / 100);			local zone = z - (continent * 100);			if (CartoPlus_PointList[z] ~= nil) then				for k, value in CartoPlus_PointList[z] do					local i = 0;					for h, value in MapNotes_Data[continent][zone] do						i = i + 1;					end					if (i < MapNotes_NotesPerZone) then						local infotemp = gsub(CartoPlus_PointList[z][j].expla, string.char(10), " ");						local inf1temp;						local inf2temp;						if (strlen(infotemp) > 40) then							inf1temp = strsub(infotemp, 1, floor(strlen(infotemp)/2));							inf2temp = strsub(infotemp, floor(strlen(infotemp)/2 + 1));						else							inf1temp = infotemp;							inf2temp = "";						end						if (inf1temp == nil) then inf1temp = ""; end						if (inf2temp == nil) then inf2temp = ""; end						inf1temp = strsub(inf1temp, 1, 80);						inf2temp = strsub(inf2temp, 1, 80);						if (CartoPlus_PointList[z][j].icon > 9) then CartoPlus_PointList[z][j].icon = CartoPlus_PointList[z][j].icon - 10; end						MapNotes_TempData_Id = i + 1;						MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {};						MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = CartoPlus_PointList[z][j].title;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = inf1temp;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = inf2temp;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in2c = 0;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].creator = UnitName("player");						MapNotes_Data[continent][zone][MapNotes_TempData_Id].icon = CartoPlus_PointList[z][j].icon;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = CartoPlus_PointList[z][j].x;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = CartoPlus_PointList[z][j].y;						CartoPlus_PointList[z][j] = nil;					end					j = j + 1;				end							end			end	endend-- <MapN> c<1> z<1> x<0.123123> y<0.123123> t<> i1<> i2<> cr<> i<8> tc<3> i1c<5> i2c<6>-- limit to 50 chars in every line...function MapNotes_GetNoteFromChat(note, who)	if (who ~= UnitName("player")) then		if (gsub(note,".*<MapN+>%s+%w+.*p<([^>]*)>.*","%1",1) == "1") then -- Party Note			local continent = gsub(note,".*<MapN+> c<([^>]*)>.*","%1",1) + 0;			local zone = gsub(note,".*<MapN+>%s+%w+.*z<([^>]*)>.*","%1",1) + 0;			local xPos = gsub(note,".*<MapN+>%s+%w+.*x<([^>]*)>.*","%1",1) + 0;			local yPos = gsub(note,".*<MapN+>%s+%w+.*y<([^>]*)>.*","%1",1) + 0;			MapNotes_PartyNoteData.continent = continent;			MapNotes_PartyNoteData.zone = zone;			MapNotes_PartyNoteData.xPos = xPos;			MapNotes_PartyNoteData.yPos = yPos;			MapNotes_StatusPrint(format(MAPNOTES_PARTY_GET, who, MapNotes_ZoneNames[continent][zone]));			if (MapNotes_MiniNote_Data.icon == "party" or MapNotes_Options[16] ~= "off") then				MapNotes_MiniNote_Data.id = -1;				MapNotes_MiniNote_Data.continent = continent;				MapNotes_MiniNote_Data.zone = zone;				MapNotes_MiniNote_Data.xPos = xPos;				MapNotes_MiniNote_Data.yPos = yPos;				MapNotes_MiniNote_Data.name = MAPNOTES_PARTYNOTE;				MapNotes_MiniNote_Data.color = 0; 				MapNotes_MiniNote_Data.icon = "party";				MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon);				MiniNotePOI:Show();			end		else			local continent = gsub(note,".*<MapN+> c<([^>]*)>.*","%1",1) + 0;			local zone = gsub(note,".*<MapN+>%s+%w+.*z<([^>]*)>.*","%1",1) + 0;			local xPos = gsub(note,".*<MapN+>%s+%w+.*x<([^>]*)>.*","%1",1) + 0;			local yPos = gsub(note,".*<MapN+>%s+%w+.*y<([^>]*)>.*","%1",1) + 0;			local title = gsub(note,".*<MapN+>%s+%w+.*t<([^>]*)>.*","%1",1);			local info1 = gsub(note,".*<MapN+>%s+%w+.*i1<([^>]*)>.*","%1",1);			local info2 = gsub(note,".*<MapN+>%s+%w+.*i2<([^>]*)>.*","%1",1);			local creator = gsub(note,".*<MapN+>%s+%w+.*cr<([^>]*)>.*","%1",1);			local icon = gsub(note,".*<MapN+>%s+%w+.*i<([^>]*)>.*","%1",1)+0;			local tcolor = gsub(note,".*<MapN+>%s+%w+.*tf<([^>]*)>.*","%1",1)+0;			local i1color = gsub(note,".*<MapN+>%s+%w+.*i1f<([^>]*)>.*","%1",1)+0;			local i2color = gsub(note,".*<MapN+>%s+%w+.*i2f<([^>]*)>.*","%1",1)+0;			if (MapNotes_LastReceivedNote_xPos == xPos and MapNotes_LastReceivedNote_yPos == yPos) then				-- do nothing, because the previous note is exactly the same as the current note			else			local checknote = MapNotes_CheckNearNotes(continent, zone, xPos, yPos);				MapNotes_LastReceivedNote_xPos = xPos;				MapNotes_LastReceivedNote_yPos = yPos;					if (checknote) then					MapNotes_StatusPrint(format(MAPNOTES_DECLINE_NOTETONEAR, who, MapNotes_ZoneNames[continent][zone], MapNotes_Data[continent][zone][checknote].name));					return;				end				local id = 0;				local i = 0;				for j, value in MapNotes_Data[continent][zone] do					i = i + 1;				end				if (MapNotes_SetNextAsMiniNote ~= 2) then					if ((MapNotes_AllowOneNote == 1 and i < MapNotes_NotesPerZone) or (MapNotes_Options[14] ~= "off" and MapNotes_Options[15] == "off" and i < MapNotes_NotesPerZone) or (MapNotes_Options[14] ~= "off" and MapNotes_Options[15] ~= "off" and i < MapNotes_NotesPerZone - 5)) then						MapNotes_TempData_Id = i + 1;						MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {};						MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = title;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = tcolor;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = info1;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = i1color;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = info2;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].in2c = i2color;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].creator = creator;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].icon = icon;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = xPos;						MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = yPos;						id = MapNotes_TempData_Id;						MapNotes_StatusPrint(format(MAPNOTES_ACCEPT_GET, who, MapNotes_ZoneNames[continent][zone]));					else						MapNotes_StatusPrint(format(MAPNOTES_DECLINE_GET, who, MapNotes_ZoneNames[continent][zone]));					end				end				if (MapNotes_SetNextAsMiniNote ~= 0) then					MapNotes_MiniNote_Data.xPos = xPos;					MapNotes_MiniNote_Data.yPos = xPos;					MapNotes_MiniNote_Data.continent = continent;					MapNotes_MiniNote_Data.zone = zone;					MapNotes_MiniNote_Data.id = id; -- only shown if the note was written...					MapNotes_MiniNote_Data.name = title;					MapNotes_MiniNote_Data.color = tcolor;					MapNotes_MiniNote_Data.icon = icon;					MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..icon);					MiniNotePOI:Show();					MapNotes_SetNextAsMiniNote = 0;					MapNotes_StatusPrint(MAPNOTES_SETMININOTE);				end				MapNotes_AllowOneNote = 0;			end		end	endendfunction MapNotes_CheckNearNotes(continent, zone, xPos, yPos)	local i = 1;	if (zone == 0) then return false; end -- not in a valid zone, so no note in the way :)	for j, value in MapNotes_Data[continent][zone] do		if (abs(MapNotes_Data[continent][zone][i].xPos - xPos) <= 0.0009765625 * MapNotes_MinDiff and abs(MapNotes_Data[continent][zone][i].yPos - yPos) <= 0.0013020833 * MapNotes_MinDiff) then			return i;		end		i = i + 1;	end	return false;endfunction MapNotes_GetNoteBySlashCommand(msg)	if (msg ~= "" and msg ~= nil) then		msg = "<MapN> "..msg;		local continent = gsub(msg,".*<MapN+> c<([^>]*)>.*","%1",1) + 0;		local zone = gsub(msg,".*<MapN+>%s+%w+.*z<([^>]*)>.*","%1",1) + 0;		local xPos = gsub(msg,".*<MapN+>%s+%w+.*x<([^>]*)>.*","%1",1) + 0;		local yPos = gsub(msg,".*<MapN+>%s+%w+.*y<([^>]*)>.*","%1",1) + 0;		local title = gsub(msg,".*<MapN+>%s+%w+.*t<([^>]*)>.*","%1",1);		local info1 = gsub(msg,".*<MapN+>%s+%w+.*i1<([^>]*)>.*","%1",1);		local info2 = gsub(msg,".*<MapN+>%s+%w+.*i2<([^>]*)>.*","%1",1);		local creator = gsub(msg,".*<MapN+>%s+%w+.*cr<([^>]*)>.*","%1",1);		local icon = gsub(msg,".*<MapN+>%s+%w+.*i<([^>]*)>.*","%1",1)+0;		local tcolor = gsub(msg,".*<MapN+>%s+%w+.*tf<([^>]*)>.*","%1",1)+0;		local i1color = gsub(msg,".*<MapN+>%s+%w+.*i1f<([^>]*)>.*","%1",1)+0;		local i2color = gsub(msg,".*<MapN+>%s+%w+.*i2f<([^>]*)>.*","%1",1)+0;		local checknote = MapNotes_CheckNearNotes(continent, zone, xPos, yPos);		local id = 0;		local i = 0;		for j, value in MapNotes_Data[continent][zone] do			i = i + 1;		end		if (MapNotes_SetNextAsMiniNote ~= 2) then			local checknote = MapNotes_CheckNearNotes(continent, zone, xPos, yPos);			if (checknote) then				MapNotes_StatusPrint(format(MAPNOTES_DECLINE_SLASH_NEAR, MapNotes_Data[continent][zone][checknote].name, MapNotes_ZoneNames[continent][zone]));			else				if (i < MapNotes_NotesPerZone) then					MapNotes_TempData_Id = i + 1;					MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {};					if (info1 == "") then print1("gut"); end					MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = title;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = tcolor;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = info1;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = i1color;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = info2;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].in2c = i2color;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].creator = creator;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].icon = icon;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = xPos;					MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = yPos;					id = MapNotes_TempData_Id;					MapNotes_StatusPrint(format(MAPNOTES_ACCEPT_SLASH, MapNotes_ZoneNames[continent][zone]));				else					MapNotes_StatusPrint(format(MAPNOTES_DECLINE_SLASH, MapNotes_ZoneNames[continent][zone]));				end			end		end		if (MapNotes_SetNextAsMiniNote ~= 0) then			MapNotes_MiniNote_Data.xPos = xPos;			MapNotes_MiniNote_Data.yPos = yPos;			MapNotes_MiniNote_Data.continent = continent;			MapNotes_MiniNote_Data.zone = zone;			MapNotes_MiniNote_Data.id = id; -- only shown if the note was written...			MapNotes_MiniNote_Data.name = title;			MapNotes_MiniNote_Data.color = tcolor;			MapNotes_MiniNote_Data.icon = icon;			MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..icon);			MiniNotePOI:Show();			MapNotes_SetNextAsMiniNote = 0;			MapNotes_StatusPrint(MAPNOTES_SETMININOTE);		end	else		MapNotes_StatusPrint(MAPNOTES_MAPNOTEHELP);	endendfunction MapNotes_StringToArray(msg) --UNUSED AT THE MOMENT (I think)	local temparray = {};	local count = 1;	local startvalue = 1;	local stopvalue = 0;	while (strfind(msg, "`", startvalue) ~= nil) do		if (strfind(msg, "`", startvalue) > stopvalue + 1) then			temparray[count] = strsub(msg, stopvalue + 1, strfind(msg, "`", startvalue)-1);		else			temparray[count] = nil;		end		count = count + 1;		stopvalue = strfind(msg, "`", startvalue);		startvalue = strfind(msg, "`", startvalue) + 1;	end	return temparray;endfunction MapNotes_StatusPrint(msg)	msg = "<Map Notes>: "..msg;	if ( DEFAULT_CHAT_FRAME ) then 		DEFAULT_CHAT_FRAME:AddMessage(msg, 1.0, 0.5, 0.25);	endendfunction MapNotes_mntloc(msg)	if (msg == "") then		MapNotes_tloc_xPos = nil;		MapNotes_tloc_yPos = nil;

⌨️ 快捷键说明

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