Home
Random
Log in
Settings
About the Deadlock Wiki
Search
Editing
Module:GenericData
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local generics_data = mw.loadJsonData("Data:GenericData.json") local p = {} function p.get_objective_param(frame) local key = frame.args[1] if key == nil then return "'key' parameter must be provided" end local objective_params = generics_data['ObjectiveParams'] local objective_param = objective_params[key] if objective_param == nil then return "'key':" .. key .. " is not in ObjectiveParams" end return objective_param end function p.get_rejuv_param(frame) local key = frame.args[1] local midboss_deaths = frame.args[2] if key == nil then return "'key' parameter must be provided" end if midboss_deaths ~= nil and tonumber(midboss_deaths) == nil then return "'midboss_deaths' parameter must be an integer" end -- Access the key local rejuv_params = generics_data['RejuvParams'] local rejuv_param = rejuv_params[key] -- Ensure the key is in the data if rejuv_param == nil then return "'key':" .. key .. " is not in RejuvParams" end -- If its a non-container, return it if (type(rejuv_param) == 'number' or type(rejuv_param) == 'string' or type(rejuv_param) == 'boolean') then return rejuv_param end -- Ensure an midboss_deaths is provided if midboss_deaths == nil then return "'key':" .. key .. "'s value is an array, so the 'midboss_deaths' parameter must be provided" end midboss_deaths = tonumber(midboss_deaths) -- Retrieve the midboss_deaths'th element for i, elem in ipairs(rejuv_param) do if i == midboss_deaths then return elem end end return "'key':" .. key .. "'s array value did not contain " .. midboss_deaths .. " elements" end function p.get_tiered_item_price(frame) local tier = frame.args[1] if tier == nil then return "'tier' parameter must be provided" end tier = tonumber(tier) -- Retrieve the tier'th element for i, elem in ipairs(p.get_item_price_per_tier()) do if i == tier then return elem end end return "ItemPricePerTier does not have " .. tier .. " tiers" end --for Module:ItemData/nav function p.get_item_price_per_tier() return generics_data['ItemPricePerTier'] end return p
Summary:
Please note that all contributions to Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Deadlock:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Data:GenericData.json
(
edit
)
Module:GenericData
(
edit
)
Module:GenericData/doc
(
edit
)