432
edits
(Allow optional comma separated list of items) |
No edit summary |
||
Line 338: | Line 338: | ||
return '==POI Discovery Rewards==\n' .. resultTable | return '==POI Discovery Rewards==\n' .. resultTable | ||
end | end | ||
end | |||
function p.hex(frame) | |||
-- Default behavior, when no coords supplied | |||
if (frame == nil or frame.args['x'] == nil or frame.args['y'] == nil) then | |||
return 'Hex' | |||
end | |||
local X = tonumber(frame.args['x']) | |||
local Y = tonumber(frame.args['y']) | |||
if X == nil or Y == nil then | |||
return '<invalid XY format>' | |||
elseif X < 0 or Y < 0 or X > 31 or Y > 29 or (Y == 29 and X % 2 == 0) then | |||
return '<out of range (' .. X .. ',' .. Y .. ')>' | |||
end | |||
-- | |||
local noicon = frame.args['noicon'] or false | |||
local coords = '<span>(' .. X .. ',' .. Y .. ')</span>' | |||
local hex = p.getPointOfInterestByXY(X, Y) | |||
-- nil means just a normal hex | |||
if hex == nil or hex['id'] == nil or noicon then | |||
return coords | |||
end | |||
-- Valid POI so consider decorations | |||
local notext = frame.args['notext'] or false | |||
local nolink = frame.args['nolink'] or false | |||
local poi_icon = Icons.Icon({hex['name'], type='poi', notext=notext or nil, nolink=nolink or nil, size='25'}) | |||
return '<span>' .. poi_icon .. ' ' .. coords .. '</span>' | |||
end | end | ||
Line 346: | Line 373: | ||
local item = Items.getItemByID(POI.discoveryRewards.items[1].id) | local item = Items.getItemByID(POI.discoveryRewards.items[1].id) | ||
table.insert(testTable, p._getDiscoveryRewardsTable({item})) | table.insert(testTable, p._getDiscoveryRewardsTable({item})) | ||
end | |||
end | |||
return table.concat(testTable) | |||
end | |||
function p.testHex() | |||
local testTable = {} | |||
for x = 0, 31 do | |||
for y = 0, 29 do | |||
if y == 29 and x % 2 == 1 then | |||
-- no tile here | |||
else | |||
item = p.hex({args={x=x, y=y}}) | |||
table.insert(testTable, item) | |||
end | |||
end | end | ||
end | end |
edits