<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.roatpkz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AUses_material_list</id>
	<title>Module:Uses material list - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.roatpkz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AUses_material_list"/>
	<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;action=history"/>
	<updated>2026-05-02T20:17:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=2056&amp;oldid=prev</id>
		<title>Hefner at 16:16, 30 March 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=2056&amp;oldid=prev"/>
		<updated>2024-03-30T16:16:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:16, 30 March 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot;&gt;Line 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local t1 = os.clock()&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local t1 = os.clock()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    local smwdata = mw.smw.ask(query)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local t2 = os.clock()&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     local t2 = os.clock()&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hefner</name></author>
	</entry>
	<entry>
		<id>https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=318&amp;oldid=prev</id>
		<title>Hefner: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=318&amp;oldid=prev"/>
		<updated>2024-03-23T19:30:08Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:30, 23 March 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Hefner</name></author>
	</entry>
	<entry>
		<id>https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=317&amp;oldid=prev</id>
		<title>Armadyl Godsword&gt;Towelcat: a price column is unnecessary here/borders on being actively unhelpful</title>
		<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Uses_material_list&amp;diff=317&amp;oldid=prev"/>
		<updated>2023-05-18T21:11:50Z</updated>

		<summary type="html">&lt;p&gt;a price column is unnecessary here/borders on being actively unhelpful&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local geprice = require(&amp;#039;Module:Exchange&amp;#039;)._price&lt;br /&gt;
local commas = require(&amp;#039;Module:Addcommas&amp;#039;)&lt;br /&gt;
local skillpic = require(&amp;#039;Module:SCP&amp;#039;)._main&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
local lang = mw.getContentLanguage()&lt;br /&gt;
local trim = mw.text.trim&lt;br /&gt;
&lt;br /&gt;
-- Sorting function for two item objects, first by name, then by sub-text&lt;br /&gt;
function sortItemsByNameSubtext(item1, item2)&lt;br /&gt;
	if (item1.output.name &amp;lt; item2.output.name) then&lt;br /&gt;
		return true&lt;br /&gt;
	elseif (item1.output.name &amp;gt; item2.output.name) then&lt;br /&gt;
		return false&lt;br /&gt;
	else&lt;br /&gt;
		return (item1.output.subtxt or &amp;#039;&amp;#039;) &amp;lt; (item2.output.subtxt or &amp;#039;&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	return p._main(frame:getParent().args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	local materials = {}&lt;br /&gt;
	if (args == nil) then&lt;br /&gt;
		table.insert(materials, mw.title.getCurrentTitle().text)&lt;br /&gt;
	else&lt;br /&gt;
		local splitMultiple = {}&lt;br /&gt;
		for type in string.gmatch(args[1], &amp;#039;([^,]+)&amp;#039;) do&lt;br /&gt;
			table.insert(splitMultiple, type)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		for _, v in ipairs(splitMultiple) do&lt;br /&gt;
			mw.log(v)&lt;br /&gt;
			table.insert(materials, trim(v))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local materialsLowered = {}&lt;br /&gt;
	for index, material in pairs(materials) do&lt;br /&gt;
	    materialsLowered[material:lower()] = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    -- Fetch data&lt;br /&gt;
    local query = {&lt;br /&gt;
        &amp;#039;[[Uses material::&amp;#039;..table.concat(materials, &amp;#039;||&amp;#039;)..&amp;#039;]]&amp;#039;,&lt;br /&gt;
        &amp;#039;[[Production JSON::+]]&amp;#039;,&lt;br /&gt;
        &amp;#039;?=#-&amp;#039;,&lt;br /&gt;
        &amp;#039;?Production JSON = json&amp;#039;,&lt;br /&gt;
        limit = args.limit or 500,&lt;br /&gt;
    }&lt;br /&gt;
    local t1 = os.clock()&lt;br /&gt;
    local smwdata = mw.smw.ask(query)&lt;br /&gt;
    local t2 = os.clock()&lt;br /&gt;
&lt;br /&gt;
    if not smwdata then&lt;br /&gt;
        return &amp;#039;Failed to find products with those materials - ensure they are spelled correctly. (ERR: no results from SMW)[[Category:Empty drop lists]]&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    mw.log(string.format(&amp;#039;SMW: entries %d, time elapsed: %.3f ms.&amp;#039;, #smwdata, (t2 - t1) * 1000))&lt;br /&gt;
&lt;br /&gt;
    -- Post-process&lt;br /&gt;
    data = {}&lt;br /&gt;
    for _, e in ipairs(smwdata) do&lt;br /&gt;
    	if type(e[&amp;#039;json&amp;#039;]) == &amp;#039;string&amp;#039; then&lt;br /&gt;
            local j = mw.text.jsonDecode(e[&amp;#039;json&amp;#039;])&lt;br /&gt;
            table.insert(data, j)&lt;br /&gt;
        elseif type(e[&amp;#039;json&amp;#039;]) == &amp;#039;table&amp;#039; then&lt;br /&gt;
        	for _, f in ipairs(e[&amp;#039;json&amp;#039;]) do&lt;br /&gt;
        		local j = mw.text.jsonDecode(f)&lt;br /&gt;
                table.insert(data, j)&lt;br /&gt;
        	end&lt;br /&gt;
    	end&lt;br /&gt;
    end&lt;br /&gt;
    smwdata = nil&lt;br /&gt;
    &lt;br /&gt;
    -- Items with different variants (e.g. Divine battlemage potion has (1), (2), (3), (4) variants)&lt;br /&gt;
    -- or methods (e.g. &amp;quot;4-dose oil&amp;quot; vs &amp;quot;3-dose oil&amp;quot; for pyre logs) may not come in sorted, so now do a final alphabetical sort on name, sub-text&lt;br /&gt;
    table.sort(data, sortItemsByNameSubtext)&lt;br /&gt;
&lt;br /&gt;
    -- Render page&lt;br /&gt;
    local t = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
    t:addClass(&amp;#039;wikitable sortable products-list align-center-1 align-right-3 align-right-4&amp;#039;)&lt;br /&gt;
    local ttlrow = t:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
            :tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
            	:attr(&amp;#039;colspan&amp;#039;, &amp;#039;2&amp;#039;)&lt;br /&gt;
                :wikitext(&amp;#039;Item&amp;#039;)&lt;br /&gt;
            :done()&lt;br /&gt;
            :tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
                :wikitext(&amp;#039;Members&amp;#039;)&lt;br /&gt;
               :done()&lt;br /&gt;
            :tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
            	:attr(&amp;#039;data-sort-type&amp;#039;, &amp;#039;number&amp;#039;)&lt;br /&gt;
                :wikitext(&amp;#039;Skills&amp;#039;)&lt;br /&gt;
            :done()&lt;br /&gt;
            :tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
            	:attr(&amp;#039;data-sort-type&amp;#039;, &amp;#039;number&amp;#039;)&lt;br /&gt;
            	:wikitext(&amp;#039;XP&amp;#039;)&lt;br /&gt;
            :done()&lt;br /&gt;
            :tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
                :wikitext(&amp;#039;Materials&amp;#039;)&lt;br /&gt;
            :done()&lt;br /&gt;
&lt;br /&gt;
    local rows = 0&lt;br /&gt;
&lt;br /&gt;
    -- Render rows&lt;br /&gt;
    for _, item in ipairs(data) do&lt;br /&gt;
        local _found = false&lt;br /&gt;
        for _,mat_info in ipairs(item.materials) do&lt;br /&gt;
            if materialsLowered[mat_info.name:lower()] == true then&lt;br /&gt;
                _found = true&lt;br /&gt;
                break&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        if _found then&lt;br /&gt;
            local namestr&lt;br /&gt;
            if (tonumber(item.output.quantity) or 0) &amp;gt; 1 then&lt;br /&gt;
                namestr = string.format(&amp;#039;[[%s]] × %s&amp;#039;, item.output.name, item.output.quantity)&lt;br /&gt;
            else&lt;br /&gt;
                namestr = string.format(&amp;#039;[[%s]]&amp;#039;, item.output.name)&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            if item.output.subtxt then&lt;br /&gt;
            	namestr = string.format(&amp;#039;%s &amp;lt;br /&amp;gt;&amp;lt;small&amp;gt;(%s)&amp;lt;/small&amp;gt;&amp;#039;, namestr, item.output.subtxt)	&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            local memberstr&lt;br /&gt;
            members = item.members&lt;br /&gt;
            if members == &amp;#039;Yes&amp;#039; then&lt;br /&gt;
				memberstr = &amp;quot;[[File:Member icon.png|center|link=Members]]&amp;quot;	&lt;br /&gt;
			elseif members == &amp;#039;No&amp;#039; then&lt;br /&gt;
				memberstr = &amp;quot;[[File:Free-to-play icon.png|center|link=Free-to-play]]&amp;quot;	&lt;br /&gt;
			end&lt;br /&gt;
		&lt;br /&gt;
            local experience_cell = mw.html.create(&amp;#039;td&amp;#039;)&lt;br /&gt;
            experience_cell:addClass(&amp;#039;plainlist&amp;#039;)&lt;br /&gt;
            local experience_ul = experience_cell:tag(&amp;#039;ul&amp;#039;)&lt;br /&gt;
            experience_ul:addClass(&amp;#039;skills-list&amp;#039;)&lt;br /&gt;
            local skills_cell = mw.html.create(&amp;#039;td&amp;#039;)&lt;br /&gt;
            skills_cell:addClass(&amp;#039;plainlist&amp;#039;)&lt;br /&gt;
            local skills_ul = skills_cell:tag(&amp;#039;ul&amp;#039;)&lt;br /&gt;
            skills_ul:addClass(&amp;#039;skills-list&amp;#039;)&lt;br /&gt;
            if #item.skills == 0 then&lt;br /&gt;
        		local skill_li = skills_ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
        		local experience_li = experience_ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
        		experience_cell:addClass(&amp;#039;table-na&amp;#039;):css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
        		experience_li:wikitext(string.format(&amp;#039;None&amp;#039;))&lt;br /&gt;
        		skills_cell:addClass(&amp;#039;table-na&amp;#039;):css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
        		skill_li:wikitext(string.format(&amp;#039;None&amp;#039;))&lt;br /&gt;
        	else&lt;br /&gt;
        		for index, v in ipairs(item.skills) do&lt;br /&gt;
            		local skill_li = skills_ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
            		local experience_li = experience_ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
            		local stripped_experience = string.gsub(v.experience, &amp;#039;,&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
            		skill_li:attr(&amp;#039;data-sort-value&amp;#039;, index == 1 and v.level or &amp;#039;&amp;#039;):wikitext(skillpic(lang:ucfirst(v.name), v.level))&lt;br /&gt;
            		experience_li:attr(&amp;#039;data-sort-value&amp;#039;, index == 1 and v.experience or &amp;#039;&amp;#039;):wikitext(tonumber(stripped_experience) ~= nil and skillpic(lang:ucfirst(v.name), v.experience) or v.experience)&lt;br /&gt;
        		end&lt;br /&gt;
        	end&lt;br /&gt;
            local mats_ul = mw.html.create(&amp;#039;ul&amp;#039;)&lt;br /&gt;
            mats_ul:addClass(&amp;#039;products-materials&amp;#039;)&lt;br /&gt;
            local materialsortvalue = nil&lt;br /&gt;
            for _, mat_info in ipairs(item.materials) do&lt;br /&gt;
                local mat_li = mats_ul:tag(&amp;#039;li&amp;#039;)&lt;br /&gt;
                local qty = string.gsub(mat_info.quantity, &amp;#039;%-&amp;#039;, &amp;#039;–&amp;#039;)&lt;br /&gt;
                local matnm = mat_info.name&lt;br /&gt;
            	for _,mat in ipairs(materialsLowered) do&lt;br /&gt;
            		if mat_info.name:lower() == mat then&lt;br /&gt;
            			mat_li:addClass(&amp;#039;production-selected&amp;#039;)&lt;br /&gt;
            		end&lt;br /&gt;
            	end&lt;br /&gt;
                if materialsLowered[mat_info.name:lower()] == true then&lt;br /&gt;
                    mat_li:addClass(&amp;#039;production-selected&amp;#039;)&lt;br /&gt;
                end&lt;br /&gt;
                &lt;br /&gt;
                if materialsortvalue == nil then&lt;br /&gt;
                	materialsortvalue = qty&lt;br /&gt;
                end&lt;br /&gt;
                &lt;br /&gt;
                mat_li:wikitext(string.format(&amp;#039;%s × [[%s]]&amp;#039;, commas._add(qty), matnm))&lt;br /&gt;
            end&lt;br /&gt;
&lt;br /&gt;
            local prow = t:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
            	:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
            		:wikitext(item.output.image)&lt;br /&gt;
                :tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
                	:attr(&amp;#039;data-sort-value&amp;#039;, item.product)&lt;br /&gt;
                    :wikitext(namestr)&lt;br /&gt;
                :done()&lt;br /&gt;
                :tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
                	:wikitext(memberstr)&lt;br /&gt;
                :node(skills_cell)&lt;br /&gt;
                :node(experience_cell)&lt;br /&gt;
                :tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
                	:attr(&amp;#039;data-sort-value&amp;#039;, materialsortvalue)&lt;br /&gt;
                	:addClass(&amp;#039;plainlist&amp;#039;)&lt;br /&gt;
                    :node(mats_ul)&lt;br /&gt;
                :done()&lt;br /&gt;
            rows = rows + 1&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if rows == 0 then&lt;br /&gt;
        return &amp;#039;Failed to find products with those materials - ensure they are spelled correctly. (ERR: no mats found in results)[[Category:Empty drop lists]]&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return t&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[ DEBUG COPYPASTA&lt;br /&gt;
= p._main({&amp;#039;Mithril bar&amp;#039;})&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Armadyl Godsword&gt;Towelcat</name></author>
	</entry>
</feed>