RuneScape Wiki
Advertisement

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

	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 = 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))

	return ret
end

return p
Advertisement