Module:Cron/drops

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 10:04, 17 October 2024 (Created page with "local exchange = require('Module:Exchange') local p = {} function p.getPages(offset) local ask = mw.smw.ask("-Dropped item::+|?#-=n|?Is members only|?High Alchemy value|limit=500|offset=" .. offset) pages = {} for _, data in ipairs(ask) do mw.logObject(data) local name = data["n"] pages[name] = {data['Is members only'], data['High Alchemy value']} end return pages end function p.each(page, data) end function p.main(frame) local offset = frame.args.of..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Cron/drops/doc

local exchange = require('Module:Exchange')

local p = {}

function p.getPages(offset)
	local ask = mw.smw.ask("[[-Dropped item::+]]|?#-=n|?Is members only|?High Alchemy value|limit=500|offset=" .. offset)
	pages = {}
	for _, data in ipairs(ask) do
		mw.logObject(data)
		local name = data["n"]
		pages[name] = {data['Is members only'], data['High Alchemy value']}
	end
	return pages
end

function p.each(page, data)

end

function p.main(frame)
	local offset = frame.args.offset
	local pages = p.getPages(offset)
	
	for page, data in pairs(pages) do
		p.each(page, data)
		if #data == 0 then
			pages[page] = nil
		end
		-- if #data == 1 then
		-- 	pages[page] = data[1]
		-- end
	end
	
	local ret = mw.dumpObject(pages):gsub('table#%d+', '')
	return ret
end

return p