Last Epoch Wiki
Advertisement

For usage see Template:Base Uniques.

This module imports Module:Equipment.


local cargo = mw.ext.cargo
local Equipment = require('Module:Equipment').List

local p = {}
function p.Shell( frame )
    local args = frame.args
    local fieldstable = {
	"ItemName",
	"ItemType",
	"BaseType",
	"Rarity",
	"ItemBase",
	"LevelReq",
	"ImplicitType",
	"ImplicitAmount",
	"SecondImplicitType",
	"SecondImplicitAmount",
	"ThirdImplicitType",
        "ThirdImplicitAmount",
        "WeaponRange",
        "affix1",
        "affix2",
        "affix3",
        "affix4",
        "SetMod1",
        "SetMod2",
        "SetName",
        "flavortext",
        "Sellprice",
        "_pageName",
		}
    local tables = 'Equipment'
    local fields = table.concat(fieldstable,",")
    -- optional parameters are grouped in one table
    -- you can omit any or all of them, except joinOn if you use more than one table
    
    local cargoquery = { where = ('ItemName="%s"'):format(args.name) }
    local row = cargo.query( tables, fields, cargoquery )[1]
    if not row then return args.default end
    local uniquery = Equipment{where = ('(ItemBase="%s" AND NOT ItemName="%s")' .. '%s'):format( (row.Rarity == 'Base' and row.ItemName or row.ItemBase),(row.ItemName),(row.Rarity ~= 'Base' and 'OR ItemName="' .. row.ItemBase .. '"' or '') ),Affixes='show',SetMods='show',FlavorText='show'}
    if not uniquery then return args.default end
    return mw.html.create():wikitext('<h2>' .. (row.Rarity == 'Base' and 'Equipment Based on ' .. row.ItemName  or 'Equipment Based on ' .. row.ItemBase) .. '</h2>') , uniquery
end
--  . . .
return p
Advertisement