Documentation for this module may be created at Module:Augmented degrade/doc
-- <nowiki>
local p = {}
local exchange = require( 'Module:Exchange') --for coins per charge
local coins = require( 'Module:Coins') --for printing above
local tooltips = require('Module:Tooltip')
local draintable = require('Module:Charge drain').oneslot
local slots = {
['2h'] = 1.5,
mh = 1,
['1h'] = 1,
armour = 1,
a = 1,
body = 1,
legs = 1,
shield = 0.5,
oh = 0.5,
t = 0.25,
tool = 0.25,
}
function p.get_base(tier, slot)
if tier < 67 then
tier = 67
end
return math.floor(((tier-60)/8 * slots[slot] * 100 + .05)) / 100
end
function p.get_tooltip(tier, slot)
local name = string.format('charge_drain_%s_%s', slot, tier)
local span = tooltips._span({ name })
local divstr = ''
local function get_slot_str()
local slot_str = {
['2h'] = 'a tier %s two-handed weapon',
['mh'] = 'a tier %s main-handed weapon',
['body'] = 'tier %s body armour',
['legs'] = 'tier %s leg armour',
['shield'] = 'a tier %s shield',
['oh'] = 'a tier %s off-handed weapon',
['tool'] = 'a tier %s skilling tool',
}
return string.format(slot_str[slot], tier)
end
div = tooltips._div({
name = name,
hasarrow = true,
limitwidth = true,
content = string.format('Your current drain rate for %s is given by the following table.<br />It depends on your current reduction researched, the [[equipment level|item level]], and [[Efficient]]/[[Enhanced Efficient]] perk presence.\n%s\nFor more information, see [[Charge pack#Charge drain]].', get_slot_str(), tostring(draintable(tier,slot)))
})
return span, div
end
function p.main(frame)
local args = frame:getParent().args
local level = tonumber(args.level or 1)
local slot = string.lower(args.slot or '')
local slot_multiplier = slots[slot] or 1
page_title = mw.title.getCurrentTitle().fullText
local drain, hours
if args.drain then
drain = args.drain
else
if level < 70 then
drain = 0.87
else
drain = (level-60)/8.0
end
drain = math.floor((drain * slot_multiplier * 100 + .05)) / 100
end
local ret
if args.d2d then --this item degrades to dust
--open with standard d2d text
ret = string.format("The %s uses charges stored within the item (not in the universal [[charge pack]]). It degrades exactly as the non-augmented version does: it has [[equipment degradation|100,000 charges of combat]]. These charges can be replenished by combining it with a non-dyed, augmented variant of the same item. This will combine the charges of both items but any excess charge will be lost, furthermore only one version may have perks on it. When combining two items the greater item experience of the two items is retained.\n\n", page_title)
local level_10_limit = "The item can be trained and [[equipment siphon|siphoned]] as normal while it has charges. Once it runs out of charges, it will retain its equipment bonuses until it reaches equipment level 10, where it will become unusable and has to be recharged or be disassembled. "
if args.d2d:lower() == 'dyed' then
ret = ret..level_10_limit..string.format(" This will return an un-augmented, broken [[%s]]. It can then be repaired and re-augmented as normal. A dye can be used on an augmented, undyed version to produce this item.\n\n", page_title:gsub('[Aa]ugmented', ''))
elseif args.ancientspec and string.sub(args.ancientspec:lower(),1,string.len('y'))=='y' then
ret = ret..level_10_limit.." Additionally, using the weapon's special attack will drain 100 charges, or 0.1% of maximum charge. The special attack cannot be used if there are 0 charges remaining.\n\n"
--in the above concat we add on special attack cost text
elseif args.refac and string.sub(args.refac:lower(),1,string.len('y'))=='y' then
ret = ret..level_10_limit..string.format(" This will return an unrefined [[%s]]. It can then be refined and re-augmented as normal.\n\n", page_title:gsub('[Aa]ugmented [Rr]efined', ''))
--in the above comcat, we present heart of gielinor refined armour degradation
else
ret = ret..level_10_limit
end
ret = ret.."Unlike normal augmented items, this item is made at an [[Inventor's workbench]] from a new, fully charged item, an [[augmentor]], and 36 [[divine charge]]s. It cannot be made from a partially used component. [[Augmentation dissolver]]s cannot be used on this item."
else --this is a typical augmented item
local span, div = p.get_tooltip(level, slot)
local coindrain = coins._amount(exchange._price("Divine charge") / 3000 * drain)
ret = string.format("The %s uses charges stored in the universal [[charge pack]]. When the charge pack runs out of charges, the item loses stats and gizmo effects, and can also no longer gain any equipment experience. Function will resume when the pack is recharged with [[divine charge]]s.",page_title)
end
ret = ret.."{{Mainonly|[[Category:Augmented items]]}}"
return ret
end
return p