mNo edit summary |
mNo edit summary |
||
(52 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local cargo = mw.ext.cargo | local cargo = mw.ext.cargo | ||
function p.Main( frame ) | function p.Main( frame ) | ||
local t = {} | local t = {} | ||
local tables = 'Commendations' | local tables = 'Commendations' | ||
local fields = 'Commendation | local fields = 'Commendation' | ||
local args = { | local args = { | ||
where = 'Recipient = "' .. frame.args[1] .. '" AND Commendation LIKE "Highlander %" AND Approved = true' | |||
where = 'Recipient = "' .. frame.args[1] .. '" AND Approved = true' | |||
} | } | ||
local results = cargo.query( tables, fields, args ) | |||
local tattoo_id = 0 | |||
for n = 1, #results do | |||
if results[n].Commendation == "Highlander I" then | |||
tattoo_id = math.max(tattoo_id, 1) | |||
elseif results[n].Commendation == "Highlander II" then | |||
tattoo_id = math.max(tattoo_id, 2) | |||
elseif results[n].Commendation == "Highlander III" then | |||
tattoo_id = math.max(tattoo_id, 3) | |||
elseif results[n].Commendation == "Highlander IV" then | |||
tattoo_id = math.max(tattoo_id, 4) | |||
end | |||
end | |||
local results = cargo.query( tables, fields, args ) | local results = cargo.query( tables, fields, args ) | ||
local | |||
local args = { | |||
where = 'Recipient = "' .. frame.args[1] .. '" AND Commendation LIKE "Tattoo:%" AND Approved = true' | |||
} | |||
local results = cargo.query( tables, fields, args ) | |||
local output = "[[Image:Tattoo_" .. tattoo_id .. ".png|frameless|600px]]" .. [[<div style="position:relative;">]] | |||
local i = 0 | |||
local d = 140 | |||
local r = 30 | |||
-- n = 1, #results | |||
for n = 1, #results do | |||
local x = math.cos(math.rad(i*r)) * d | |||
for | local y = math.sin(math.rad(i*r)) * d*1.3 | ||
local x = math.cos(math.rad(i* | output = output .. [[<span style="position:absolute; margin-top:-310px; margin-left:calc(50% + 0px); left:calc(]] .. x .. [[px - 15px); top:calc(]] .. y .. [[px - 15px);">]].. "[[Image:" .. results[n].Commendation .. "|30px]]" .. [[</span>]] | ||
local y = math.sin(math.rad(i* | i = i + 1 | ||
output = output .. [[<span style="position:absolute; margin-top:- | if i > (360/r) then | ||
i = 0 | |||
d = d + 40 | |||
r = r / 1.5 | |||
end | |||
end | end | ||
return output .. "</div>" | return output .. "</div>" |
Latest revision as of 01:34, 18 November 2022
Documentation for this module may be created at Module:Tattoo/doc
local p = {} local cargo = mw.ext.cargo function p.Main( frame ) local t = {} local tables = 'Commendations' local fields = 'Commendation' local args = { where = 'Recipient = "' .. frame.args[1] .. '" AND Commendation LIKE "Highlander %" AND Approved = true' } local results = cargo.query( tables, fields, args ) local tattoo_id = 0 for n = 1, #results do if results[n].Commendation == "Highlander I" then tattoo_id = math.max(tattoo_id, 1) elseif results[n].Commendation == "Highlander II" then tattoo_id = math.max(tattoo_id, 2) elseif results[n].Commendation == "Highlander III" then tattoo_id = math.max(tattoo_id, 3) elseif results[n].Commendation == "Highlander IV" then tattoo_id = math.max(tattoo_id, 4) end end local results = cargo.query( tables, fields, args ) local args = { where = 'Recipient = "' .. frame.args[1] .. '" AND Commendation LIKE "Tattoo:%" AND Approved = true' } local results = cargo.query( tables, fields, args ) local output = "[[Image:Tattoo_" .. tattoo_id .. ".png|frameless|600px]]" .. [[<div style="position:relative;">]] local i = 0 local d = 140 local r = 30 -- n = 1, #results for n = 1, #results do local x = math.cos(math.rad(i*r)) * d local y = math.sin(math.rad(i*r)) * d*1.3 output = output .. [[<span style="position:absolute; margin-top:-310px; margin-left:calc(50% + 0px); left:calc(]] .. x .. [[px - 15px); top:calc(]] .. y .. [[px - 15px);">]].. "[[Image:" .. results[n].Commendation .. "|30px]]" .. [[</span>]] i = i + 1 if i > (360/r) then i = 0 d = d + 40 r = r / 1.5 end end return output .. "</div>" end return p
Categories:
No categories