📄 mapnotes.lua
字号:
else if (type == 1) then SendChatMessage(MapNotes_GenerateSendString(1), "WHISPER", this.language, SendWideEditBox:GetText()); MapNotes_HideFrames(); else MapNotes_HideFrames(); end endendfunction MapNotes_OpenOptionsMenuFrame() MapNotes_HideFrames(); for i=0, 16, 1 do if (MapNotes_Options[i] ~= "off") then getglobal("MapNotesOptionsCheckbox"..i):SetChecked(1); else getglobal("MapNotesOptionsCheckbox"..i):SetChecked(0); end end MapNotesOptionsMenuFrame:Show();endfunction MapNotes_WriteOptions() for i=0, 16, 1 do if ( getglobal("MapNotesOptionsCheckbox"..i):GetChecked() ) then MapNotes_Options[i] = nil; else MapNotes_Options[i] = "off"; end end MapNotesOptionsMenuFrame:Hide();endfunction MapNotes_SetAsMiniNote(id) local currentZone; local continent = GetCurrentMapContinent(); local zone; if( continent == -1 ) then currentZone = MapNotes_Data[GetZoneText()]; zone = -1; else zone = MapNotes_ZoneShift[continent][GetCurrentMapZone()]; currentZone = MapNotes_Data[continent][zone]; end if( not currentZone) then return; end MapNotes_MiniNote_Data.continent = continent; MapNotes_MiniNote_Data.zone = zone; MapNotes_MiniNote_Data.zonetext = GetZoneText(); MapNotes_MiniNote_Data.id = id; -- able to show, because there wasn't a delete and its not received for showing on MiniMap only if (id == 0) then MapNotes_MiniNote_Data.xPos = MapNotes_tloc_xPos; MapNotes_MiniNote_Data.yPos = MapNotes_tloc_yPos; MapNotes_MiniNote_Data.name = MAPNOTES_THOTTBOTLOC; MapNotes_MiniNote_Data.color = 0; MapNotes_MiniNote_Data.icon = "tloc"; MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon); MiniNotePOI:Show(); elseif (id == -1) then MapNotes_MiniNote_Data.xPos = MapNotes_PartyNoteData.xPos; MapNotes_MiniNote_Data.yPos = MapNotes_PartyNoteData.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(); else MapNotes_MiniNote_Data.xPos = currentZone[id].xPos; MapNotes_MiniNote_Data.yPos = currentZone[id].yPos; MapNotes_MiniNote_Data.name = currentZone[id].name; MapNotes_MiniNote_Data.color = currentZone[id].ncol; MapNotes_MiniNote_Data.icon = currentZone[id].icon; MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon); MiniNotePOI:Show(); endendfunction MapNotes_ClearMiniNote() MapNotes_MiniNote_Data.xPos = nil; MapNotes_MiniNote_Data.yPos = nil; MapNotes_MiniNote_Data.continent = nil; MapNotes_MiniNote_Data.zone = nil; MapNotes_MiniNote_Data.id = 0; -- nothing to show on the zone map MapNotes_MiniNote_Data.name = nil; MapNotes_MiniNote_Data.color = nil; MapNotes_MiniNote_Data.icon = nil; MiniNotePOI:Hide();endfunction MapNotes_ShowPOIFrame(ax, ay) if (MapNotes_BlockingFrame()) then MapNotesPOIMenuFrame:SetPoint("CENTER", "WorldMapDetailFrame", "TOPLEFT", ax * WorldMapButton:GetWidth(), -(ay * WorldMapButton:GetHeight())); MapNotesNewMenuFrame:Hide(); MapNotesPOIMenuFrame:Show(); endendfunction MapNotes_WriteNote() MapNotes_HideFrames(); local currentZone; local continent = GetCurrentMapContinent(); local zone; if( continent == -1 ) then zone = GetZoneText(); if( not MapNotes_Data[zone] ) then MapNotes_Data[zone] = { }; end currentZone = MapNotes_Data[zone]; zone = -1; else zone = MapNotes_ZoneShift[continent][GetCurrentMapZone()]; currentZone = MapNotes_Data[continent][zone]; end currentZone[MapNotes_TempData_Id] = {}; currentZone[MapNotes_TempData_Id].name = TitleWideEditBox:GetText(); currentZone[MapNotes_TempData_Id].ncol = MapNotes_TempData_TextColor; currentZone[MapNotes_TempData_Id].inf1 = Info1WideEditBox:GetText(); currentZone[MapNotes_TempData_Id].in1c = MapNotes_TempData_Info1Color; currentZone[MapNotes_TempData_Id].inf2 = Info2WideEditBox:GetText(); currentZone[MapNotes_TempData_Id].in2c = MapNotes_TempData_Info2Color; currentZone[MapNotes_TempData_Id].creator = MapNotes_TempData_Creator; currentZone[MapNotes_TempData_Id].icon = MapNotes_TempData_Icon; currentZone[MapNotes_TempData_Id].xPos = MapNotes_TempData_xPos; currentZone[MapNotes_TempData_Id].yPos = MapNotes_TempData_yPos; if( continent == -1 ) then currentZone[MapNotes_TempData_Id].zname = GetZoneText(); end if (continent == MapNotes_MiniNote_Data.continent and MapNotes_MiniNote_Data.zone == zone and MapNotes_MiniNote_Data.id == MapNotes_TempData_Id) then MapNotes_MiniNote_Data.name = TitleWideEditBox:GetText(); MapNotes_MiniNote_Data.icon = MapNotes_TempData_Icon; MiniNotePOITexture:SetTexture("Interface\\AddOns\\MapNotes\\POIIcons\\Icon"..MapNotes_MiniNote_Data.icon); MapNotes_MiniNote_Data.color = MapNotes_TempData_TextColor; endendfunction MapNotes_HideFrames() MapNotesNewMenuFrame:Hide(); MapNotesPOIMenuFrame:Hide(); MapNotesSpecialActionMenuFrame:Hide(); MapNotesEditMenuFrame:Hide(); MapNotesOptionsMenuFrame:Hide(); MapNotesSendFrame:Hide(); MapNotes_ClearGUI();endfunction MapNotes_BlockingFrame() if (MapNotesEditMenuFrame:IsVisible()) then return false; elseif (MapNotesOptionsMenuFrame:IsVisible()) then return false; elseif (MapNotesSendFrame:IsVisible()) then return false; else return true; endendfunction MapNotes_DeleteNote(id) if (id == 0) then MapNotes_tloc_xPos = nil; MapNotes_tloc_yPox = nil; return; elseif (id == -1) then MapNotes_PartyNoteData.xPos = nil; MapNotes_PartyNoteData.yPos = nil; MapNotes_PartyNoteData.continent = nil; MapNotes_PartyNoteData.zone = nil; return; end local zone = MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()]; local continent = GetCurrentMapContinent(); local lastEntry = MapNotes_NewNoteSlot() - 1; MapNotes_DeleteLines(continent, zone, MapNotes_Data[continent][zone][id].xPos, MapNotes_Data[continent][zone][id].yPos); if ((lastEntry ~= 0) and (id <= lastEntry)) then MapNotes_Data[continent][zone][id].name = MapNotes_Data[continent][zone][lastEntry].name; MapNotes_Data[continent][zone][lastEntry].name = nil; MapNotes_Data[continent][zone][id].ncol = MapNotes_Data[continent][zone][lastEntry].ncol; MapNotes_Data[continent][zone][lastEntry].ncol = nil; MapNotes_Data[continent][zone][id].inf1 = MapNotes_Data[continent][zone][lastEntry].inf1; MapNotes_Data[continent][zone][lastEntry].inf1 = nil; MapNotes_Data[continent][zone][id].in1c = MapNotes_Data[continent][zone][lastEntry].in1c; MapNotes_Data[continent][zone][lastEntry].in1c = nil; MapNotes_Data[continent][zone][id].inf2 = MapNotes_Data[continent][zone][lastEntry].inf2; MapNotes_Data[continent][zone][lastEntry].inf2 = nil; MapNotes_Data[continent][zone][id].in2c = MapNotes_Data[continent][zone][lastEntry].in2c; MapNotes_Data[continent][zone][lastEntry].in2c = nil; MapNotes_Data[continent][zone][id].creator = MapNotes_Data[continent][zone][lastEntry].creator; MapNotes_Data[continent][zone][lastEntry].creator = nil; MapNotes_Data[continent][zone][id].icon = MapNotes_Data[continent][zone][lastEntry].icon; MapNotes_Data[continent][zone][lastEntry].icon = nil; MapNotes_Data[continent][zone][id].xPos = MapNotes_Data[continent][zone][lastEntry].xPos; MapNotes_Data[continent][zone][lastEntry].xPos = nil; MapNotes_Data[continent][zone][id].yPos = MapNotes_Data[continent][zone][lastEntry].yPos; MapNotes_Data[continent][zone][lastEntry].yPos = nil; MapNotes_Data[continent][zone][lastEntry] = nil; end if (continent == MapNotes_MiniNote_Data.continent and zone == MapNotes_MiniNote_Data.zone) then if (MapNotes_MiniNote_Data.id > id) then MapNotes_MiniNote_Data.id = id - 1; elseif (MapNotes_MiniNote_Data.id == id) then MapNotes_MiniNote_Data.id = 0; end end WorldMapButton_OnUpdate();endfunction MapNotes_OnEnter(id) if ((not MapNotesPOIMenuFrame:IsVisible()) and (not MapNotesNewMenuFrame:IsVisible()) and MapNotes_BlockingFrame()) then local x, y = this:GetCenter(); local x2, y2 = WorldMapButton:GetCenter(); local anchor = ""; if (x > x2) then anchor = "ANCHOR_LEFT"; else anchor = "ANCHOR_RIGHT"; end local currentZone; local continent = GetCurrentMapContinent(); if( continent == -1 ) then currentZone = MapNotes_Data[GetZoneText()]; elseif( continent > 0 ) then local zone = MapNotes_ZoneShift[continent][GetCurrentMapZone()]; currentZone = MapNotes_Data[continent][zone]; end if( not currentZone) then return; end-- --local zone = MapNotes_ZoneShift[GetCurrentMapContinent()][GetCurrentMapZone()]; local cNr = currentZone[id].ncol; WorldMapTooltip:SetOwner(this, anchor); WorldMapTooltip:SetText(currentZone[id].name, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b); if ((currentZone[id].inf1 ~= nil) and (currentZone[id].inf1 ~= "")) then cNr = currentZone[id].in1c; WorldMapTooltip:AddLine(currentZone[id].inf1, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b); end if ((currentZone[id].inf2 ~= nil) and (currentZone[id].inf2 ~= "")) then cNr = currentZone[id].in2c; WorldMapTooltip:AddLine(currentZone[id].inf2, MapNotes_Colors[cNr].r, MapNotes_Colors[cNr].g, MapNotes_Colors[cNr].b); end WorldMapTooltip:AddDoubleLine(MAPNOTES_CREATEDBY, currentZone[id].creator, 0.79, 0.69, 0.0, 0.79, 0.69, 0.0); WorldMapTooltip:Show(); else WorldMapTooltip:Hide(); endendfunction MapNotes_OnLeave(id) WorldMapTooltip:Hide();endfunction MapNotes_Note_OnClick(arg1, id) CloseDropDownMenus(); local currentZone; local continent = GetCurrentMapContinent(); local zone; if( continent == -1 ) then currentZone = MapNotes_Data[GetZoneText()]; zone = -1; else zone = MapNotes_ZoneShift[continent][GetCurrentMapZone()]; currentZone = MapNotes_Data[continent][zone]; end if( not currentZone) then return; end if ( MapNotes_LastLineClick.GUIactive ) then id = id + 0; local ax = currentZone[id].xPos; local ay = currentZone[id].yPos; if (MapNotes_LastLineClick.x ~= ax and MapNotes_LastLineClick.y ~= ay and MapNotes_LastLineClick.continent == continent and MapNotes_LastLineClick.zone == zone) then MapNotes_ToggleLine(continent, zone, ax, ay, MapNotes_LastLineClick.x, MapNotes_LastLineClick.y); end MapNotes_ClearGUI(); elseif ( arg1 == "RightButton" ) then if (MapNotes_BlockingFrame()) then id = id + 0; MapNotes_TempData_Id = id; local ax = currentZone[id].xPos; local ay = currentZone[id].yPos; if (ax*1002 >= (1002 - 195)) then xOffset = -176; else xOffset = 0; end if (ay*668 <= (668 - 156)) then yOffset = -75; else yOffset = 113; end MapNotesPOIMenuFrame:SetPoint("TOPLEFT", "WorldMapFrame", "TOPLEFT", ax * WorldMapButton:GetWidth() + xOffset, -(ay * WorldMapButton:GetHeight()) + yOffset); MapNotesNewMenuFrame:Hide(); MapNotesSpecialActionMenuFrame:Hide(); MapNotesButtonEditNote:Enable(); MapNotesButtonSendNote:Enable(); WorldMapTooltip:Hide(); MapNotesPOIMenuFrame:Show(); end elseif ( arg1 == "LeftButton" and IsAltKeyDown() ) then id = id + 0; local ax = currentZone[id].xPos; local ay = currentZone[zone][id].yPos; if (MapNotes_LastLineClick.x ~= ax and MapNotes_LastLineClick.y ~= ay and Map
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -