|
|
| Line 47: |
Line 47: |
| end | | end |
| --endregion | | --endregion |
|
| |
|
| |
| function TestModule.getNameByTitle(frame)
| |
| return getPropertyByTitle(frame, "Name")
| |
| end
| |
|
| |
| function TestModule.getPathIDByTitle(frame)
| |
| return getPropertyByTitle(frame, "PathID")
| |
| end
| |
|
| |
| function TestModule.getShortNameByTitle(frame)
| |
| return getPropertyByTitle(frame, "ShortName")
| |
| end
| |
|
| |
| function TestModule.getDescriptionByTitle(frame)
| |
| return getPropertyByTitle(frame, "Description")
| |
| end
| |
|
| |
|
| function TestModule.getIconByTitle(frame) | | function TestModule.getIconByTitle(frame) |
| return getPropertyByTitle(frame, "Icon") | | return getPropertyByTitle(frame, "Icon") |
| end | | end |
| | |
| function TestModule.getTagsByTitle(frame)
| |
| return getPropertyByTitle(frame, "Tags")
| |
| end
| |
| | |
| function TestModule.getRarityByTitle(frame)
| |
| return getPropertyByTitle(frame, "Rarity")
| |
| end
| |
| | |
| function TestModule.getMinCampaignProgressByTitle(frame)
| |
| return getPropertyByTitle(frame, "MinCampaignProgress")
| |
| end
| |
| | |
| function TestModule.getTradeValueByTitle(frame)
| |
| return getPropertyByTitle(frame, "TradeValue")
| |
| end
| |
| | |
| function TestModule.getDeployCostsByTitle(frame)
| |
| return getPropertyByTitle(frame, "DeployCosts")
| |
| end
| |
| | |
| function TestModule.getMinRangeByTitle(frame)
| |
| return getPropertyByTitle(frame, "MinRange")
| |
| end
| |
| | |
| function TestModule.getIdealRangeByTitle(frame)
| |
| return getPropertyByTitle(frame, "IdealRange")
| |
| end
| |
| | |
| function TestModule.getMaxRangeByTitle(frame)
| |
| return getPropertyByTitle(frame, "MaxRange")
| |
| end
| |
| | |
| function TestModule.getAccuracyBonusByTitle(frame)
| |
| return getPropertyByTitle(frame, "AccuracyBonus")
| |
| end
| |
| | |
| function TestModule.getAccuracyDropoffByTitle(frame)
| |
| return getPropertyByTitle(frame, "AccuracyDropoff")
| |
| end
| |
| | |
| function TestModule.getDamageByTitle(frame)
| |
| return getPropertyByTitle(frame, "Damage")
| |
| end
| |
| | |
| function TestModule.getDamageDropoffByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamageDropoff")
| |
| end
| |
| | |
| function TestModule.getDamagePctCurrentHitpointsByTitle(frame)
| |
| return getPropertyByTitle(frame, "Description")
| |
| end
| |
| | |
| function TestModule.getDamagePctCurrentHitpointsMinByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamagePctCurrentHitpointsMin")
| |
| end
| |
| | |
| function TestModule.getDamagePctMaxHitpointsByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamagePctMaxHitpoints")
| |
| end
| |
| | |
| function TestModule.getDamagePctMaxHitpointsMinByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamagePctMaxHitpointsMin")
| |
| end
| |
| | |
| function TestModule.getArmorPenetrationByTitle(frame)
| |
| return getPropertyByTitle(frame, "ArmorPenetration")
| |
| end
| |
| | |
| function TestModule.getArmorPenetrationDropoffByTitle(frame)
| |
| return getPropertyByTitle(frame, "ArmorPenetrationDropoff")
| |
| end
| |
| | |
| function TestModule.getDamageToArmorDurabilityByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamageToArmorDurability")
| |
| end
| |
| | |
| function TestModule.getDamageToArmorDurabilityMultByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamageToArmorDurabilityMult")
| |
| end
| |
| | |
| function TestModule.getDamageToArmorDurabilityDropoffByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamageToArmorDurabilityDropoff")
| |
| end
| |
| | |
| function TestModule.getDamageToArmorDurabilityDropoffMultByTitle(frame)
| |
| return getPropertyByTitle(frame, "DamageToArmorDurabilityDropoffMult")
| |
| end
| |
| | |
| function TestModule.getSuppressionByTitle(frame)
| |
| return getPropertyByTitle(frame, "Description")
| |
| end
| |
| | |
| function TestModule.getBlackMarketMaxQuantityByTitle(frame)
| |
| return getPropertyByTitle(frame, "BlackMarketMaxQuantity")
| |
| end
| |
| | |
|
| |
|
| return TestModule | | return TestModule |
Documentation for this module may be created at Module:TestModule/doc
---
--- Extracts attributes of Weapons from Module:Data/Weapons.json
---
---@module TestModule
local TestModule = {}
--region Dependencies
local JsonUtils = require("Module:JsonUtils")
--endregion
--region Private constants
local DATA_FILE = "Module:Data/Weapons.json"
--endregion
--region Private member variables
local TestModule
--endregion
--region Private methods
local function loadData()
if not TestModule then
TestModule = JsonUtils.convertJSONToLuaTable(DATA_FILE)
end
end
local function getTitleFromArgs(frame)
if frame.args then
return frame.args[3] or frame.args.title
else
return frame
end
end
local function getPropertyByTitle(frame, property)
loadData()
local weaponTitle = getTitleFromArgs(frame)
for _, weapon in ipairs(TestModule) do
if string.lower(weapon.Title) == string.lower(weaponTitle) then
return weapon[property]
end
end
end
--endregion
function TestModule.getIconByTitle(frame)
return getPropertyByTitle(frame, "Icon")
end
return TestModule