Módulo:Augmented degrade

De RuneScape Wiki
Ir para navegação Ir para pesquisar
Documentação do módulo
Esta documentação é transcluída de Predefinição:Sem documentação/doc. [editar] [atualizar]
Este módulo não possui nenhuma documentação. Por favor, considere adicionar uma documentação em Módulo:Augmented degrade/doc. [editar]
Módulo:Augmented degrade requer Módulo:Charge drain.
Módulo:Augmented degrade requer Módulo:Mercado.
Módulo:Augmented degrade requer Módulo:Moedas.
Módulo:Augmented degrade requer Módulo:Tooltip.
Módulo:Augmented degrade transclui Predefinição:Degradação do equipamento magistral enfeitado personalizado usando frame:preprocess().
Módulo:Augmented degrade transclui Predefinição:Mainonly usando frame:preprocess().
Módulo:Augmented degrade é solicitado por Módulo:Infobox Bonuses new.

-- <nowiki>
local p = {}

local exchange = require( 'Módulo:Mercado') --for coins per charge
local coins = require( 'Módulo:Moedas') --for printing above
local tooltips = require('Módulo:Tooltip')
local draintable = require('Módulo:Charge drain').oneslot

local slots = {
	['2m'] = 1.5,
	mp = 1,
	armadura = 1,
	corpo = 1,
	pernas = 1,
	escudo = 0.5,
	ms = 0.5,
	ferramenta = 0.25,

function p.get_base(tier, slot)
	if tier < 67 then
		tier = 67
	return math.floor(((tier-60)/8 * slots[slot] * 100 + .05)) / 100

function p.main_tooltip(frame)
	local args = frame:getParent().args
	local s,d = p.get_tooltip(args.level, args.slot)
	return tostring(s)..tostring(d)

function p.get_tooltip(tier, slot)
	local name = string.format('drenagem_de_carga_%s_%s', slot, tier)
	local span = tooltips._span({ name })
	local divstr = ''
	local function get_slot_str()
		local slot_str = {
			['2m'] = 'uma arma de duas mãos de nível %s',
			['mp'] = 'uma arma de mão primária de nível %s',
			['corpo'] = 'armadura corporal de nível %s',
			['pernas'] = 'armadura de perna de nível %s',
			['escudo'] = 'um escudo de nível %s',
			['ms'] = 'uma arma de mão secundária de nível %s',
			['ferramenta'] = 'uma ferramenta de nível %s',
		return string.format(slot_str[slot], tier)
	div = tooltips._div({
		name = name,
		hasarrow = true,
		limitwidth = true,
		content = string.format('Sua taxa de drenagem atual para %s é fornecida pela tabela a seguir. <br /> Depende de sua redução atual pesquisada, o [[nível de equipamento|nível do objeto]] e de [[Eficiência]]/[[Eficiência Superior]]. <br/> %s <br/> Para obter mais informações, consulte [[Bateria de carga#Drenagem de carga]].', get_slot_str(), tostring(draintable(tier,slot)))
	return span, div

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
		if level < 70 then
			drain = 0.87
			drain = (level-60)/8.0

		drain = math.floor((drain * slot_multiplier * 100 + .05)) / 100

	local ret
	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.tmw == 'y' or args.cftmw == 'y' then --this item is a piece of augmented trimmed masterwork armour
		local num_charges = args.cftmw == 'y' and "200,000" or "100,000"
		ret = string.format("The %s only uses the normal [[equipment degradation]] mechanic and not the [[charge pack|invention charge drain]] system.\nIt has %s charges of combat, and will degrade to a broken, unusable state. It can be fully repaired at any time at an [[anvil]] using a new, untrimmed masterwork variant of the same item plus 32 [[divine charge]]s. If the armour is fully depleted, it can also be repaired from the inventory.", page_title, num_charges)
		if args.cftmw == 'y' then
			ret = ret..'\n\n'..mw.getCurrentFrame():preprocess('{{Degradação do equipamento magistral enfeitado personalizado}}')
		ret = ret..'\n\n'..level_10_limit
	    ret = ret..'\n\n'.."Unlike normal augmented items, this item is made at an [[Inventor's workbench]] from the unaugmented item, an [[augmentor]], and 36 [[divine charge]]s. It can be made from a partially used component. [[Augmentation dissolver]]s cannot be used on this item."
		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)
			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
	            ret = ret..level_10_limit
	    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("Carga divina") / 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)
	local sort_name = (string.gsub(page_title, 'Aprimorado ', '')):gsub('^%l', string.upper)
   ret = ret..mw.getCurrentFrame():preprocess('{{Mainonly|[[Categoria:Objetos aprimorados|'..sort_name..']]}}')

	return ret

return p