Module:Shop: Difference between revisions

500 bytes removed ,  4 April 2021
Remove special handling of Cape of Completion, as now exists within shop data
(Added qty to getItemSourceArray/getItemCostArray to save time)
(Remove special handling of Cape of Completion, as now exists within shop data)
Line 8: Line 8:
local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
local Areas = require('Module:CombatAreas')
local Areas = require('Module:CombatAreas')
--Cape of Completion is a special purchase that has to be spoofed since it's not in the code
function p.getCapeOfCompletionPurchase()
  local item = Items.getItem('Cape of Completion')
  local purchase = { category = 'Skillcape', id = -1}
  purchase.name = 'Cape of Completion'
  purchase.description = item.description
  purchase.cost = {gp = item.buysFor}
  purchase.unlockRequirements = {text = '100% Completion Log', items = {}}
  purchase.contains = {items = {{item.id, 1}}}
  return purchase
end


function p.processPurchase(category, purchaseID)
function p.processPurchase(category, purchaseID)
Line 90: Line 76:
       table.insert(reqArray, Icons.Icon({purchase.name, type=(isUpgrade and 'upgrade' or 'item')})..' Purchased')
       table.insert(reqArray, Icons.Icon({purchase.name, type=(isUpgrade and 'upgrade' or 'item')})..' Purchased')
     end
     end
  end
  if reqs.completionPercentage ~= nil then
    table.insert(reqArray, tostring(reqs.completionPercentage) .. '% Completion Log')
   end
   end


Line 180: Line 170:
       end
       end
     end
     end
  end
  if itemID == 903 then --Special Cape of Completion thing
    table.insert(purchaseArray, p.getCapeOfCompletionPurchase())
   end
   end