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 8: | Line 8: | ||
AbilityLifestealPercentHero = true, | AbilityLifestealPercentHero = true, | ||
AbilityLifestealPercentHeroPassive = true, | AbilityLifestealPercentHeroPassive = true, | ||
ActiveReloadPercent = true, | ActiveReloadPercent = true, | ||
AirControlPercent = true, | AirControlPercent = true, | ||
AirMoveIncreasePercent = true, | AirMoveIncreasePercent = true, | ||
| Line 25: | Line 20: | ||
BonusAbilityDurationPercent = true, | BonusAbilityDurationPercent = true, | ||
BonusAttackRangePercent = true, | BonusAttackRangePercent = true, | ||
BonusBulletSpeedPercent = true, | BonusBulletSpeedPercent = true, | ||
BonusClipSizePercent = true, | BonusClipSizePercent = true, | ||
| Line 34: | Line 28: | ||
BonusSoulsPct = true, | BonusSoulsPct = true, | ||
BonusZoomPercent = true, | BonusZoomPercent = true, | ||
BuffMeleeDamageBoost = true, | BuffMeleeDamageBoost = true, | ||
BulletArmorReduction = true, | BulletArmorReduction = true, | ||
BulletDamageReflectedPct = true, | BulletDamageReflectedPct = true, | ||
| Line 42: | Line 34: | ||
BulletProcDeflectionPercent = true, | BulletProcDeflectionPercent = true, | ||
BulletResist = true, | BulletResist = true, | ||
BulletResistPerStack = true, | BulletResistPerStack = true, | ||
BulletResistReduction = true, | BulletResistReduction = true, | ||
CooldownBetweenChargeReduction = true, | CooldownBetweenChargeReduction = true, | ||
CooldownReduction = true, | CooldownReduction = true, | ||
CooldownReductionPctOnNonHeroes = true, | CooldownReductionPctOnNonHeroes = true, | ||
CritDamagePercent = true, | CritDamagePercent = true, | ||
| Line 62: | Line 50: | ||
FireRateBonus = true, | FireRateBonus = true, | ||
FireRateSlow = true, | FireRateSlow = true, | ||
GroundDashReductionPercent = true, | GroundDashReductionPercent = true, | ||
HealAmpCastPercent = true, | HealAmpCastPercent = true, | ||
| Line 72: | Line 58: | ||
HealPercentAmount = true, | HealPercentAmount = true, | ||
HealPercentPerHeadshot = true, | HealPercentPerHeadshot = true, | ||
ItemCooldownReduction = true, | ItemCooldownReduction = true, | ||
LifestealHealPercent = true, | LifestealHealPercent = true, | ||
LongRangeBonusWeaponPower = true, | LongRangeBonusWeaponPower = true, | ||
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 84: | ||
ReduceFootstepSound = true, | ReduceFootstepSound = true, | ||
ReloadSpeedMultipler = true, | ReloadSpeedMultipler = true, | ||
RicochetDamagePercent = true, | RicochetDamagePercent = true, | ||
SelfModifier = true, | SelfModifier = true, | ||
| Line 131: | Line 108: | ||
WeaponPowerPerStack = true, | WeaponPowerPerStack = true, | ||
} | } | ||
---------------------------------------- Utility functions | ---------------------------------------- Utility functions | ||
| Line 284: | Line 243: | ||
--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 258: | ||
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 280: | ||
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 286: | ||
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 296: | ||
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 306: | ||
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 314: | ||
-- {{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 348: | ||
end | end | ||
return p | return p | ||