📄 mapnotes.lua
字号:
else local i,j,x,y = string.find(msg,"(%d+),(%d+)"); MapNotes_tloc_xPos = x / 100; MapNotes_tloc_yPos = y / 100; endendfunction MapNotes_Quicktloc(msg) if (msg == "") then MapNotes_StatusPrint(MAPNOTES_QUICKTLOC_NOARGUMENT); else local data = strsub(msg, 1, 5); msg = strsub(msg, 7); local i,j,x,y = string.find(data,"(%d+),(%d+)"); local continent, zone = MapNotes_GetZone(); x = x / 100; y = y / 100; local checknote = MapNotes_CheckNearNotes(continent, zone, x, y); if (checknote) then MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_NOTETONEAR, MapNotes_Data[continent][zone][checknote].name)); elseif (zone == 0) then MapNotes_StatusPrint(MAPNOTES_QUICKTLOC_NOZONE); else local id = 0; local icon = 0; local name = MAPNOTES_THOTTBOTLOC; if (msg ~= "" and msg ~= nil) then local icheck = strsub(msg, 1, 2); if (strlen(icheck) == 1) then icheck = icheck.." "; end if (icheck == "0 " or icheck == "1 " or icheck == "2 " or icheck == "3 " or icheck == "4 " or icheck == "5 " or icheck == "6 " or icheck == "7 " or icheck == "8 " or icheck == "9 ") then icon = strsub(msg, 1, 1)+0; msg = strsub(msg, 3); end if (msg ~= "" and msg ~= nil) then name = strsub(msg, 1, 80); end end if (MapNotes_SetNextAsMiniNote ~= 2) then local i = 0; for j, value in MapNotes_Data[continent][zone] do i = i + 1; end if (i < MapNotes_NotesPerZone) then MapNotes_TempData_Id = i + 1; MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {}; MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = name; MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = 0; MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = ""; MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = 0; MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = ""; 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 = icon; MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = x; MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = y; id = MapNotes_TempData_Id; MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_OK, MapNotes_ZoneNames[continent][zone])); else MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_TOOMANY, MapNotes_ZoneNames[continent][zone])); end end if (MapNotes_SetNextAsMiniNote ~= 0) then MapNotes_MiniNote_Data.xPos = x; MapNotes_MiniNote_Data.yPos = y; 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 = name; MapNotes_MiniNote_Data.color = 0; MapNotes_MiniNote_Data.icon = icon; MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..icon); MiniNotePOI:Show(); MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_SETMININOTE); end end endendfunction MapNotes_Quicknote(msg) local continent, zone = MapNotes_GetZone(); SetMapToCurrentZone(); local x, y = GetPlayerMapPosition("player"); local checknote = MapNotes_CheckNearNotes(continent, zone, x, y); if (checknote) then MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_NOTETONEAR, MapNotes_Data[continent][zone][checknote].name)); elseif ((x == 0 and y == 0) or zone == 0) then MapNotes_StatusPrint(MAPNOTES_QUICKNOTE_NOPOSITION); else local id = 0; local icon = 0; local name = MAPNOTES_QUICKNOTE_DEFAULTNAME; if (msg ~= "" and msg ~= nil) then local icheck = strsub(msg, 1, 2); if (icheck == "0 " or icheck == "1 " or icheck == "2 " or icheck == "3 " or icheck == "4 " or icheck == "5 " or icheck == "6 " or icheck == "7 " or icheck == "8 " or icheck == "9 ") then icon = strsub(msg, 1, 1)+0; msg = strsub(msg, 3); end if (msg ~= "" and msg ~= nil) then name = strsub(msg, 1, 80); end end if (MapNotes_SetNextAsMiniNote ~= 2) then local i = 0; for j, value in MapNotes_Data[continent][zone] do i = i + 1; end if (i < MapNotes_NotesPerZone) then MapNotes_TempData_Id = i + 1; MapNotes_Data[continent][zone][MapNotes_TempData_Id] = {}; MapNotes_Data[continent][zone][MapNotes_TempData_Id].name = name; MapNotes_Data[continent][zone][MapNotes_TempData_Id].ncol = 0; MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf1 = ""; MapNotes_Data[continent][zone][MapNotes_TempData_Id].in1c = 0; MapNotes_Data[continent][zone][MapNotes_TempData_Id].inf2 = ""; 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 = icon; MapNotes_Data[continent][zone][MapNotes_TempData_Id].xPos = x; MapNotes_Data[continent][zone][MapNotes_TempData_Id].yPos = y; id = MapNotes_TempData_Id; MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_OK, MapNotes_ZoneNames[continent][zone])); else MapNotes_StatusPrint(format(MAPNOTES_QUICKNOTE_TOOMANY, MapNotes_ZoneNames[continent][zone])); end end if (MapNotes_SetNextAsMiniNote ~= 0) then MapNotes_MiniNote_Data.xPos = x; MapNotes_MiniNote_Data.yPos = y; 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 = name; MapNotes_MiniNote_Data.color = 0; MapNotes_MiniNote_Data.icon = icon; MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..icon); MiniNotePOI:Show(); MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_SETMININOTE); end end endfunction MapNotes_Misc_OnClick(arg1) CloseDropDownMenus(); if (this:GetID() == 0) then if (arg1 == "LeftButton") then if (MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()] ~= 0) then MapNotesButtonNewNote:Enable(); MapNotes_ShowNewFrame(MapNotes_tloc_xPos, MapNotes_tloc_yPos); if (MapNotes_BlockingFrame()) then MapNotes_TempData_Id = 0; end end elseif (arg1 == "RightButton") then local x, y = this:GetCenter(); x = x / WorldMapButton:GetScale(); y = y / WorldMapButton:GetScale(); local centerX, centerY = WorldMapButton:GetCenter(); local width = WorldMapButton:GetWidth(); local height = WorldMapButton:GetHeight(); local ay = (centerY + (height/2) - y) / height; local ax = (x - (centerX - (width/2))) / width; if (ax*1002 >= (1002 - 195)) then xOffset = -176; else xOffset = 0; end if (ay*668 <= (668 - 156)) then yOffset = -75; else yOffset = 113; end if (MapNotes_BlockingFrame()) then MapNotesPOIMenuFrame:SetPoint("TOPLEFT", "WorldMapFrame", "TOPLEFT", ax * WorldMapButton:GetWidth() + xOffset, -(ay * WorldMapButton:GetHeight()) + yOffset); MapNotesNewMenuFrame:Hide(); MapNotesButtonEditNote:Disable(); MapNotesButtonSendNote:Disable(); WorldMapTooltip:Hide(); MapNotesPOIMenuFrame:Show(); MapNotes_TempData_Id = 0; end end elseif (this:GetID() == 1) then if (arg1 == "LeftButton") then local x, y = this:GetCenter(); x = x / WorldMapButton:GetScale(); y = y / WorldMapButton:GetScale(); local centerX, centerY = WorldMapButton:GetCenter(); local width = WorldMapButton:GetWidth(); local height = WorldMapButton:GetHeight(); local adjustedY = (centerY + (height/2) - y) / height; local adjustedX = (x - (centerX - (width/2))) / width; if (MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()] ~= 0) then MapNotesButtonNewNote:Disable(); MapNotes_ShowNewFrame(adjustedX, adjustedY); if (MapNotes_BlockingFrame()) then MapNotes_TempData_Id = -1; end end elseif (arg1 == "RightButton") then local x, y = this:GetCenter(); x = x / WorldMapButton:GetScale(); y = y / WorldMapButton:GetScale(); local centerX, centerY = WorldMapButton:GetCenter(); local width = WorldMapButton:GetWidth(); local height = WorldMapButton:GetHeight(); local ay = (centerY + (height/2) - y) / height; local ax = (x - (centerX - (width/2))) / width; if (ax*1002 >= (1002 - 195)) then xOffset = -176; else xOffset = 0; end if (ay*668 <= (668 - 156)) then yOffset = -75; else yOffset = 113; end if (MapNotes_BlockingFrame()) then MapNotesPOIMenuFrame:SetPoint("TOPLEFT", "WorldMapFrame", "TOPLEFT", ax * WorldMapButton:GetWidth() + xOffset, -(ay * WorldMapButton:GetHeight()) + yOffset); MapNotesNewMenuFrame:Hide(); MapNotesButtonEditNote:Disable(); MapNotesButtonSendNote:Disable(); WorldMapTooltip:Hide(); MapNotesPOIMenuFrame:Show(); MapNotes_TempData_Id = -1; end end endendfunction MapNotes_NextMiniNote(msg) if (msg == "on" or msg == "ON") then MapNotes_SetNextAsMiniNote = 1; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_1); elseif (msg == "off" or msg == "OFF") then MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_0); elseif (MapNotes_SetNextAsMiniNote == 1) then MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_0); else MapNotes_SetNextAsMiniNote = 1; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_1); endendfunction MapNotes_NextMiniNoteOnly(msg) if (msg == "on" or msg == "ON") then MapNotes_SetNextAsMiniNote = 2; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_2); elseif (msg == "off" or msg == "OFF") then MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_0); elseif (MapNotes_SetNextAsMiniNote == 2) then MapNotes_SetNextAsMiniNote = 0; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_0); else MapNotes_SetNextAsMiniNote = 2; MapNotes_StatusPrint(MAPNOTES_MININOTE_SHOW_2); endendfunction MapNotes_OneNote(msg) if (msg == "on" or msg == "ON") then MapNotes_AllowOneNote = 1; MapNotes_StatusPrint(MAPNOTES_ONENOTE_ON); elseif (msg == "off" or msg == "OFF") then MapNotes_AllowOneNote = 0; MapNotes_StatusPrint(MAPNOTES_ONENOTE_OFF); elseif (MapNotes_AllowOneNote == 1) then MapNotes_AllowOneNote = 0; MapNotes_StatusPrint(MAPNOTES_ONENOTE_OFF); else MapNotes_AllowOneNote = 1; MapNotes_StatusPrint(MAPNOTES_ONENOTE_ON); endendfunction MapNotes_OnEvent(event) if (event == "MINIMAP_UPDATE_ZOOM") then if (MapNotes_MiniNote_MapzoomInit) then if (MapNotes_MiniNote_IsInCity) then MapNotes_MiniNote_IsInCity = false; else MapNotes_MiniNote_IsInCity = true; end else local tempzoom = 0; if (GetCVar("minimapZoom") == GetCVar("minimapInsideZoom")) then if (GetCVar("minimapInsideZoom")+0 >= 3) then Minimap:SetZoom(Minimap:GetZoom() - 1); tempzoom = 1; else Minimap:SetZoom(Minimap:GetZoom() + 1); tempzoom = -1; end end if (GetCVar("minimapInsideZoom")+0 == Minimap:GetZoom()) then MapNotes_MiniNote_IsInCity = true; else MapNotes_MiniNote_IsInCity = false; end Minimap:SetZoom(Minimap:GetZoom() + tempzoom); MapNotes_MiniNote_MapzoomInit = true; end elseif (event == "VARIABLES_LOADED") then if (MapNotes_MiniNote_Data.icon == "party") then MapNotes_ClearMiniNote(); end if (MapNotes_MiniNote_Data.icon ~= nil) then if (MapNotes_MiniNote_Data.id == -2) then MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotesGathering\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon); else MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon); end end if (not MapNotes_Options["MapVersion"]) then MapNotes_Options["MapVersion"] = 1; end MapNotes_ImportCartoPlus(); -- for testin only, doesn't work correctly, because of the word wraps... if (Sea) then Sea.util.hook("WorldMapButton_OnUpdate", "MapNotes_WorldMapButton_OnUpdate", "after"); Sea.util.hook("WorldMapButton_OnClick", "MapNotes_WorldMapButton_OnClick", "hide"); Sea.util.hook("Minimap_OnClick", "MapNotes_Minimap_OnClick", "after"); Sea.util.hook("ToggleWorldMap", "MapNotes_OnToggleWorldMap", "after"); Sea.util.hook("WorldMapZoomOutButton_OnClick", "MapNotes_ZoomOutButton_OnClick", "after"); else local old_WorldMapButton_OnUpdate = WorldMapButton_OnUpdate; WorldMapButton_OnUpdate = function() MapNotes_WorldMapButton_OnUpdate(); old_WorldMapButton_OnUpdate(); end local old_MapNotes_Minimap_OnClick = Minimap_OnClick; Minimap_OnClick = function() MapNotes_Minimap_OnClick(); old_MapNotes_Minimap_OnClick(); end local old_MapNotes_WorldMapButton_OnClick = WorldMapButton_OnClick; WorldMapButton_OnClick = function(mouseButton, button) if( MapNotes_WorldMapButton_OnClick(mouseButton, button)) then old_MapNotes_WorldMapButton_OnClick(mouseButton, button); end end local old_ToggleWorldMap = ToggleWorldMap; ToggleWorldMap = function()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -