Module:Weapon

From Veloren Wiki
Revision as of 21:34, 9 December 2021 by Scott Williams (talk | contribs) (Created page with "local lootTable = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title='Template:Loot tables.json'}) local p = {} p.getLootTable = function(frame) local npc = frame.args[1] local txt = frame:expandTemplate{ title = 'LootHeader' } for i=1, #lootTable, 1 do if lootTable[i][1] == npc then txt = txt .. frame:expandTemplate{ title = 'LootRow', args = { itemname = lootTable[i][3], quantity = lootTable[i][4], rarity = lootTable[i][2] .. '%' } } end end t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Weapon/doc

local lootTable = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title='Template:Loot tables.json'})

local p = {}

p.getLootTable = function(frame)
	local npc = frame.args[1]
	local txt = frame:expandTemplate{ title = 'LootHeader' }
	for i=1, #lootTable, 1 do
		if lootTable[i][1] == npc then
			txt = txt .. frame:expandTemplate{ title = 'LootRow', args = { itemname = lootTable[i][3], quantity = lootTable[i][4], rarity = lootTable[i][2] .. '%'   } }
		end
	end
	txt = txt .. frame:expandTemplate{ title = 'LootEnd' }
	return txt
end

p.getSourceTable = function(frame)
	local item = frame.args[1]
	local txt = frame:expandTemplate{ title = 'SourceHeader' }
	for i=1, #lootTable, 1 do
		if lootTable[i][3] == item then
			txt = txt .. frame:expandTemplate{ title = 'SourceRow', args = { npcname = lootTable[i][1], quantity = lootTable[i][4], rarity = lootTable[i][2] .. '%'   } }
		end
	end
	txt = txt .. frame:expandTemplate{ title = 'LootEnd' }
	return txt
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.