Módulo:Augmented degrade

De RuneScape Wiki
Ir para: navegação, pesquisa
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 = {
	['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.main_tooltip(frame)
	local args = frame:getParent().args
	local s,d = p.get_tooltip(args.level, args.slot)
	return tostring(s)..tostring(d)
end

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 = {
			['2h'] = 'uma arma de duas mãos de tier %s',
			['mh'] = 'uma arma principal de tier %s',
			['body'] = 'armadura corporal de tier %s',
			['legs'] = 'armadura de perna de tier %s',
			['shield'] = 'um escudo de tier %s',
			['oh'] = 'uma arma sem mão de tier %s',
			['tool'] = 'uma ferramenta de qualificação de tier %s',
		}
		return string.format(slot_str[slot], tier)
	end
	
	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 do equipamento|nível do objeto]] e [[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
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
	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}}')
		end
		
		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."
	else
		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
		    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
	end
	
	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
end

return p