FANDOM


-- <pre>
-- {{ExchangeItem}}
--
 
local p = {}
 
-- enables pulling exchange data from module ns
local luaExcg = false
 
--
-- Simple mw.loadData wrapper
--
function p._load( item )
    item = mw.text.split( item, '' )
    item[1] = mw.ustring.upper( item[1] )
    item = table.concat( item, '' )
    return mw.loadData( 'Module:Exchange/' .. item )
end
 
function p._price()
end
 
function p._icon()
end
 
function p._diff()
end
 
function p._value()
end
 
function p._limit()
end
 
function p._table()
end
 
--
-- {{GEP}} and {{GEPrice}} access point
--
function p.price( frame )
    if not luaExcg then
        error( '`luaExcg` is not enabled' )
    end
 
    local fargs = frame.args
    local pargs = frame:getParent().args
end
 
--
-- {{GEIcon}} access point
--
function p.icon( frame )
    if not luaExcg then
        error( '`luaExcg` is not enabled' )
    end
 
    local args = frame:getParent().args
    local item = args[1]
    local text = args[2] == 'w' and item or ''
    local data = p._load( item )
end
 
--
-- {{GEItem}} access point
--
function p.table( frame )
    if not luaExcg then
        error( '`luaExcg` is not enabled' )
    end
 
    local args = frame:getParent().args
    local item = args[1]
    local data = p._load( item )
end
 
--
-- {{ExchangeItem}} and {{ExchangeItemNat}} access point
--
function p.main( frame )
    local args = frame:getParent().args
    local view = args.View
    local item = args.Item
    local data = {}
 
    if luaExcg then
        data = p._load( item )
    else
        -- map arg names to lower case
        for k, v in pairs( args ) do
            k = mw.text.split( k, '' )
            k[1] = mw.ustring.lower( k[1] )
            k = table.concat( k, '' )
            data[k] = v
        end
    end
 
    if view == 'price' then
        ret = p._price( data )
    elseif view == 'icon' then
        ret = p._icon( data )
    elseif view == 'diff' then
        ret = p._diff( data )
    elseif view == 'value' then
        ret = p._value( data )
    elseif view == 'limit' then
        ret = p._limit( data )
    elseif view == 'table' then
        ret = p._table( data )
    else
        local default = require( 'Module:ExchangeDefault' )
        ret = default._main( frame )
    end
 
    return ret
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.