Documentation for this module may be created at Module:Augmented degrade/doc
local p = {}
local tooltips = require('Module:Tooltip')
local draintable = require('Module:Charge drain').oneslot
local slots = {
['2h'] = 1.5,
['mh'] = 1.0,
['body'] = 1.0,
['legs'] = 1.0,
['shield'] = 0.5,
['oh'] = 0.5,
['tool'] = 0.25
}
local function 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]] 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 span, div = get_tooltip(level, slot)
local ret
if args.d2d then
hours = 100000 / (drain * 60 * 60)
ret = string.format("The %s uses charges stored within the item (not in the universal [[charge pack]]). Without any reductions researched, this item uses charges at the rate of %s charges per second.%s It is created with 100,000 internal charges (thus lasting an absolute minimum time of %.1f hours), and they cannot be replenished.%s\n\n"..
"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 level 10, where it will become unusable and can only be disassembled.\n\n"..
"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.",page_title,drain, tostring(span),hours, tostring(div))
else
ret = string.format("The %s uses charges stored in the universal [[charge pack]]. Without any reductions researched, this item uses charges at the rate of of %s charges per second.%s The charge pack can be replenished with [[Divine charge]]s, which add 3,000 charges each.%s\n\n"..
"When the charge pack runs out of charges, augmented equipment loses stats and gizmo effects. Items can also no longer gain any equipment experience. Items retain their gizmos and level, meaning nothing will be lost when the pack is recharged.",page_title,drain, tostring(span), tostring(div))
end
return ret
end
return p