<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AEmberFantasy%2Fsandbox%2FSlottable</id>
	<title>Module:EmberFantasy/sandbox/Slottable - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AEmberFantasy%2Fsandbox%2FSlottable"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;action=history"/>
	<updated>2026-05-05T15:18:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=38378&amp;oldid=prev</id>
		<title>Alex at 10:22, 17 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=38378&amp;oldid=prev"/>
		<updated>2024-10-17T10:22:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;amp;diff=38378&amp;amp;oldid=35159&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=35159&amp;oldid=prev</id>
		<title>Alex at 23:13, 16 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=35159&amp;oldid=prev"/>
		<updated>2024-10-16T23:13:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;amp;diff=35159&amp;amp;oldid=34919&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=34919&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;-- &lt;pre&gt; require(&#039;Module:Mw.html extension&#039;)  local p = {}  local format = require(&#039;Module:Format equipment stat&#039;).format --for formatting the stats with + and - symbols on output  local p2pIcon = &#039;link=Pay-to-play&#039; --these icons are for the later members/f2p stars local f2pIcon = &#039;link=Free-to-play&#039;  local stats = {&#039;astab&#039;, &#039;aslash&#039;, &#039;acrush&#039;, &#039;amagic&#039;, &#039;arange&#039;, &#039;dstab&#039;, &#039;dslash&#039;, &#039;dcrush&#039;, &#039;dm...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:EmberFantasy/sandbox/Slottable&amp;diff=34919&amp;oldid=prev"/>
		<updated>2024-10-16T23:12:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- &amp;lt;pre&amp;gt; require(&amp;#039;Module:Mw.html extension&amp;#039;)  local p = {}  local format = require(&amp;#039;Module:Format equipment stat&amp;#039;).format --for formatting the stats with + and - symbols on output  local p2pIcon = &amp;#039;&lt;a href=&quot;/w/File:Member_icon.png&quot; title=&quot;File:Member icon.png&quot;&gt;frameless|link=Pay-to-play&lt;/a&gt;&amp;#039; --these icons are for the later members/f2p stars local f2pIcon = &amp;#039;&lt;a href=&quot;/w/File:Free-to-play_icon.png&quot; title=&quot;File:Free-to-play icon.png&quot;&gt;frameless|link=Free-to-play&lt;/a&gt;&amp;#039;  local stats = {&amp;#039;astab&amp;#039;, &amp;#039;aslash&amp;#039;, &amp;#039;acrush&amp;#039;, &amp;#039;amagic&amp;#039;, &amp;#039;arange&amp;#039;, &amp;#039;dstab&amp;#039;, &amp;#039;dslash&amp;#039;, &amp;#039;dcrush&amp;#039;, &amp;#039;dm...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- &amp;lt;pre&amp;gt;&lt;br /&gt;
require(&amp;#039;Module:Mw.html extension&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local format = require(&amp;#039;Module:Format equipment stat&amp;#039;).format --for formatting the stats with + and - symbols on output&lt;br /&gt;
&lt;br /&gt;
local p2pIcon = &amp;#039;[[File:Member icon.png|frameless|link=Pay-to-play]]&amp;#039; --these icons are for the later members/f2p stars&lt;br /&gt;
local f2pIcon = &amp;#039;[[File:Free-to-play icon.png|frameless|link=Free-to-play]]&amp;#039;&lt;br /&gt;
&lt;br /&gt;
local stats = {&amp;#039;astab&amp;#039;, &amp;#039;aslash&amp;#039;, &amp;#039;acrush&amp;#039;, &amp;#039;amagic&amp;#039;, &amp;#039;arange&amp;#039;, &amp;#039;dstab&amp;#039;, &amp;#039;dslash&amp;#039;, &amp;#039;dcrush&amp;#039;, &amp;#039;dmagic&amp;#039;, &amp;#039;drange&amp;#039;, &amp;#039;str&amp;#039;, &amp;#039;rstr&amp;#039;, &amp;#039;mdmg&amp;#039;, &amp;#039;prayer&amp;#039;}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = frame:getParent().args --get the input from the template&lt;br /&gt;
	local slot = string.lower(tostring(args[&amp;#039;slot&amp;#039;])) --take the slot input as the slot we want the table for&lt;br /&gt;
	local mems = args[&amp;#039;mems&amp;#039;]&lt;br /&gt;
	local dmm = args[&amp;#039;dmm&amp;#039;]&lt;br /&gt;
	local beta = args[&amp;#039;beta&amp;#039;]&lt;br /&gt;
	local data = getData(slot,mems,dmm,beta) --this takes the slot and sends it to our getData function (seen below) which gives us back a data table&lt;br /&gt;
&lt;br /&gt;
	local restbl = mw.html.create(&amp;#039;table&amp;#039;) --start making our results table, beginninig with the header&lt;br /&gt;
	restbl:addClass(&amp;#039;wikitable align-center-1 sortable align-center&amp;#039;)&lt;br /&gt;
		:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):addClass(&amp;#039;unsortable&amp;#039;):wikitext(&amp;#039;&amp;#039;):done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Name&amp;#039;):done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Members&amp;#039;):done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White dagger.png|Stab attack]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White scimitar.png|Slash attack]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White warhammer.png|Crush attack]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Magic icon.png|Magic attack]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Ranged icon.png|Ranged attack]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White dagger.png|Stab defence]]&amp;lt;sup&amp;gt;[[File:Defence icon.png]]&amp;lt;/sup&amp;gt;&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White scimitar.png|Slash defence]]&amp;lt;sup&amp;gt;[[File:Defence icon.png]]&amp;lt;/sup&amp;gt;&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:White warhammer.png|Crush defence]]&amp;lt;sup&amp;gt;[[File:Defence icon.png]]&amp;lt;/sup&amp;gt;&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Magic icon.png|Magic defence]]&amp;lt;sup&amp;gt;[[File:Defence icon.png]]&amp;lt;/sup&amp;gt;&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Ranged icon.png|Ranged defence]]&amp;lt;sup&amp;gt;[[File:Defence icon.png]]&amp;lt;/sup&amp;gt;&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Strength icon.png|Strength]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Ranged Strength icon.png|Ranged Strength]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Magic Damage icon.png|Magic Damage]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;[[File:Prayer icon.png|Prayer]]&amp;#039;) :done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Weight&amp;#039;) :done()&lt;br /&gt;
		:done()&lt;br /&gt;
&lt;br /&gt;
	-- Create the rows for the output table&lt;br /&gt;
	for _, item in ipairs(data) do    --for each row of data, we take it and split it up, then put it into our table row. We also format them with + and - symbols here&lt;br /&gt;
		local row = restbl:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;):wikitext(item.image):done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;):wikitext(item.name):done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;):wikitext(item.members):done()&lt;br /&gt;
		for _, stat in ipairs(stats) do&lt;br /&gt;
			local value = item[stat]&lt;br /&gt;
			local value_num = tonumber(value)&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;):wikitext(format(value))&lt;br /&gt;
				:addClassIf(value_num and (value_num &amp;gt; 0), &amp;#039;table-positive&amp;#039;)&lt;br /&gt;
				:addClassIf(value_num and (value_num &amp;lt; 0), &amp;#039;table-negative&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;):wikitext(item.weight):done()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(restbl) --returns the table back to the template to be put onto the page&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function getData(slotName,mems,dmm,beta) --so this is the function that takes the slot name and gets all the data for the items&lt;br /&gt;
	--first we set up our SMW query&lt;br /&gt;
	local q = {&lt;br /&gt;
		&amp;#039;[[Equipment slot::&amp;#039;..slotName..&amp;#039;]]&amp;#039;, --we want everything that matches the slot we called, and then all the attached data below&lt;br /&gt;
		&amp;#039;?Is members only&amp;#039;,&lt;br /&gt;
		&amp;#039;?Stab attack bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Slash attack bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Crush attack bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Magic attack bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Range attack bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Stab defence bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Slash defence bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Crush defence bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Magic defence bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Range defence bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Strength bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Ranged Strength bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Magic Damage bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Prayer bonus&amp;#039;,&lt;br /&gt;
		&amp;#039;?Category&amp;#039;,&lt;br /&gt;
		&amp;#039;?Image&amp;#039;,&lt;br /&gt;
		&amp;#039;?Weight&amp;#039;,&lt;br /&gt;
		limit = 1000,&lt;br /&gt;
		order = &amp;#039;ascending&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	local smwdata = mw.smw.ask(q) --this now asks the smw for all the data, and saves all of it in smwdata&lt;br /&gt;
	local data = {} --setting this table up to insert processed data into&lt;br /&gt;
&lt;br /&gt;
	for _, item in ipairs(smwdata) do --for each item we found with our smw query&lt;br /&gt;
		local process = true&lt;br /&gt;
		local dmmcat = false&lt;br /&gt;
		local betacat = false&lt;br /&gt;
		if type(item[&amp;#039;Category&amp;#039;]) == &amp;#039;table&amp;#039; then&lt;br /&gt;
			for _, category in ipairs(item[&amp;#039;Category&amp;#039;]) do&lt;br /&gt;
				if category == &amp;quot;[[:Category:Deadman seasonal items|Deadman seasonal items]]&amp;quot; then&lt;br /&gt;
					dmmcat = true&lt;br /&gt;
				elseif category == &amp;quot;[[:Category:Beta items|Beta items]]&amp;quot; then&lt;br /&gt;
					betacat = true&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if mems == &amp;#039;Members&amp;#039; then&lt;br /&gt;
			if not item[&amp;#039;Is members only&amp;#039;] then&lt;br /&gt;
				process = false&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if mems == &amp;#039;F2P&amp;#039; then&lt;br /&gt;
			if item[&amp;#039;Is members only&amp;#039;] then&lt;br /&gt;
				process = false&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if dmm == &amp;#039;No&amp;#039; then&lt;br /&gt;
			if dmmcat == true then&lt;br /&gt;
				process = false&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if beta == &amp;#039;No&amp;#039; then&lt;br /&gt;
			if betacat == true then&lt;br /&gt;
				process = false&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if process then&lt;br /&gt;
			local dataline = processData(item) --we process it (seen below) and then save it as a line&lt;br /&gt;
			table.insert(data, dataline) --and then we insert that line into our data table to be returned&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return data --and once we&amp;#039;ve processed all the data we send the data table back up to main for the formatting&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function processData(item) --this breaks up the smwdata bit into manageable little bites&lt;br /&gt;
	local name = item[1] or &amp;#039;&amp;#039; --this gets the item name, which by default is in the first position of the query results (lua starts at 1, not 0)&lt;br /&gt;
	local _name = string.match(name, &amp;#039;|(.-)%]&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local members = item[&amp;#039;Is members only&amp;#039;] --members we have to do a bit extra for&lt;br /&gt;
	if members == true then --if it is members, we use the members star&lt;br /&gt;
		members = p2pIcon&lt;br /&gt;
	elseif members == false then --if not, use f2p star&lt;br /&gt;
		members = f2pIcon&lt;br /&gt;
	else&lt;br /&gt;
		members = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local image = item[&amp;#039;Image&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	if type(image) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		image = image[1] -- take the first image available&lt;br /&gt;
	end&lt;br /&gt;
	image = string.match(image, &amp;#039;[Ff]ile:.-%.png&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
	if image ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		image = string.format(&amp;#039;[[%s|link=%s]]&amp;#039;, image, _name)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local keyset=&amp;quot;&amp;quot;&lt;br /&gt;
	local n=0&lt;br /&gt;
	&lt;br /&gt;
	for k,v in pairs(item) do&lt;br /&gt;
	  n=n+1&lt;br /&gt;
	  keyset = keyset .. k .. &amp;quot; (&amp;quot; .. tostring(v) ..&amp;quot;)&amp;quot; .. &amp;quot;:&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return { --now we return the processed data for this item back to the getData function, which sends us another item and repeats until we&amp;#039;ve done them all&lt;br /&gt;
		name = name,&lt;br /&gt;
		image = image,&lt;br /&gt;
		members = members,&lt;br /&gt;
		astab = item[&amp;#039;Stab attack bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		aslash = item[&amp;#039;Slash attack bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		acrush = item[&amp;#039;Crush attack bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		amagic = item[&amp;#039;Magic attack bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		arange = item[&amp;#039;Range attack bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		dstab = item[&amp;#039;Stab defence bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		dslash = item[&amp;#039;Slash defence bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		dcrush = item[&amp;#039;Crush defence bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		dmagic = item[&amp;#039;Magic defence bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		drange = item[&amp;#039;Range defence bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		str = item[&amp;#039;Strength bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		rstr = item[&amp;#039;Ranged Strength bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		mdmg = item[&amp;#039;Magic Damage bonus&amp;#039;] or keyset,&lt;br /&gt;
		prayer = item[&amp;#039;Prayer bonus&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
		weight = item[&amp;#039;Weight&amp;#039;] or &amp;#039;&amp;#039;,&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
p.getData = getData&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>