Module:HeroData: Difference between revisionsGive feedback
Consolidate stat/scaling lookups into shared helpers, add resolve_key and has_tags, drop unused dependencies and dead code (with help from vergir-bot LLM) |
m replace Ls => PI in the comments to match code |
||
| (One intermediate revision by the same user not shown) | |||
| Line 303: | Line 303: | ||
end | end | ||
--If the hero scales with the stat, it returns {{Ss|value}} or {{ | --If the hero scales with the stat, it returns {{Ss|value}} or {{PI|value}}, else blank string | ||
--{{#invoke:HeroData|get_hero_scalar|HERO_NAME|SCALING_TYPE|STAT_NAME|sig_figs_or_localize}}-- | --{{#invoke:HeroData|get_hero_scalar|HERO_NAME|SCALING_TYPE|STAT_NAME|sig_figs_or_localize}}-- | ||
p.get_hero_scalar = function(frame) | p.get_hero_scalar = function(frame) | ||
| Line 379: | Line 379: | ||
-- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | -- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | ||
-- Scaling string meaning the expanded template {{Ss|scalar}} or {{ | -- Scaling string meaning the expanded template {{Ss|scalar}} or {{PI|scalar}} | ||
function p.write_scalar_str(scaling_value, scaling_type, compact) | function p.write_scalar_str(scaling_value, scaling_type, compact) | ||
local scaling_abbrevs = {Spirit = "Ss", Level = "PI"} | local scaling_abbrevs = {Spirit = "Ss", Level = "PI"} | ||
| Line 399: | Line 399: | ||
local template_call = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } | local template_call = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } | ||
local result = template_call:gsub("\n", ""):gsub("\r", "") | |||
return | return result | ||
end | end | ||