Editing Module:ItemDataGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 10: | Line 10: | ||
ActivatedFireRate = true, | ActivatedFireRate = true, | ||
ActiveBonusFireRate = true, | ActiveBonusFireRate = true, | ||
ActiveReloadPercent = true, | ActiveReloadPercent = true, | ||
AirControlPercent = true, | AirControlPercent = true, | ||
AirMoveIncreasePercent = true, | AirMoveIncreasePercent = true, | ||
| Line 25: | Line 22: | ||
BonusAbilityDurationPercent = true, | BonusAbilityDurationPercent = true, | ||
BonusAttackRangePercent = true, | BonusAttackRangePercent = true, | ||
BonusBulletSpeedPercent = true, | BonusBulletSpeedPercent = true, | ||
BonusClipSizePercent = true, | BonusClipSizePercent = true, | ||
| Line 34: | Line 30: | ||
BonusSoulsPct = true, | BonusSoulsPct = true, | ||
BonusZoomPercent = true, | BonusZoomPercent = true, | ||
BuffMeleeDamageBoost = true, | BuffMeleeDamageBoost = true, | ||
BulletArmorReduction = true, | BulletArmorReduction = true, | ||
BulletDamageReflectedPct = true, | BulletDamageReflectedPct = true, | ||
| Line 42: | Line 36: | ||
BulletProcDeflectionPercent = true, | BulletProcDeflectionPercent = true, | ||
BulletResist = true, | BulletResist = true, | ||
BulletResistPerStack = true, | BulletResistPerStack = true, | ||
BulletResistReduction = true, | BulletResistReduction = true, | ||
| Line 49: | Line 42: | ||
CooldownReduction = true, | CooldownReduction = true, | ||
CooldownReductionOnChargedAbilities = true, | CooldownReductionOnChargedAbilities = true, | ||
CooldownReductionPctOnNonHeroes = true, | CooldownReductionPctOnNonHeroes = true, | ||
CritDamagePercent = true, | CritDamagePercent = true, | ||
| Line 62: | Line 54: | ||
FireRateBonus = true, | FireRateBonus = true, | ||
FireRateSlow = true, | FireRateSlow = true, | ||
GroundDashReductionPercent = true, | GroundDashReductionPercent = true, | ||
HealAmpCastPercent = true, | HealAmpCastPercent = true, | ||
| Line 74: | Line 64: | ||
HealthPctDamage = true, | HealthPctDamage = true, | ||
ItemCooldownReduction = true, | ItemCooldownReduction = true, | ||
LifestealHealPercent = true, | LifestealHealPercent = true, | ||
LightMeleeAmmo = true, | LightMeleeAmmo = true, | ||
| Line 81: | Line 69: | ||
MagicIncreasePerStack = true, | MagicIncreasePerStack = true, | ||
MagicResistReduction = true, | MagicResistReduction = true, | ||
MaxHealthDamage = true, | MaxHealthDamage = true, | ||
MaxHealthLossPercent = true, | MaxHealthLossPercent = true, | ||
MaxHealthPercentAsDPS = true, | MaxHealthPercentAsDPS = true, | ||
MaxSlowPercent = true, | MaxSlowPercent = true, | ||
MeleeDistanceScale = true, | MeleeDistanceScale = true, | ||
MeleeResistPercent = true, | MeleeResistPercent = true, | ||
MoveWhileShootingSpeedPenaltyReductionPercent = true, | MoveWhileShootingSpeedPenaltyReductionPercent = true, | ||
MoveWhileZoomedSpeedPenaltyReductionPercent = true, | MoveWhileZoomedSpeedPenaltyReductionPercent = true, | ||
| Line 105: | Line 90: | ||
ReduceFootstepSound = true, | ReduceFootstepSound = true, | ||
ReloadSpeedMultipler = true, | ReloadSpeedMultipler = true, | ||
RicochetDamagePercent = true, | RicochetDamagePercent = true, | ||
SelfModifier = true, | SelfModifier = true, | ||
| Line 131: | Line 114: | ||
WeaponPowerPerStack = true, | WeaponPowerPerStack = true, | ||
} | } | ||
---------------------------------------- Utility functions | ---------------------------------------- Utility functions | ||
| Line 284: | Line 249: | ||
--check Data:ItemData.json for properties | --check Data:ItemData.json for properties | ||
p.get_prop = function(frame) | p.get_prop = function(frame) | ||
local item_name = frame.args[1] | |||
local property = frame.args[2] | |||
local item = get_json_item(item_name) | |||
if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end | |||
local prop_value = item[property] | |||
if (prop_value == nil) then return nil end | |||
local display_value | local display_value | ||
| Line 304: | Line 264: | ||
if prop_value["Value"] ~= nil and prop_value["Scale"] ~= nil and prop_value["Scale"]["Value"] ~= nil and prop_value["Scale"]["Type"] ~= nil then | if prop_value["Value"] ~= nil and prop_value["Scale"] ~= nil and prop_value["Scale"]["Value"] ~= nil and prop_value["Scale"]["Type"] ~= nil then | ||
-- This is a structured attribute with scaling data | -- This is a structured attribute with scaling data | ||
display_value = | display_value = tostring(prop_value["Value"]) | ||
local scale_val = tonumber(prop_value["Scale"]["Value"]) | |||
if scale_val ~= 0 then | |||
local scale_type = prop_value["Scale"]["Type"] | |||
local rounded_scale_val = util_module.round_to_sig_fig(scale_val, 2) | |||
local template_title | |||
if scale_type == "power_increase" then | |||
template_title = "Template:Boon" | |||
else | |||
template_title = "Template:Ss" | |||
end | end | ||
local template_args = { [1] = rounded_scale_val } | |||
-- Add a space before the scaling template for proper separation | |||
scaling_str = " " .. mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } | |||
end | end | ||
else | else | ||
| Line 327: | Line 286: | ||
local tableValues = {} | local tableValues = {} | ||
for _, v in pairs(prop_value) do | for _, v in pairs(prop_value) do | ||
table.insert(tableValues, | table.insert(tableValues, tostring(v)) | ||
end | end | ||
return table.concat(tableValues, ", ") | return table.concat(tableValues, ", ") | ||
| Line 333: | Line 292: | ||
else | else | ||
-- This is a simple, non-table property | -- This is a simple, non-table property | ||
display_value = | display_value = tostring(prop_value) | ||
end | end | ||
-- Assemble the final string, adding the '%' sign if necessary | -- Assemble the final string, adding the '%' sign if necessary | ||
if percentage_properties[property] == true then | if percentage_properties[property] == true then | ||
| Line 347: | Line 302: | ||
end | end | ||
end | end | ||
p.get_component_name = function(frame) | p.get_component_name = function(frame) | ||
local item_name = frame.args[1] | local item_name = frame.args[1] | ||
local item = get_json_item(item_name) | local item = get_json_item(item_name) | ||
if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end | if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end | ||
| Line 360: | Line 312: | ||
if(components == nil) then return nil end | if(components == nil) then return nil end | ||
local component_key = components[1] | |||
local component_key = components[ | |||
local component = data[component_key] | local component = data[component_key] | ||
if (component == nil | if (component == nil) then return nil end | ||
return component['Name'] | return component['Name'] | ||
| Line 372: | Line 320: | ||
-- {{Items count}} access point | -- {{Items count}} access point | ||
function p.get_headcount( | function p.get_headcount() | ||
local iter = 0 | local iter = 0 | ||
local tbl = get_similar_items("IsDisabled") | local tbl = get_similar_items("IsDisabled") | ||
for _, v in ipairs(tbl) do | for _, v in ipairs(tbl) do | ||
if (v["IsDisabled"] == false and v["Name"] ~= nil) then | |||
iter = iter + 1 | iter = iter + 1 | ||
end | |||
end | end | ||
return iter | return iter | ||
| Line 416: | Line 354: | ||
end | end | ||
return p | return p | ||