Difference between revisions of "Module:NHVillagerItemOutput"
From Nookipedia, the Animal Crossing wiki
PanchamBro (talk | contribs) m (adding s to "feature" if only one villager is present) |
PanchamBro (talk | contribs) (using Module:List to format lists) |
||
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local cargo = mw.ext.cargo | local cargo = mw.ext.cargo | ||
+ | local formatList = require('Module:List').listFormat | ||
function tableEmpty(s) | function tableEmpty(s) | ||
Line 25: | Line 26: | ||
} | } | ||
local resultsHHP = cargo.query( tables1, fields1, args1 ) | local resultsHHP = cargo.query( tables1, fields1, args1 ) | ||
− | + | local data1 = {} | |
-- Cargo query for hhp_villager (only facilities) | -- Cargo query for hhp_villager (only facilities) | ||
local tables2 = 'hhp_villager' | local tables2 = 'hhp_villager' | ||
Line 37: | Line 38: | ||
} | } | ||
local resultsHHP_Facility = cargo.query( tables2, fields2, args2 ) | local resultsHHP_Facility = cargo.query( tables2, fields2, args2 ) | ||
− | + | local data2 = {} | |
-- Cargo query for hhp_villager (required items) | -- Cargo query for hhp_villager (required items) | ||
local tables3 = 'hhp_villager' | local tables3 = 'hhp_villager' | ||
Line 49: | Line 50: | ||
} | } | ||
local resultsHHP_Required = cargo.query( tables3, fields3, args3 ) | local resultsHHP_Required = cargo.query( tables3, fields3, args3 ) | ||
− | + | local data3 = {} | |
-- Cargo query for hhp_villager (required item under category for facilities) | -- Cargo query for hhp_villager (required item under category for facilities) | ||
local tables4 = 'hhp_facility_category' | local tables4 = 'hhp_facility_category' | ||
Line 61: | Line 62: | ||
} | } | ||
local resultsHHP_Category = cargo.query( tables4, fields4, args4 ) | local resultsHHP_Category = cargo.query( tables4, fields4, args4 ) | ||
+ | local data4 = {} | ||
local tables5 | local tables5 | ||
Line 89: | Line 91: | ||
resultsHHP_Wardell = cargo.query( tables5, fields5, args5 ) | resultsHHP_Wardell = cargo.query( tables5, fields5, args5 ) | ||
end | end | ||
− | + | local data5 = {} | |
-- Cargo query for nh_clothing (equipable items) | -- Cargo query for nh_clothing (equipable items) | ||
local tables6 = 'nh_clothing' | local tables6 = 'nh_clothing' | ||
Line 100: | Line 102: | ||
} | } | ||
local resultsVill_Equip = cargo.query( tables6, fields6, args6 ) | local resultsVill_Equip = cargo.query( tables6, fields6, args6 ) | ||
− | + | local data6 = {} | |
-- Cargo query for nh_clothing (handbags) | -- Cargo query for nh_clothing (handbags) | ||
local tables7 = 'nh_clothing' | local tables7 = 'nh_clothing' | ||
Line 111: | Line 113: | ||
} | } | ||
local resultsHandbags = cargo.query( tables7, fields7, args7 ) | local resultsHandbags = cargo.query( tables7, fields7, args7 ) | ||
− | + | local data7 = {} | |
+ | -- Cargo query for nh_recipe (Crafting) | ||
+ | local tables8 = 'nh_recipe' | ||
+ | local fields8 = "nh_recipe.en_name" | ||
+ | local args8 = { | ||
+ | where = "nh_recipe._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"", | ||
+ | limit = 2000, | ||
+ | groupBy = 'nh_recipe._pageName', | ||
+ | default = '', | ||
+ | } | ||
+ | local resultsCrafting = cargo.query( tables8, fields8, args8 ) | ||
+ | local data8 = {} | ||
print = print .. "In " .. frame:preprocess('{{HHP|short}}') | print = print .. "In " .. frame:preprocess('{{HHP|short}}') | ||
if (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "starter") then | if (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "starter") then | ||
− | print = print .. ", this item is available from the start for use in designing" | + | print = print .. ", this item is available from the start for use in [[designing]]" |
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then | if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then | ||
print = print .. " and changing the clothes of" | print = print .. " and changing the clothes of" | ||
Line 126: | Line 139: | ||
print = print .. ' ' | print = print .. ' ' | ||
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " feature" | + | print = print .. formatList(data1) .. " feature" |
if #resultsHHP == 1 then | if #resultsHHP == 1 then | ||
print = print .. "s" | print = print .. "s" | ||
Line 143: | Line 148: | ||
end | end | ||
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "sixhouses") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "sixhouses") then | ||
− | print = print .. ", this item is available for use in designing after | + | print = print .. ", this item is available for use in [[designing]] after completing six vacation homes and the [[school]] facility." |
if not tableEmpty(resultsHHP) then | if not tableEmpty(resultsHHP) then | ||
print = print .. ' ' | print = print .. ' ' | ||
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " feature" | + | print = print .. formatList(data1) .. " feature" |
if #resultsHHP == 1 then | if #resultsHHP == 1 then | ||
print = print .. "s" | print = print .. "s" | ||
Line 164: | Line 161: | ||
end | end | ||
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "hybrid") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "hybrid") then | ||
− | print = print .. ", this item is unlocked for use in designing after listening to [[Leif]]'s lecture at the [[school]] regarding hybrid flowers." | + | print = print .. ", this item is unlocked for use in [[designing]] after listening to [[Leif]]'s lecture at the [[school]] regarding hybrid flowers." |
if not tableEmpty(resultsHHP) then | if not tableEmpty(resultsHHP) then | ||
print = print .. ' ' | print = print .. ' ' | ||
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " feature" | + | print = print .. formatList(data1) .. " feature" |
if #resultsHHP == 1 then | if #resultsHHP == 1 then | ||
print = print .. "s" | print = print .. "s" | ||
Line 185: | Line 174: | ||
end | end | ||
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "plant") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "plant") then | ||
− | print = print .. ", this item is unlocked for use in designing when | + | print = print .. ", this item is unlocked for use in [[designing]] when doing the second villager's vacation house." |
if not tableEmpty(resultsHHP) then | if not tableEmpty(resultsHHP) then | ||
print = print .. ' ' | print = print .. ' ' | ||
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " feature" | + | print = print .. formatList(data1) .. " feature" |
if #resultsHHP == 1 then | if #resultsHHP == 1 then | ||
print = print .. "s" | print = print .. "s" | ||
Line 206: | Line 187: | ||
end | end | ||
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "partition") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "partition") then | ||
− | print = print .. ", this item is unlocked for use in designing when | + | print = print .. ", this item is unlocked for use in [[designing]] when doing the eighth villager's vacation house." |
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "party") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "party") then | ||
− | print = print .. ", this item is unlocked for use in designing after attending the first party hosted by [[Lottie]] for designing ten houses." | + | print = print .. ", this item is unlocked for use in [[designing]] after attending the first party hosted by [[Lottie]] for designing ten houses." |
if not tableEmpty(resultsHHP) then | if not tableEmpty(resultsHHP) then | ||
print = print .. ' ' | print = print .. ' ' | ||
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " feature" | + | print = print .. formatList(data1) .. " feature" |
if #resultsHHP == 1 then | if #resultsHHP == 1 then | ||
print = print .. "s" | print = print .. "s" | ||
Line 229: | Line 202: | ||
end | end | ||
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "niko") then | elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "niko") then | ||
− | print = print .. ", this item is unlocked for use in designing after listening to [[Niko]]'s lecture at the [[school]] regarding wooden pillars and counters." | + | print = print .. ", this item is unlocked for use in [[designing]] after listening to [[Niko]]'s lecture at the [[school]] regarding wooden pillars and counters." |
else | else | ||
if not tableEmpty(resultsHHP) then | if not tableEmpty(resultsHHP) then | ||
− | print = print .. ", this item is unlocked for use in designing when doing a vacation home request for " | + | print = print .. ", this item is unlocked for use in [[designing]] when doing a vacation home request for " |
for r = 1, #resultsHHP do | for r = 1, #resultsHHP do | ||
− | + | data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
+ | print = print .. formatList(data1) .. "." | ||
end | end | ||
end | end | ||
Line 269: | Line 233: | ||
end | end | ||
else | else | ||
− | print = print .. ", this item is unlocked for use in designing when tasked by Lottie to design " | + | print = print .. ", this item is unlocked for use in [[designing]] when tasked by Lottie to design " |
for r = 1, #resultsHHP_Facility do | for r = 1, #resultsHHP_Facility do | ||
if r == #resultsHHP_Facility and r-1 ~= 0 then | if r == #resultsHHP_Facility and r-1 ~= 0 then | ||
Line 286: | Line 250: | ||
end | end | ||
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") and (not (tableEmpty(resultsHHP)) or not tableEmpty(resultsHHP_Facility)) then | if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") and (not (tableEmpty(resultsHHP)) or not tableEmpty(resultsHHP_Facility)) then | ||
− | print = print .. " | + | print = print .. " In addition, the item can be used to change the clothing of" |
if not tableEmpty(resultsVill_Equip) and resultsVill_Equip[1].equip == "1" then | if not tableEmpty(resultsVill_Equip) and resultsVill_Equip[1].equip == "1" then | ||
print = print .. " a villager or" | print = print .. " a villager or" | ||
end | end | ||
− | print = print .. " the player either during or after the designing process." | + | print = print .. " the player either during or after the designing process for [[Photo (screenshot)|screenshot purposes]]." |
+ | end | ||
+ | if not isEmpty(frame.args['text-hhp']) then | ||
+ | print = print .. " " .. frame.args['text-hhp'] | ||
end | end | ||
if not tableEmpty(resultsHHP_Required) then | if not tableEmpty(resultsHHP_Required) then | ||
Line 337: | Line 304: | ||
end | end | ||
end | end | ||
− | if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") and not (tableEmpty(resultsHHP)) | + | if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") and (not (tableEmpty(resultsHHP)) or not (tableEmpty(resultsHHP_Facility)) or not isEmpty(frame.args['hhpstatus'])) then |
currency = require("Module:Currency") | currency = require("Module:Currency") | ||
print = print .. '\n\n' | print = print .. '\n\n' | ||
Line 349: | Line 316: | ||
end | end | ||
if (tableEmpty(resultsHHP)) and (tableEmpty(resultsHHP_Facility) and isEmpty(frame.args['hhpstatus'])) then | if (tableEmpty(resultsHHP)) and (tableEmpty(resultsHHP_Facility) and isEmpty(frame.args['hhpstatus'])) then | ||
− | print = print .. ", no villagers or facility unlock this item for designing" | + | print = print .. ", no villagers or facility unlock this item for [[designing]]" |
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then | if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then | ||
print = print .. " and changing the clothing of" | print = print .. " and changing the clothing of" | ||
Line 357: | Line 324: | ||
print = print .. " the player" | print = print .. " the player" | ||
end | end | ||
− | print = print .. ". It can only be used once the player's [[catalog]] is unlocked after completing the 27th vacation home." | + | if not tableEmpty(resultsCrafting) then |
+ | print = print .. ". It can only be used once the player's [[DIY]] catalog is unlocked after completing the 15th vacation home." | ||
+ | else | ||
+ | print = print .. ". It can only be used once the player's [[catalog]] is unlocked after completing the 27th vacation home." | ||
+ | end | ||
if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") then | if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") then | ||
currency = require("Module:Currency") | currency = require("Module:Currency") | ||
Line 391: | Line 362: | ||
function p.furnitureOutput( frame ) | function p.furnitureOutput( frame ) | ||
local print = '' | local print = '' | ||
+ | local data = {} | ||
-- Cargo query for nh_house | -- Cargo query for nh_house | ||
Line 403: | Line 375: | ||
local results = cargo.query( tables, fields, args ) | local results = cargo.query( tables, fields, args ) | ||
if not tableEmpty(results) then | if not tableEmpty(results) then | ||
− | print = print .. "This item " | + | if not isEmpty(frame.args['disable-clothing']) then |
+ | print = print .. "However, this item " | ||
+ | else | ||
+ | print = print .. "This item " | ||
+ | end | ||
if not isEmpty(frame.args['clothing']) and isEmpty(frame.args['disable-clothing']) then | if not isEmpty(frame.args['clothing']) and isEmpty(frame.args['disable-clothing']) then | ||
print = print .. "also " | print = print .. "also " | ||
Line 409: | Line 385: | ||
print = print .. " " | print = print .. " " | ||
end | end | ||
− | print = print .. "appears in the homes of " | + | print = print .. "appears as a furniture item in the homes of " |
for r = 1, #results do | for r = 1, #results do | ||
− | + | data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
+ | print = print .. formatList(data) .. "." | ||
if not isEmpty(frame.args['not-purchasable']) then | if not isEmpty(frame.args['not-purchasable']) then | ||
print = print .. '' | print = print .. '' | ||
else | else | ||
print = print .. " As a result, this item has a chance to be purchasable by the player if they were invited by any of the preceding villagers." | print = print .. " As a result, this item has a chance to be purchasable by the player if they were invited by any of the preceding villagers." | ||
− | |||
− | |||
− | |||
end | end | ||
else | else | ||
print = print .. "No villagers have this item in their home." | print = print .. "No villagers have this item in their home." | ||
end | end | ||
+ | if not isEmpty(frame.args['text']) then | ||
+ | print = print .. " " .. frame.args['text'] .. "." | ||
+ | end | ||
if not isEmpty(frame.args['prune-hhp']) then | if not isEmpty(frame.args['prune-hhp']) then | ||
print = print .. '' | print = print .. '' | ||
Line 444: | Line 411: | ||
function p.clothingOutput( frame ) | function p.clothingOutput( frame ) | ||
local print = '' | local print = '' | ||
− | + | local data = {} | |
+ | |||
-- Cargo query for nh_villager | -- Cargo query for nh_villager | ||
local tables = 'nh_villager' | local tables = 'nh_villager' | ||
Line 458: | Line 426: | ||
print = print .. "This item is worn by " | print = print .. "This item is worn by " | ||
for r = 1, #results do | for r = 1, #results do | ||
− | + | data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
+ | print = print .. formatList(data) .. " as their default outfit." | ||
else | else | ||
print = print .. "No villagers wear this item as their default outfit." | print = print .. "No villagers wear this item as their default outfit." | ||
end | end | ||
+ | if not isEmpty(frame.args['text']) then | ||
+ | print = print .. " " .. frame.args['text'] .. "." | ||
+ | end | ||
if not isEmpty(frame.args['prune-hhp']) then | if not isEmpty(frame.args['prune-hhp']) then | ||
print = print .. '' | print = print .. '' | ||
Line 498: | Line 456: | ||
} | } | ||
local results = cargo.query( tables, fields, args ) | local results = cargo.query( tables, fields, args ) | ||
+ | local data1 = {} | ||
+ | -- Cargo query for nh_villager (Frog villagers) | ||
+ | local tables2 = 'nh_villager' | ||
+ | local fields2 = "nh_villager.icon=icon,nh_villager.name=villager,nh_villager._pageTitle=pageName" | ||
+ | local args2 = { | ||
+ | where = "nh_villager.umbrella = '" .. frame.args['1']:gsub("\'","\\'") .. "' AND species='Frog'", | ||
+ | orderBy = 'nh_villager.name_sort', | ||
+ | limit = 300, | ||
+ | default = '' | ||
+ | } | ||
+ | local resultsFrog = cargo.query( tables2, fields2, args2 ) | ||
+ | local data2 = {} | ||
+ | -- Cargo query for nh_special_character | ||
+ | local tables3 = 'nh_special_character' | ||
+ | local fields3 = "nh_special_character.icon=icon,nh_special_character.name=character,nh_special_character._pageTitle=pageName" | ||
+ | local args3 = { | ||
+ | where = "nh_special_character.umbrella = '" .. frame.args['1']:gsub("\'","\\'") .. "'", | ||
+ | orderBy = 'nh_special_character.name_sort', | ||
+ | limit = 300, | ||
+ | default = '' | ||
+ | } | ||
+ | local resultsSpecial = cargo.query( tables3, fields3, args3 ) | ||
+ | local data3 = {} | ||
+ | -- Cargo query for nh_special_character (Happy Home Paradise) | ||
+ | local tables4 = 'nh_special_character' | ||
+ | local fields4 = "nh_special_character.icon=icon,nh_special_character.name=character,nh_special_character._pageTitle=pageName" | ||
+ | local args4 = { | ||
+ | where = "nh_special_character.umbrella_hhp = '" .. frame.args['1']:gsub("\'","\\'") .. "'", | ||
+ | orderBy = 'nh_special_character.name_sort', | ||
+ | limit = 300, | ||
+ | default = '' | ||
+ | } | ||
+ | local resultsSpecialHHP = cargo.query( tables4, fields4, args4 ) | ||
+ | local data4 = {} | ||
if not tableEmpty(results) then | if not tableEmpty(results) then | ||
print = print .. "This item is used by " | print = print .. "This item is used by " | ||
for r = 1, #results do | for r = 1, #results do | ||
− | + | data1[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | print = print .. " as their default umbrella during periods of [[weather|rain]]." | + | print = print .. formatList(data1) .. " as their default umbrella during periods of [[weather|rain]]." |
− | + | if not tableEmpty(resultsFrog) then | |
− | + | print = print .. " " | |
− | end | + | for r = 1, #resultsFrog do |
− | + | data2[r] = "[[File:" .. resultsFrog[r].icon .. "|25px|link=|alt=|" .. resultsFrog[r].villager .. "]] [[" .. resultsFrog[r].pageName .. "|" .. resultsFrog[r].villager .. "]]" | |
+ | end | ||
+ | print = print .. formatList(data2) | ||
+ | if #resultsFrog == 1 then | ||
+ | print = print .. " has " | ||
+ | else | ||
+ | print = print .. " have " | ||
+ | end | ||
+ | print = print .. "this item as their default umbrella, but will refrain from using the umbrella due to their status as a [[frog (species)|frog]] villager." | ||
+ | end | ||
+ | elseif tableEmpty(results) and not tableEmpty(resultsFrog) then | ||
+ | print = print .. "This item is featured by " | ||
+ | for r = 1, #resultsFrog do | ||
+ | data2[r] = "[[File:" .. resultsFrog[r].icon .. "|25px|link=|alt=|" .. resultsFrog[r].villager .. "]] [[" .. resultsFrog[r].pageName .. "|" .. resultsFrog[r].villager .. "]]" | ||
+ | end | ||
+ | print = print .. formatList(data2) .. " as their default umbrella during periods of [[weather|rain]], but they will refrain from using the umbrella due to their status as a [[frog (species)|frog]] villager." | ||
+ | else | ||
print = print .. "No villagers use this item as their default umbrella during periods of [[weather|rain]]." | print = print .. "No villagers use this item as their default umbrella during periods of [[weather|rain]]." | ||
end | end | ||
+ | if not tableEmpty(resultsSpecial) then | ||
+ | if not tableEmpty(results) or not tableEmpty(resultsFrog) then | ||
+ | print = print .. " [[Special characters]] that also features this item as their default umbrella include " | ||
+ | else | ||
+ | print = print .. " However, [[special characters]] that features this item as their default umbrella include " | ||
+ | end | ||
+ | for r = 1, #resultsSpecial do | ||
+ | data3[r] = "[[File:" .. resultsSpecial[r].icon .. "|25px|link=|alt=|" .. resultsSpecial[r].character .. "]] [[" .. resultsSpecial[r].pageName .. "|" .. resultsSpecial[r].character .. "]]" | ||
+ | end | ||
+ | print = print .. formatList(data3) | ||
+ | if not tableEmpty(resultsSpecialHHP) then | ||
+ | print = print .. ", as well as " | ||
+ | for r = 1, #resultsSpecialHHP do | ||
+ | data4[r] = "[[File:" .. resultsSpecialHHP[r].icon .. "|25px|link=|alt=|" .. resultsSpecialHHP[r].character .. "]] [[" .. resultsSpecialHHP[r].pageName .. "|" .. resultsSpecialHHP[r].character .. "]]" | ||
+ | end | ||
+ | print = print .. formatList(data4) | ||
+ | if #resultsSpecialHHP == 1 then | ||
+ | print = print .. " who only uses this umbrella in the " .. frame:preprocess('{{HHP|short}}') .. " DLC." | ||
+ | else | ||
+ | print = print .. ", all of whom only use this umbrella in the " .. frame:preprocess('{{HHP|short}}') .. " DLC." | ||
+ | end | ||
+ | else | ||
+ | print = print .. "." | ||
+ | end | ||
+ | end | ||
+ | if tableEmpty(resultsSpecial) and not tableEmpty(resultsSpecialHHP) then | ||
+ | if not tableEmpty(results) or not tableEmpty(resultsFrog) then | ||
+ | print = print .. " [[Special characters]] that also features this item as their default umbrella in " .. frame:preprocess('{{HHP|short}}') .. " include " | ||
+ | else | ||
+ | print = print .. " However, [[special characters]] that features this item as their default umbrella in " .. frame:preprocess('{{HHP|short}}') .. " include " | ||
+ | end | ||
+ | for r = 1, #resultsSpecialHHP do | ||
+ | data4[r] = "[[File:" .. resultsSpecialHHP[r].icon .. "|25px|link=|alt=|" .. resultsSpecialHHP[r].character .. "]] [[" .. resultsSpecialHHP[r].pageName .. "|" .. resultsSpecialHHP[r].character .. "]]" | ||
+ | end | ||
+ | print = print .. formatList(data4) .. '.' | ||
+ | end | ||
+ | |||
+ | if not isEmpty(frame.args['text']) then | ||
+ | print = print .. " " .. frame.args['text'] .. "." | ||
+ | end | ||
if not isEmpty(frame.args['prune-hhp']) then | if not isEmpty(frame.args['prune-hhp']) then | ||
print = print .. '' | print = print .. '' | ||
Line 530: | Line 568: | ||
function p.interiorOutput( frame ) | function p.interiorOutput( frame ) | ||
local print = '' | local print = '' | ||
+ | local data = {} | ||
-- Cargo query for nh_house | -- Cargo query for nh_house | ||
Line 562: | Line 601: | ||
print = print .. "This item appears in the homes of " | print = print .. "This item appears in the homes of " | ||
for r = 1, #results do | for r = 1, #results do | ||
− | + | data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]" | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
+ | print = print .. formatList(data) | ||
if not isEmpty(frame.args['type']) and frame.args['type']:lower() == "wallpaper" then | if not isEmpty(frame.args['type']) and frame.args['type']:lower() == "wallpaper" then | ||
print = print .. ' as the default wallpaper.' | print = print .. ' as the default wallpaper.' | ||
elseif not isEmpty(frame.args['type']) and frame.args['type']:lower() == "flooring" then | elseif not isEmpty(frame.args['type']) and frame.args['type']:lower() == "flooring" then | ||
print = print .. ' as the default flooring.' | print = print .. ' as the default flooring.' | ||
− | |||
− | |||
− | |||
end | end | ||
else | else | ||
print = print .. "No villagers have this item in their home." | print = print .. "No villagers have this item in their home." | ||
end | end | ||
+ | if not isEmpty(frame.args['text']) then | ||
+ | print = print .. " " .. frame.args['text'] .. "." | ||
+ | end | ||
if not isEmpty(frame.args['prune-hhp']) then | if not isEmpty(frame.args['prune-hhp']) then | ||
print = print .. '' | print = print .. '' |
Latest revision as of 15:15, November 9, 2022
Module documentation (view)
Usage
This Lua module outputs the villager data info for item pages from Animal Crossing: New Horizons in regards to their furniture, clothing, umbrella, interior items, and order list in the Happy Home Paradise DLC. These are put through {{NHFurnitureVillagers}}, {{NHInteriorVillagers}}, {{NHClothingVillagers}}, {{NHUmbrellaVillagers}}, and {{HHPItemVillagers}}. Please refer to the documentation of each of these templates for more information.
local p = {}
local cargo = mw.ext.cargo
local formatList = require('Module:List').listFormat
function tableEmpty(s)
return next(s) == nil
end
function isEmpty(s)
return s == nil or s == ''
end
function p.HHPOutput( frame, typeItem )
local print = ''
local currency
-- Cargo query for hhp_villager (without facilities)
local tables1 = 'hhp_villager'
local fields1 = "hhp_villager.name=name,hhp_villager._pageTitle=pageName,hhp_villager.icon=icon"
local args1 = {
where = "hhp_villager.facility=0 AND (hhp_villager.unlocked_items LIKE '%\"" .. frame.args['1']:gsub("\'","\\'") .. "\"%' OR hhp_villager.item1 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\" OR hhp_villager.item2 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\" OR hhp_villager.item3 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\")",
orderBy = 'hhp_villager.name_sort',
groupBy = 'hhp_villager.name_sort',
limit = 500,
default = ''
}
local resultsHHP = cargo.query( tables1, fields1, args1 )
local data1 = {}
-- Cargo query for hhp_villager (only facilities)
local tables2 = 'hhp_villager'
local fields2 = "hhp_villager.name=name,hhp_villager._pageTitle=pageName"
local args2 = {
where = "hhp_villager.facility=1 AND hhp_villager.unlocked_items LIKE '%\"" .. frame.args['1']:gsub("\'","\\'") .. "\"%'",
orderBy = 'hhp_villager.name_sort',
groupBy = 'hhp_villager.name_sort',
limit = 500,
default = ''
}
local resultsHHP_Facility = cargo.query( tables2, fields2, args2 )
local data2 = {}
-- Cargo query for hhp_villager (required items)
local tables3 = 'hhp_villager'
local fields3 = "hhp_villager.name=name,hhp_villager._pageTitle=pageName,hhp_villager.icon=icon"
local args3 = {
where = "hhp_villager.facility=0 AND (hhp_villager.item1 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\" OR hhp_villager.item2 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\" OR hhp_villager.item3 = \"" .. frame.args['1']:gsub("\'","\\'") .. "\")",
orderBy = 'hhp_villager.name_sort',
groupBy = 'hhp_villager.name_sort',
limit = 500,
default = ''
}
local resultsHHP_Required = cargo.query( tables3, fields3, args3 )
local data3 = {}
-- Cargo query for hhp_villager (required item under category for facilities)
local tables4 = 'hhp_facility_category'
local fields4 = "hhp_facility_category.category=category,hhp_facility_category.room=room,hhp_facility_category._pageTitle=pageName,hhp_facility_category.facility=facility"
local args4 = {
where = "hhp_facility_category.items LIKE '%\"" .. frame.args['1']:gsub("\'","\\'") .. "\"%'",
orderBy = 'hhp_facility_category.facility,hhp_facility_category.room',
groupBy = 'hhp_facility_category._pageTitle',
limit = 500,
default = ''
}
local resultsHHP_Category = cargo.query( tables4, fields4, args4 )
local data4 = {}
local tables5
local fields5
local args5
local resultsHHP_Wardell
if typeItem == "furniture" then
-- Cargo query for nh_furniture (Wardell price)
tables5 = 'nh_furniture'
fields5 = "nh_furniture.buy2_price=price,nh_furniture.availability2=availability2,nh_furniture.buy2_currency=currency"
args5 = {
where = "nh_furniture._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"",
limit = 2000,
groupBy = 'nh_furniture._pageName',
default = '',
}
resultsHHP_Wardell = cargo.query( tables5, fields5, args5 )
elseif typeItem == "interior" then
-- Cargo query for nh_interior (Wardell price)
tables5 = 'nh_interior'
fields5 = "nh_interior.buy2_price=price,nh_interior.availability2=availability2,nh_interior.buy2_currency=currency"
args5 = {
where = "nh_interior._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"",
limit = 2000,
groupBy = 'nh_interior._pageName',
default = '',
}
resultsHHP_Wardell = cargo.query( tables5, fields5, args5 )
end
local data5 = {}
-- Cargo query for nh_clothing (equipable items)
local tables6 = 'nh_clothing'
local fields6 = "nh_clothing.vill_equip=equip"
local args6 = {
where = "nh_clothing._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"",
limit = 2000,
groupBy = 'nh_clothing._pageName',
default = '',
}
local resultsVill_Equip = cargo.query( tables6, fields6, args6 )
local data6 = {}
-- Cargo query for nh_clothing (handbags)
local tables7 = 'nh_clothing'
local fields7 = "nh_clothing.handbag=handbag"
local args7 = {
where = "nh_clothing._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"",
limit = 2000,
groupBy = 'nh_clothing._pageName',
default = '',
}
local resultsHandbags = cargo.query( tables7, fields7, args7 )
local data7 = {}
-- Cargo query for nh_recipe (Crafting)
local tables8 = 'nh_recipe'
local fields8 = "nh_recipe.en_name"
local args8 = {
where = "nh_recipe._pageName = \"Item:" .. frame.args['1']:gsub("\'","\\'") .. " (New Horizons)\"",
limit = 2000,
groupBy = 'nh_recipe._pageName',
default = '',
}
local resultsCrafting = cargo.query( tables8, fields8, args8 )
local data8 = {}
print = print .. "In " .. frame:preprocess('{{HHP|short}}')
if (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "starter") then
print = print .. ", this item is available from the start for use in [[designing]]"
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then
print = print .. " and changing the clothes of"
if not tableEmpty(resultsVill_Equip) and resultsVill_Equip[1].equip == "1" then
print = print .. " a villager or"
end
print = print .. " the player"
end
print = print .. "."
if not tableEmpty(resultsHHP) then
print = print .. ' '
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. " feature"
if #resultsHHP == 1 then
print = print .. "s"
end
print = print .. " this item in their order list when designing their vacation home."
end
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "sixhouses") then
print = print .. ", this item is available for use in [[designing]] after completing six vacation homes and the [[school]] facility."
if not tableEmpty(resultsHHP) then
print = print .. ' '
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. " feature"
if #resultsHHP == 1 then
print = print .. "s"
end
print = print .. " this item in their order list when designing their vacation home."
end
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "hybrid") then
print = print .. ", this item is unlocked for use in [[designing]] after listening to [[Leif]]'s lecture at the [[school]] regarding hybrid flowers."
if not tableEmpty(resultsHHP) then
print = print .. ' '
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. " feature"
if #resultsHHP == 1 then
print = print .. "s"
end
print = print .. " this item in their order list when designing their vacation home."
end
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "plant") then
print = print .. ", this item is unlocked for use in [[designing]] when doing the second villager's vacation house."
if not tableEmpty(resultsHHP) then
print = print .. ' '
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. " feature"
if #resultsHHP == 1 then
print = print .. "s"
end
print = print .. " this item in their order list when designing their vacation home."
end
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "partition") then
print = print .. ", this item is unlocked for use in [[designing]] when doing the eighth villager's vacation house."
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "party") then
print = print .. ", this item is unlocked for use in [[designing]] after attending the first party hosted by [[Lottie]] for designing ten houses."
if not tableEmpty(resultsHHP) then
print = print .. ' '
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. " feature"
if #resultsHHP == 1 then
print = print .. "s"
end
print = print .. " this item in their order list when designing their vacation home."
end
elseif (not isEmpty(frame.args['hhpstatus']) and frame.args['hhpstatus']:lower() == "niko") then
print = print .. ", this item is unlocked for use in [[designing]] after listening to [[Niko]]'s lecture at the [[school]] regarding wooden pillars and counters."
else
if not tableEmpty(resultsHHP) then
print = print .. ", this item is unlocked for use in [[designing]] when doing a vacation home request for "
for r = 1, #resultsHHP do
data1[r] = "[[File:" .. resultsHHP[r].icon .. "|25px|link=|alt=|" .. resultsHHP[r].name .. "]] [[" .. resultsHHP[r].pageName .. "|" .. resultsHHP[r].name .. "]]"
end
print = print .. formatList(data1) .. "."
end
end
if not tableEmpty(resultsHHP_Facility) then
if not tableEmpty(resultsHHP) then
if (not isEmpty(frame.args['hhpstatus'])) then
print = print .. " The item is also featured in the order list of "
else
print = print .. " The item can also be unlocked when tasked by Lottie to design "
end
for r = 1, #resultsHHP_Facility do
if r == #resultsHHP_Facility and r-1 ~= 0 then
print = print .. 'and '
end
print = print .. "the [[" .. resultsHHP_Facility[r].pageName .. "|" .. resultsHHP_Facility[r].name:lower() .. "]]"
if r == #resultsHHP_Facility then
print = print .. '.'
elseif r-1 == 0 and r+1 == #resultsHHP_Facility then
print = print .. ' '
else
print = print .. ', '
end
end
else
print = print .. ", this item is unlocked for use in [[designing]] when tasked by Lottie to design "
for r = 1, #resultsHHP_Facility do
if r == #resultsHHP_Facility and r-1 ~= 0 then
print = print .. 'and '
end
print = print .. "the [[" .. resultsHHP_Facility[r].pageName .. "|" .. resultsHHP_Facility[r].name:lower() .. "]]"
if r == #resultsHHP_Facility then
print = print .. '.'
elseif r-1 == 0 and r+1 == #resultsHHP_Facility then
print = print .. ' '
else
print = print .. ', '
end
end
end
end
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") and (not (tableEmpty(resultsHHP)) or not tableEmpty(resultsHHP_Facility)) then
print = print .. " In addition, the item can be used to change the clothing of"
if not tableEmpty(resultsVill_Equip) and resultsVill_Equip[1].equip == "1" then
print = print .. " a villager or"
end
print = print .. " the player either during or after the designing process for [[Photo (screenshot)|screenshot purposes]]."
end
if not isEmpty(frame.args['text-hhp']) then
print = print .. " " .. frame.args['text-hhp']
end
if not tableEmpty(resultsHHP_Required) then
if (not tableEmpty(resultsHHP)) or (not tableEmpty(resultsHHP_Facility)) then
print = print .. "\n\n"
print = print .. "In the designing process of ''Happy Home Paradise'', "
for r = 1, #resultsHHP_Required do
if r == #resultsHHP_Required and r-1 ~= 0 then
print = print .. 'and '
end
print = print .. "[[File:" .. resultsHHP_Required[r].icon .. "|25px|link=|alt=|" .. resultsHHP_Required[r].name .. "]] [[" .. resultsHHP_Required[r].pageName .. "|" .. resultsHHP_Required[r].name .. "]]"
if r == #resultsHHP_Required or (r-1 == 0 and r+1 == #resultsHHP_Required) then
print = print .. ' '
else
print = print .. ', '
end
end
print = print .. "require"
if #resultsHHP_Required == 1 then
print = print .. "s"
end
print = print .. " this item to be placed in or outside their vacation home."
end
end
if not tableEmpty(resultsHHP_Category) then
if (not tableEmpty(resultsHHP)) or (not tableEmpty(resultsHHP_Facility)) then
if not tableEmpty(resultsHHP_Required) then
print = print .. " This item is also required "
else
print = print .. '\n\n'
print = print .. "In the designing process of ''Happy Home Paradise'', this item is required "
end
for r = 1, #resultsHHP_Category do
if r == #resultsHHP_Category and r-1 ~= 0 then
print = print .. 'and '
end
print = print .. "as one of the " .. resultsHHP_Category[r].category:lower() .. " for the " .. resultsHHP_Category[r].room:lower() .. " at the [[" .. resultsHHP_Category[r].pageName .. "|" .. resultsHHP_Category[r].facility:lower() .. "]]"
if r == #resultsHHP_Category then
print = print .. '.'
elseif r-1 == 0 and r+1 == #resultsHHP_Category then
print = print .. ' '
else
print = print .. ', '
end
end
end
end
if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") and (not (tableEmpty(resultsHHP)) or not (tableEmpty(resultsHHP_Facility)) or not isEmpty(frame.args['hhpstatus'])) then
currency = require("Module:Currency")
print = print .. '\n\n'
print = print .. "After unlocking this item in ''Happy Home Paradise'', the item can be purchased from [[Wardell]]'s catalog"
if (resultsHHP_Wardell[1].availability2 == "Paradise Planning office" or resultsHHP_Wardell[1].availability2 == "Café") then
print = print .. ''
else
print = print .. " for " .. currency.outputCurrency("Poki", resultsHHP_Wardell[1].price,"","","","")
end
print = print .. "."
end
if (tableEmpty(resultsHHP)) and (tableEmpty(resultsHHP_Facility) and isEmpty(frame.args['hhpstatus'])) then
print = print .. ", no villagers or facility unlock this item for [[designing]]"
if not isEmpty(frame.args['clothing']) and not (not tableEmpty(resultsHandbags) and resultsHandbags[1].handbag == "1") then
print = print .. " and changing the clothing of"
if not tableEmpty(resultsVill_Equip) and resultsVill_Equip[1].equip == "1" then
print = print .. " a villager and"
end
print = print .. " the player"
end
if not tableEmpty(resultsCrafting) then
print = print .. ". It can only be used once the player's [[DIY]] catalog is unlocked after completing the 15th vacation home."
else
print = print .. ". It can only be used once the player's [[catalog]] is unlocked after completing the 27th vacation home."
end
if (typeItem == "furniture" or typeItem == "interior") and not tableEmpty(resultsHHP_Wardell) and (not isEmpty(resultsHHP_Wardell[1].price) and resultsHHP_Wardell[1].currency == "Poki") then
currency = require("Module:Currency")
print = print .. ''
print = print .. " Therefore, this item only appears in [[Wardell]]'s catalog"
if (resultsHHP_Wardell[1].availability2 == "Paradise Planning office" or resultsHHP_Wardell[1].availability2 == "Café") then
print = print .. ''
else
print = print .. " for " .. currency.outputCurrency("Poki", resultsHHP_Wardell[1].price)
end
print = print .. " after the player has catalogued this item."
end
if not tableEmpty(resultsHHP_Category) then
print = print .. "\n\nIn the designing process of ''Happy Home Paradise'' however, the item is required "
for r = 1, #resultsHHP_Category do
if r == #resultsHHP_Category and r-1 ~= 0 then
print = print .. 'and '
end
print = print .. "as one of the " .. resultsHHP_Category[r].category:lower() .. " for the " .. resultsHHP_Category[r].room:lower() .. " at the [[" .. resultsHHP_Category[r].pageName .. "|" .. resultsHHP_Category[r].facility:lower() .. "]]"
if r == #resultsHHP_Category then
print = print .. '.'
elseif r-1 == 0 and r+1 == #resultsHHP_Category then
print = print .. ' '
else
print = print .. ', '
end
end
end
end
return print
end
function p.furnitureOutput( frame )
local print = ''
local data = {}
-- Cargo query for nh_house
local tables = 'nh_house'
local fields = "nh_house.villager=villager,nh_house._pageTitle=pageName"
local args = {
where = "nh_house.items LIKE '%\"" .. frame.args['1']:gsub("\'","\\'") .. "\"%'",
orderBy = 'nh_house.name_sort',
limit = 300,
default = ''
}
local results = cargo.query( tables, fields, args )
if not tableEmpty(results) then
if not isEmpty(frame.args['disable-clothing']) then
print = print .. "However, this item "
else
print = print .. "This item "
end
if not isEmpty(frame.args['clothing']) and isEmpty(frame.args['disable-clothing']) then
print = print .. "also "
else
print = print .. " "
end
print = print .. "appears as a furniture item in the homes of "
for r = 1, #results do
data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]"
end
print = print .. formatList(data) .. "."
if not isEmpty(frame.args['not-purchasable']) then
print = print .. ''
else
print = print .. " As a result, this item has a chance to be purchasable by the player if they were invited by any of the preceding villagers."
end
else
print = print .. "No villagers have this item in their home."
end
if not isEmpty(frame.args['text']) then
print = print .. " " .. frame.args['text'] .. "."
end
if not isEmpty(frame.args['prune-hhp']) then
print = print .. ''
else
print = print .. '\n\n' .. p.HHPOutput(frame,"furniture")
end
return print
end
function p.clothingOutput( frame )
local print = ''
local data = {}
-- Cargo query for nh_villager
local tables = 'nh_villager'
local fields = "nh_villager.icon=icon,nh_villager.name=villager,nh_villager._pageTitle=pageName"
local args = {
where = "nh_villager.clothing = '" .. frame.args['1']:gsub("\'","\\'").. "'",
orderBy = 'nh_villager.name_sort',
limit = 300,
default = ''
}
local results = cargo.query( tables, fields, args )
if not tableEmpty(results) then
print = print .. "This item is worn by "
for r = 1, #results do
data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]"
end
print = print .. formatList(data) .. " as their default outfit."
else
print = print .. "No villagers wear this item as their default outfit."
end
if not isEmpty(frame.args['text']) then
print = print .. " " .. frame.args['text'] .. "."
end
if not isEmpty(frame.args['prune-hhp']) then
print = print .. ''
else
print = print .. '\n\n' .. p.HHPOutput(frame,"")
end
return print
end
function p.umbrellaOutput( frame )
local print = ''
-- Cargo query for nh_villager
local tables = 'nh_villager'
local fields = "nh_villager.icon=icon,nh_villager.name=villager,nh_villager._pageTitle=pageName"
local args = {
where = "nh_villager.umbrella = '" .. frame.args['1']:gsub("\'","\\'") .. "' AND species<>'Frog'",
orderBy = 'nh_villager.name_sort',
limit = 300,
default = ''
}
local results = cargo.query( tables, fields, args )
local data1 = {}
-- Cargo query for nh_villager (Frog villagers)
local tables2 = 'nh_villager'
local fields2 = "nh_villager.icon=icon,nh_villager.name=villager,nh_villager._pageTitle=pageName"
local args2 = {
where = "nh_villager.umbrella = '" .. frame.args['1']:gsub("\'","\\'") .. "' AND species='Frog'",
orderBy = 'nh_villager.name_sort',
limit = 300,
default = ''
}
local resultsFrog = cargo.query( tables2, fields2, args2 )
local data2 = {}
-- Cargo query for nh_special_character
local tables3 = 'nh_special_character'
local fields3 = "nh_special_character.icon=icon,nh_special_character.name=character,nh_special_character._pageTitle=pageName"
local args3 = {
where = "nh_special_character.umbrella = '" .. frame.args['1']:gsub("\'","\\'") .. "'",
orderBy = 'nh_special_character.name_sort',
limit = 300,
default = ''
}
local resultsSpecial = cargo.query( tables3, fields3, args3 )
local data3 = {}
-- Cargo query for nh_special_character (Happy Home Paradise)
local tables4 = 'nh_special_character'
local fields4 = "nh_special_character.icon=icon,nh_special_character.name=character,nh_special_character._pageTitle=pageName"
local args4 = {
where = "nh_special_character.umbrella_hhp = '" .. frame.args['1']:gsub("\'","\\'") .. "'",
orderBy = 'nh_special_character.name_sort',
limit = 300,
default = ''
}
local resultsSpecialHHP = cargo.query( tables4, fields4, args4 )
local data4 = {}
if not tableEmpty(results) then
print = print .. "This item is used by "
for r = 1, #results do
data1[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]"
end
print = print .. formatList(data1) .. " as their default umbrella during periods of [[weather|rain]]."
if not tableEmpty(resultsFrog) then
print = print .. " "
for r = 1, #resultsFrog do
data2[r] = "[[File:" .. resultsFrog[r].icon .. "|25px|link=|alt=|" .. resultsFrog[r].villager .. "]] [[" .. resultsFrog[r].pageName .. "|" .. resultsFrog[r].villager .. "]]"
end
print = print .. formatList(data2)
if #resultsFrog == 1 then
print = print .. " has "
else
print = print .. " have "
end
print = print .. "this item as their default umbrella, but will refrain from using the umbrella due to their status as a [[frog (species)|frog]] villager."
end
elseif tableEmpty(results) and not tableEmpty(resultsFrog) then
print = print .. "This item is featured by "
for r = 1, #resultsFrog do
data2[r] = "[[File:" .. resultsFrog[r].icon .. "|25px|link=|alt=|" .. resultsFrog[r].villager .. "]] [[" .. resultsFrog[r].pageName .. "|" .. resultsFrog[r].villager .. "]]"
end
print = print .. formatList(data2) .. " as their default umbrella during periods of [[weather|rain]], but they will refrain from using the umbrella due to their status as a [[frog (species)|frog]] villager."
else
print = print .. "No villagers use this item as their default umbrella during periods of [[weather|rain]]."
end
if not tableEmpty(resultsSpecial) then
if not tableEmpty(results) or not tableEmpty(resultsFrog) then
print = print .. " [[Special characters]] that also features this item as their default umbrella include "
else
print = print .. " However, [[special characters]] that features this item as their default umbrella include "
end
for r = 1, #resultsSpecial do
data3[r] = "[[File:" .. resultsSpecial[r].icon .. "|25px|link=|alt=|" .. resultsSpecial[r].character .. "]] [[" .. resultsSpecial[r].pageName .. "|" .. resultsSpecial[r].character .. "]]"
end
print = print .. formatList(data3)
if not tableEmpty(resultsSpecialHHP) then
print = print .. ", as well as "
for r = 1, #resultsSpecialHHP do
data4[r] = "[[File:" .. resultsSpecialHHP[r].icon .. "|25px|link=|alt=|" .. resultsSpecialHHP[r].character .. "]] [[" .. resultsSpecialHHP[r].pageName .. "|" .. resultsSpecialHHP[r].character .. "]]"
end
print = print .. formatList(data4)
if #resultsSpecialHHP == 1 then
print = print .. " who only uses this umbrella in the " .. frame:preprocess('{{HHP|short}}') .. " DLC."
else
print = print .. ", all of whom only use this umbrella in the " .. frame:preprocess('{{HHP|short}}') .. " DLC."
end
else
print = print .. "."
end
end
if tableEmpty(resultsSpecial) and not tableEmpty(resultsSpecialHHP) then
if not tableEmpty(results) or not tableEmpty(resultsFrog) then
print = print .. " [[Special characters]] that also features this item as their default umbrella in " .. frame:preprocess('{{HHP|short}}') .. " include "
else
print = print .. " However, [[special characters]] that features this item as their default umbrella in " .. frame:preprocess('{{HHP|short}}') .. " include "
end
for r = 1, #resultsSpecialHHP do
data4[r] = "[[File:" .. resultsSpecialHHP[r].icon .. "|25px|link=|alt=|" .. resultsSpecialHHP[r].character .. "]] [[" .. resultsSpecialHHP[r].pageName .. "|" .. resultsSpecialHHP[r].character .. "]]"
end
print = print .. formatList(data4) .. '.'
end
if not isEmpty(frame.args['text']) then
print = print .. " " .. frame.args['text'] .. "."
end
if not isEmpty(frame.args['prune-hhp']) then
print = print .. ''
else
print = print .. '\n\n' .. p.HHPOutput(frame,"")
end
return print
end
function p.interiorOutput( frame )
local print = ''
local data = {}
-- Cargo query for nh_house
local tables
local fields
local args
local results
if not isEmpty(frame.args['type']) and frame.args['type']:lower() == "wallpaper" then
tables = 'nh_house'
fields = "nh_house.villager=villager,nh_house._pageTitle=pageName"
args = {
where = "nh_house.wallpaper = '" .. frame.args['1']:gsub("\'","\\'") .. "'",
orderBy = 'nh_house.name_sort',
limit = 300,
default = ''
}
results = cargo.query( tables, fields, args )
elseif not isEmpty(frame.args['type']) and frame.args['type']:lower() == "flooring" then
tables = 'nh_house'
fields = "nh_house.villager=villager,nh_house._pageTitle=pageName"
args = {
where = "nh_house.flooring = '" .. frame.args['1']:gsub("\'","\\'") .. "'",
orderBy = 'nh_house.name_sort',
limit = 300,
default = ''
}
results = cargo.query( tables, fields, args )
else
results = {}
end
if not tableEmpty(results) then
print = print .. "This item appears in the homes of "
for r = 1, #results do
data[r] = "[[File:" .. results[r].villager .. " NH Villager Icon.png|25px|link=|alt=|" .. results[r].villager .. "]] [[" .. results[r].pageName .. "|" .. results[r].villager .. "]]"
end
print = print .. formatList(data)
if not isEmpty(frame.args['type']) and frame.args['type']:lower() == "wallpaper" then
print = print .. ' as the default wallpaper.'
elseif not isEmpty(frame.args['type']) and frame.args['type']:lower() == "flooring" then
print = print .. ' as the default flooring.'
end
else
print = print .. "No villagers have this item in their home."
end
if not isEmpty(frame.args['text']) then
print = print .. " " .. frame.args['text'] .. "."
end
if not isEmpty(frame.args['prune-hhp']) then
print = print .. ''
else
print = print .. '\n\n' .. p.HHPOutput(frame,"interior")
end
return print
end
return p