Skip to content
Open
2 changes: 2 additions & 0 deletions Locale/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/esMX.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/ptBR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Minium Drop Rate";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Size of WorldMap normal pins";
uil10n.worldmap_large_size = "Size of WorldMap BOSS pins";
uil10n.worldmap_varied_size = "Size of WorldMap NPC pins";
uil10n.worldmap_pin_scale_max = "Maxium scale size";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Size of Minimap normal pins";
uil10n.minimap_large_size = "Size of Minimap BOSS pins";
Expand Down
2 changes: 2 additions & 0 deletions Locale/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "Modifier of poping menu of pin";
-- map
uil10n.min_rate = "Минимальный шанс выпадения";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "Alpha of icons on world map";
uil10n.worldmap_normal_size = "Размер большинства контактов";
uil10n.worldmap_large_size = "Размер отображения босса";
uil10n.worldmap_varied_size = "Размер отображения квестовых NPC";
uil10n.worldmap_pin_scale_max = "Максимальный размер шкалы";
uil10n.show_in_continent = "Show pins in continents";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "Alpha of icons on minimap";
uil10n.minimap_normal_size = "Размер большинства контактов";
uil10n.minimap_large_size = "Размер отображения босса";
Expand Down
2 changes: 2 additions & 0 deletions Locale/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "任务标记弹出菜单按键";
-- map
uil10n.min_rate = "最低物品掉率";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "大地图图标透明度";
uil10n.worldmap_normal_size = "大地图普通标记点大小";
uil10n.worldmap_large_size = "大地图boss标记点大小";
uil10n.worldmap_varied_size = "大地图交接npc标记点大小";
uil10n.worldmap_pin_scale_max = "地图缩放时标记点的最大缩放";
uil10n.show_in_continent = "在大陆地图上显示标记";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "小地图图标透明度";
uil10n.minimap_normal_size = "小地图普通标记点大小";
uil10n.minimap_large_size = "小地图boss标记点大小";
Expand Down
2 changes: 2 additions & 0 deletions Locale/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ uil10n.node_menu_modifier = "任務标记彈出菜單按鍵";
-- map
uil10n.min_rate = "最低物品掉率";
-- worldmap
uil10n.worldmap_quest_area = "Show quest areas instead of objective pins";
uil10n.worldmap_alpha = "大地圖圖標透明度";
uil10n.worldmap_normal_size = "大地圖普通標記點大小";
uil10n.worldmap_large_size = "大地圖boss標記點大小";
uil10n.worldmap_varied_size = "大地圖交接npc標記點大小";
uil10n.worldmap_pin_scale_max = "地圖縮放時標記點的最大縮放";
uil10n.show_in_continent = "在大陸地圖上顯示標記";
-- minimap
uil10n.minimap_quest_area = "Show quest areas instead of objective pins on the minimap";
uil10n.minimap_alpha = "小地圖圖標透明度";
uil10n.minimap_normal_size = "小地圖普通標記點大小";
uil10n.minimap_large_size = "小地圖boss標記點大小";
Expand Down
3 changes: 3 additions & 0 deletions load.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<script file = "db-extra.lua" />
<script file = "main.lua" />
<script file = "map.lua" />
<script file = "map-area-geometry.lua" />
<script file = "map-area.lua" />
<script file = "minimap-area.lua" />
<script file = "comm.lua" />
<script file = "util.lua" />
<script file = "setting.lua" />
Expand Down
6 changes: 6 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -987,10 +987,12 @@ MT.BuildEnv("main");
meta.flag = -1;
end
if num > 0 then
local ordinal = 0;
for index = 1, 40 do
local title, level, group, header, collapsed, completed, frequency, quest_id = GetQuestLogTitle(index);
--> completed: 1 = completed, nil = not completed, -1 = failed >> 0 = not completed
if not header and quest_id then
ordinal = ordinal + 1;
local info = DataAgent.quest[quest_id];
if info ~= nil then
local num_lines = GetNumQuestLeaderBoards(index);
Expand All @@ -1007,6 +1009,10 @@ MT.BuildEnv("main");
quest_changed = true;
MT.PushAddQuest(quest_id, completed, title, num_lines);
end
if meta.ordinal ~= ordinal then -- position in the quest log, shown on map areas
meta.ordinal = ordinal;
need_re_draw = true;
end
--
-- local details = GetQuestObjectives(quest_id);
-- local detail = details[line];
Expand Down
149 changes: 149 additions & 0 deletions map-area-geometry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
--[[--
Quest-area geometry: pure Lua, no WoW API.
Groups objective coordinates into clusters and builds padded convex hulls
for drawing quest areas on the world map. Tested by tests/geometry_test.lua.
--]]--
local __addon, __private = ...;
local MT = __private.MT;

