Anonymous

Module:Sandbox/Skills/Cartography: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 29: Line 29:
end
end
end
end
return nil
return hex
end
end


Line 287: Line 287:
end
end
return table.concat(testTable)
return table.concat(testTable)
end
function p.hex(frame)
-- Default behavior, when no coords supplied
if frame.args == nil then
return 'Hex'
end
local X = tonumber(frame.args['x'])
local Y = tonumber(frame.args['y'])
local hex = p.getPointOfInterestByXY(X, Y)
-- nil means coord is invalid
if hex == nil then
return '<invalid XY coord>'
end
local notext = frame.args['notext'] or false
local noicon = frame.args['noicon'] or false
local nolink = frame.args['nolink'] or false
local coords = '<span>(' .. X .. ', ' .. Y .. ')</span>'
-- Valid, but not a POI
if hex['id'] == nil or noicon then
return coords
end
-- Valid POI
local poi_icon = Icons.Icon({hex['name'], type='poi', notext=notext, nolink=nolink, size='25'})
return '<span>' .. poi_icon .. coords .. '</span>'
end
end


432

edits