Module:StoreLine: Difference between revisions

Jump to navigation Jump to search
25 bytes removed ,  11:54, 4 April 2022
no edit summary
No edit summary
Tag: Reverted
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 35: Line 35:
     local name, buyvalue, sellvalue, currency, level, members = params.defaults{
     local name, buyvalue, sellvalue, currency, level, members = params.defaults{
         {args.name or args.Name, ''},
         {args.name or args.Name, ''},
         {args.buy or args.Buy, ''},
         {args.buy or args.Buy, 'N/A'},
         {args.sell or args.Sell, ''},
         {args.sell or args.Sell, 'N/A'},
{args.currency or args.Currency, 'Gold'},
{args.currency or args.Currency, 'Gold'},
{args.level or args.Level, '?'},
{args.level or args.Level, '?'},
Line 47: Line 47:


     -- Lookup SMW value
     -- Lookup SMW value
     if itemvalue == ''  then
     --if itemvalue == ''  then
        itemvalue = getSMWInfo(smwname) or ''
  --    itemvalue = getSMWInfo(smwname) or ''
     end
     --end
      
      
     -- Check precached Module:DropsLine/itemData - gets GE alch so inaccurate
     -- Check precached Module:DropsLine/itemData - gets GE alch so inaccurate
Line 74: Line 74:
     sellvalue = commas._strip(sellvalue)
     sellvalue = commas._strip(sellvalue)
     levelvalue = commas._strip(level)
     levelvalue = commas._strip(level)
     local buy_smw = tonumber(buyvalue)
     local buy_smw = tonumber(buyvalue) or 1e10
     local sell_smw = tonumber(sellvalue) or 1e10
     local sell_smw = tonumber(sellvalue) or 1e10
     local level_smw = tonumber(levelvalue) or 1e10
     local level_smw = tonumber(levelvalue) or 1e10
Line 83: Line 83:
     if buyvalue ~= 'N/A' then
     if buyvalue ~= 'N/A' then
         if buyvalue == '' and itemvalue ~= '' then
         if buyvalue == '' and itemvalue ~= '' then
             buyvalue = math.floor(math.max(itemvalue*buymultiplier/1000,itemvalue*0.1))
             buyvalue = math.floor(math.max(itemvalue*buymultiplier/1000,1))
             buy_smw = buyvalue
             buy_smw = buyvalue
         end
         end
Line 102: Line 102:
     -- no hideXXX parameter for the column that lists the actual items.
     -- no hideXXX parameter for the column that lists the actual items.
     ret:tag('td'):css('text-align','left'):wikitext(mw.ustring.format('[[%s|%s]]', name, displayname))
     ret:tag('td'):css('text-align','left'):wikitext(mw.ustring.format('[[%s|%s]]', name, displayname))
     if not hidesell then
     if not hidebuy then
        if buyvalue=='N/A' then
            ret:tag('td'):attr('data-sort-value', 0):attr('class','table-na'):wikitext('<small>N/A</small>'):done()
        else
            ret:tag('td')
                    :attr('data-sort-value', buy_smw or 0)
                    :wikitext(buyvalue)
              :done()
        end
    end
 
if not hidesell then
         if sellvalue == 'N/A' then
         if sellvalue == 'N/A' then
             ret:tag('td'):attr('data-sort-value', 0):attr('class','table-na'):wikitext('<small>N/A</small>'):done()
             ret:tag('td'):attr('data-sort-value', 0):attr('class','table-na'):wikitext('<small>N/A</small>'):done()
Line 112: Line 123:
         else
         else
             ret:tag('td')
             ret:tag('td')
                 :attr('data-sort-value', sell_smw)
                 :attr('data-sort-value', sell_smw or 0)
                 :wikitext(sellvalue)
                 :wikitext(sellvalue)
             :done()
             :done()
        end
    end
    if not hidebuy then
        if buyvalue=='N/A' then
            ret:tag('td'):attr('data-sort-value', 0):attr('class','table-na'):wikitext('<small>N/A</small>'):done()
        else
            ret:tag('td')
                    :attr('data-sort-value', buy_smw or 0)
                    :wikitext(buyvalue)
              :done()
         end
         end
     end
     end
Line 171: Line 172:
         smw_sub['Sold item'] = name
         smw_sub['Sold item'] = name
         smw_sub['Sold item text'] = displayname
         smw_sub['Sold item text'] = displayname
         smw_sub['Store sell price'] = sell_smw --type = number for sorting purposes
         smw_sub['Store sell price'] = sell_smw or 'N/A' --type = number for sorting purposes
         smw_sub['Store buy price'] = buy_smw or 'N/A'
         smw_sub['Store buy price'] = buy_smw or 'N/A'
         smw_sub['Store currency'] = currency
         smw_sub['Store currency'] = currency
         smw_sub['Store notes'] = namenotes
         smw_sub['Store notes'] = namenotes
smw_sub['Is members only'] = yesno(members)
smw_sub['Is members only'] = members
smw_sub['Members'] = yesno(members)
         mw.smw.subobject(smw_sub) -- add item subobject to page
         mw.smw.subobject(smw_sub) -- add item subobject to page
          
          

Navigation menu