--> upvalue
local cos, sin, pi = math.cos, math.sin, math.pi;
local tsort = table.sort;

-->
-- points are any tables with [1] = x, [2] = y (map coords, 0-100)
-- Single linkage: two points share a cluster when a chain of points, each within
-- `threshold` of the next, connects them. Clusters keep input order of first appearance.
function MT.AreaCluster(points, threshold)
local clusters = { };
local n = #points;
if n == 0 then
return clusters;
end
local t2 = threshold * threshold;
local parent = { };
for i = 1, n do
parent[i] = i;
end
local function find(i)
while parent[i] ~= i do
parent[i] = parent[parent[i]];
i = parent[i];
end
return i;
end
for i = 1, n - 1 do
local p = points[i];
local px, py = p[1], p[2];
for j = i + 1, n do
local q = points[j];
local dx, dy = q[1] - px, q[2] - py;
if dx * dx + dy * dy <= t2 then
local ri, rj = find(i), find(j);
if ri ~= rj then
parent[rj] = ri;
end
end
end
end
local byRoot = { };
for i = 1, n do
local root = find(i);
local cluster = byRoot[root];
if cluster == nil then
cluster = { };
byRoot[root] = cluster;
clusters[#clusters + 1] = cluster;
end
cluster[#cluster + 1] = points[i];
end
return clusters;
end

local function cross(o, a, b)
return (a[1] - o[1]) * (b[2] - o[2]) - (a[2] - o[2]) * (b[1] - o[1]);
end
local function lessXY(a, b)
if a[1] == b[1] then
return a[2] < b[2];
end
return a[1] < b[1];
end
-- Andrew's monotone chain. Returns vertices with positive signed area
-- (counter-clockwise for y-up), dropping duplicate and collinear points.
local function ConvexHull(points)
local n = #points;
if n == 0 then
return { };
elseif n == 1 then
return { { points[1][1], points[1][2], }, };
end
local sorted = { };
for i = 1, n do
sorted[i] = points[i];
end
tsort(sorted, lessXY);
local hull = { };
local k = 0;
for i = 1, n do
local p = sorted[i];
while k >= 2 and cross(hull[k - 1], hull[k], p) <= 0 do
hull[k] = nil;
k = k - 1;
end
k = k + 1;
hull[k] = p;
end
local lower = k + 1;
for i = n - 1, 1, -1 do
local p = sorted[i];
while k >= lower and cross(hull[k - 1], hull[k], p) <= 0 do
hull[k] = nil;
k = k - 1;
end
k = k + 1;
hull[k] = p;
end
hull[k] = nil; -- last vertex repeats the first
return hull;
end

local OCTAGON = { };
for i = 0, 7 do
local a = (i + 0.5) * pi / 4;
OCTAGON[i + 1] = { cos(a), sin(a), };
end
-- Convex hull of the points, grown outward by `pad` on every side.
-- Padding surrounds each hull vertex with an octagon of radius `pad` and hulls those,
-- so one or two points still yield a real polygon.
function MT.AreaPaddedHull(points, pad)
if #points == 0 then
return { };
end
if pad == nil or pad <= 0 then
return ConvexHull(points);
end
local base = ConvexHull(points);
local expanded = { };
for i = 1, #base do
local p = base[i];
for k = 1, 8 do
local o = OCTAGON[k];
expanded[#expanded + 1] = { p[1] + o[1] * pad, p[2] + o[2] * pad, };
end
end
return ConvexHull(expanded);
end

function MT.AreaCentroid(points)
local n = #points;
if n == 0 then
return nil;
end
local sx, sy = 0, 0;
for i = 1, n do
sx = sx + points[i][1];
sy = sy + points[i][2];
end
return sx / n, sy / n;
end
Loading