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, 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
		if args.d2d:lower() == 'dyed' then
			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 cannot be replenished.\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 revert to a dyed, un-augmented, broken %s (installed gizmos are placed into your inventory). It can then be repaired and re-augmented as normal.\n\n"..
				"Unlike normal augmented items, this item is made at an [[Inventor's workbench]] from a fully charged item, an [[augmentor]], and 36 [[divine charge]]s. It cannot be made from a partially used component. Alternatively, the dye can be used on an augmented, undyed version. [[Augmentation dissolver]]s cannot be used on this item.", page_title, page_title:gsub('[Aa]ugmented', ''))
		else
		    -- if we want the specdrain text
			if args.ancientspec and string.sub(args.ancientspec:lower(),1,string.len('y'))=='y' then
				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 cannot be replenished. Additionally, using the weapon's special attack will drain 2,000 charges, or 0.5%% 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
				"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 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)
			else
				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 cannot be replenished.\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 equipment 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)
			end
		end
    else
		local span, div = get_tooltip(level, slot)
	    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 %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
Advertisement