899
edits
(Created page with "local p = {} local lang = mw.language.getContentLanguage() local var = mw.ext.VariablesLua local params = require('Module:Paramtest') local yesno = require('Module:Yesno') local currency_image = require("Module:Currency Image") local commas = require("Module:Addcommas") local exchange = require('Module:Exchange') local find_gevalue = exchange._value local find_geprice = exchange._price local geprices_data = mw.loadData('Module:GEPrices/data') local ptitle = mw.title.g...") |
(no ge) |
||
Line 7: | Line 7: | ||
local commas = require("Module:Addcommas") | local commas = require("Module:Addcommas") | ||
local ptitle = mw.title.getCurrentTitle() | local ptitle = mw.title.getCurrentTitle() | ||
Line 42: | Line 37: | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
-- Params and defaults | -- Params and defaults | ||
local name, stock, buyvalue, sellvalue | local name, stock, buyvalue, sellvalue = params.defaults{ | ||
{args.name or args.Name, ''}, | {args.name or args.Name, ''}, | ||
{args.stock or args.Stock, ''}, | {args.stock or args.Stock, ''}, | ||
{args.buy or args.Buy, ''}, | {args.buy or args.Buy, ''}, | ||
{args.sell or args.Sell, ''}, | {args.sell or args.Sell, ''}, | ||
} | } | ||
local itemvalue = '' | local itemvalue = '' | ||
Line 54: | Line 48: | ||
local displayname = params.default_to(args.displayname or args.DisplayName,name) | local displayname = params.default_to(args.displayname or args.DisplayName,name) | ||
local image = 'File:' .. params.default_to(args.image or args.Image, name .. '.png') | local image = 'File:' .. params.default_to(args.image or args.Image, name .. '.png') | ||
local restock = params.default_to(args.restock or args.Restock,-1) | local restock = params.default_to(args.restock or args.Restock,-1) | ||
-- Lookup SMW value | -- Lookup SMW value | ||
if itemvalue == '' then | if itemvalue == '' then | ||
Line 103: | Line 73: | ||
end | end | ||
end | end | ||
local currency = var.var('Currency', 'Coins') | local currency = var.var('Currency', 'Coins') | ||
local namenotes = var.var('NameNotes', '') | local namenotes = var.var('NameNotes', '') | ||
local useSmw = yesno(var.var('smw','yes'), true) | local useSmw = yesno(var.var('smw','yes'), true) | ||
local hideimage = yesno(var.var('hideImage','no'), false) | local hideimage = yesno(var.var('hideImage','no'), false) | ||
local hidesell = yesno(var.var('hideSell','no'), false) | local hidesell = yesno(var.var('hideSell','no'), false) | ||
local hidebuy = yesno(var.var('hideBuy','no'), false) | local hidebuy = yesno(var.var('hideBuy','no'), false) | ||
Line 121: | Line 87: | ||
local buy_smw = tonumber(buyvalue) | local buy_smw = tonumber(buyvalue) | ||
local sell_smw = tonumber(sellvalue) or 1e10 | local sell_smw = tonumber(sellvalue) or 1e10 | ||
local buyCurrency = '' | local buyCurrency = '' | ||
local sellCurrency = '' | local sellCurrency = '' | ||
if stock=='inf' then stock='∞' end --inf is easier to type | if stock=='inf' then stock='∞' end --inf is easier to type | ||
if stock=='∞' then restock='N/A' end --self-documenting code | if stock=='∞' then restock='N/A' end --self-documenting code | ||
Line 239: | Line 183: | ||
smw_sub['Store currency'] = currency | smw_sub['Store currency'] = currency | ||
smw_sub['Store notes'] = namenotes | smw_sub['Store notes'] = namenotes | ||
mw.smw.subobject(smw_sub) -- add item subobject to page | mw.smw.subobject(smw_sub) -- add item subobject to page | ||
mw.smw.set(smw) -- add data to page | mw.smw.set(smw) -- add data to page |
edits