模块:Possible modifiers
跳到导航
跳到搜索
亦可参看英文模块:Module:Possible modifiers。那边可能有更完整或更正确的信息。
This module is used to compute a list of all modifiers that a given item can possibly acquire. It recreates the algorithm used in-game, based on the 电脑版 1.4.2.1.
It provides the functionality of the {{possible modifiers}} template.
local trim = mw.text.trim
local ceil = math.ceil
local iteminfo = require('Module:Iteminfo').getItemInfo
---A cached version of the current frame, the interface to the parser.
local currentFrame
---Return a rounded value, using an equivalent algorithm to the one used in-game.
---@param x number
---@return integer
local function round(x)
-- MidpointRounding.ToEven instead of MidpointRounding.AwayFromZero (see https://docs.microsoft.com/en-us/dotnet/api/system.math.round?view=net-5.0#System_Math_Round_System_Double_)
if (x+0.5) == ceil(x) then -- is midpoint
return (x-0.5) % 2 == 0 and x-0.5 or x+0.5 -- round down if lower number is even, round up if it is odd
else -- is not midpoint
return ceil(x-0.5) -- regular rounding
end
end
---Return a trimmed version of the value of the template parameter with the specified `key`.
---Return `nil` if the parameter is empty or unset.
---@param key string|number
---@return string|nil
local function getArg(key)
local value = currentFrame.args[key]
if not value then
return nil
end
value = trim(value)
if value == '' then
return nil
end
return value
end
---Return a table with the stat changes that the specified `prefix` causes; from `Terraria.Item.Prefix`, v1.4.3.
---@param prefix integer
---@return table
local function getPrefixEffects(prefix)
local prefixEffects = {
['prefixDamage'] = 1,
['prefixKnockBack'] = 1,
['prefixUseAnimation'] = 1,
['prefixScale'] = 1,
['prefixShootSpeed'] = 1,
['prefixMana'] = 1,
['prefixCrit'] = 0
}
if prefix == 1 then
prefixEffects.prefixScale = 1.12
elseif prefix == 2 then
prefixEffects.prefixScale = 1.18
elseif prefix == 3 then
prefixEffects.prefixDamage = 1.05
prefixEffects.prefixCrit = 2
prefixEffects.prefixScale = 1.05
elseif prefix == 4 then
prefixEffects.prefixDamage = 1.1
prefixEffects.prefixScale = 1.1
prefixEffects.prefixKnockBack = 1.1
elseif prefix == 5 then
prefixEffects.prefixDamage = 1.15
elseif prefix == 6 then
prefixEffects.prefixDamage = 1.1
elseif prefix == 81 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 5
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixScale = 1.1
elseif prefix == 7 then
prefixEffects.prefixScale = 0.82
elseif prefix == 8 then
prefixEffects.prefixKnockBack = 0.85
prefixEffects.prefixDamage = 0.85
prefixEffects.prefixScale = 0.87
elseif prefix == 9 then
prefixEffects.prefixScale = 0.9
elseif prefix == 10 then
prefixEffects.prefixDamage = 0.85
elseif prefix == 11 then
prefixEffects.prefixUseAnimation = 1.1
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixScale = 0.9
elseif prefix == 12 then
prefixEffects.prefixKnockBack = 1.1
prefixEffects.prefixDamage = 1.05
prefixEffects.prefixScale = 1.1
prefixEffects.prefixUseAnimation = 1.15
elseif prefix == 13 then
prefixEffects.prefixKnockBack = 0.8
prefixEffects.prefixDamage = 0.9
prefixEffects.prefixScale = 1.1
elseif prefix == 14 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixUseAnimation = 1.1
elseif prefix == 15 then
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixUseAnimation = 0.85
elseif prefix == 16 then
prefixEffects.prefixDamage = 1.1
prefixEffects.prefixCrit = 3
elseif prefix == 17 then
prefixEffects.prefixUseAnimation = 0.85
prefixEffects.prefixShootSpeed = 1.1
elseif prefix == 18 then
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixShootSpeed = 1.15
elseif prefix == 19 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixShootSpeed = 1.05
elseif prefix == 20 then
prefixEffects.prefixKnockBack = 1.05
prefixEffects.prefixShootSpeed = 1.05
prefixEffects.prefixDamage = 1.1
prefixEffects.prefixUseAnimation = 0.95
prefixEffects.prefixCrit = 2
elseif prefix == 21 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.1
elseif prefix == 82 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 5
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixShootSpeed = 1.1
elseif prefix == 22 then
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixShootSpeed = 0.9
prefixEffects.prefixDamage = 0.85
elseif prefix == 23 then
prefixEffects.prefixUseAnimation = 1.15
prefixEffects.prefixShootSpeed = 0.9
elseif prefix == 24 then
prefixEffects.prefixUseAnimation = 1.1
prefixEffects.prefixKnockBack = 0.8
elseif prefix == 25 then
prefixEffects.prefixUseAnimation = 1.1
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 1
elseif prefix == 58 then
prefixEffects.prefixUseAnimation = 0.85
prefixEffects.prefixDamage = 0.85
elseif prefix == 26 then
prefixEffects.prefixMana = 0.85
prefixEffects.prefixDamage = 1.1
elseif prefix == 27 then
prefixEffects.prefixMana = 0.85
elseif prefix == 28 then
prefixEffects.prefixMana = 0.85
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixKnockBack = 1.05
elseif prefix == 83 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 5
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixMana = 0.9
elseif prefix == 29 then
prefixEffects.prefixMana = 1.1
elseif prefix == 30 then
prefixEffects.prefixMana = 1.2
prefixEffects.prefixDamage = 0.9
elseif prefix == 31 then
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixDamage = 0.9
elseif prefix == 32 then
prefixEffects.prefixMana = 1.15
prefixEffects.prefixDamage = 1.1
elseif prefix == 33 then
prefixEffects.prefixMana = 1.1
prefixEffects.prefixKnockBack = 1.1
prefixEffects.prefixUseAnimation = 0.9
elseif prefix == 34 then
prefixEffects.prefixMana = 0.9
prefixEffects.prefixKnockBack = 1.1
prefixEffects.prefixUseAnimation = 1.1
prefixEffects.prefixDamage = 1.1
elseif prefix == 35 then
prefixEffects.prefixMana = 1.2
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixKnockBack = 1.15
elseif prefix == 52 then
prefixEffects.prefixMana = 0.9
prefixEffects.prefixDamage = 0.9
prefixEffects.prefixUseAnimation = 0.9
elseif prefix == 84 then
prefixEffects.prefixKnockBack = 1.17
prefixEffects.prefixDamage = 1.17
prefixEffects.prefixCrit = 8
elseif prefix == 36 then
prefixEffects.prefixCrit = 3
elseif prefix == 37 then
prefixEffects.prefixDamage = 1.1
prefixEffects.prefixCrit = 3
prefixEffects.prefixKnockBack = 1.1
elseif prefix == 38 then
prefixEffects.prefixKnockBack = 1.15
elseif prefix == 53 then
prefixEffects.prefixDamage = 1.1
elseif prefix == 54 then
prefixEffects.prefixKnockBack = 1.15
elseif prefix == 55 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.05
elseif prefix == 59 then
prefixEffects.prefixKnockBack = 1.15
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 5
elseif prefix == 60 then
prefixEffects.prefixDamage = 1.15
prefixEffects.prefixCrit = 5
elseif prefix == 61 then
prefixEffects.prefixCrit = 5
elseif prefix == 39 then
prefixEffects.prefixDamage = 0.7
prefixEffects.prefixKnockBack = 0.8
elseif prefix == 40 then
prefixEffects.prefixDamage = 0.85
elseif prefix == 56 then
prefixEffects.prefixKnockBack = 0.8
elseif prefix == 41 then
prefixEffects.prefixKnockBack = 0.85
prefixEffects.prefixDamage = 0.9
elseif prefix == 57 then
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixDamage = 1.18
elseif prefix == 42 then
prefixEffects.prefixUseAnimation = 0.9
elseif prefix == 43 then
prefixEffects.prefixDamage = 1.1
prefixEffects.prefixUseAnimation = 0.9
elseif prefix == 44 then
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixCrit = 3
elseif prefix == 45 then
prefixEffects.prefixUseAnimation = 0.95
elseif prefix == 46 then
prefixEffects.prefixCrit = 3
prefixEffects.prefixUseAnimation = 0.94
prefixEffects.prefixDamage = 1.07
elseif prefix == 47 then
prefixEffects.prefixUseAnimation = 1.15
elseif prefix == 48 then
prefixEffects.prefixUseAnimation = 1.2
elseif prefix == 49 then
prefixEffects.prefixUseAnimation = 1.08
elseif prefix == 50 then
prefixEffects.prefixDamage = 0.8
prefixEffects.prefixUseAnimation = 1.15
elseif prefix == 51 then
prefixEffects.prefixKnockBack = 0.9
prefixEffects.prefixUseAnimation = 0.9
prefixEffects.prefixDamage = 1.05
prefixEffects.prefixCrit = 2
end
return prefixEffects
end
---Return a list of possible modifier IDs for the specified `itemtype`; from `Terraria.Item.Prefix`, v1.4.2.1.
---@param itemtype integer
---@return table
local function getPossiblePrefixes(itemtype)
if (itemtype == 1 or itemtype == 4 or itemtype == 6 or itemtype == 7 or itemtype == 10 or itemtype == 24 or itemtype == 45 or itemtype == 46 or itemtype == 65 or itemtype == 103 or itemtype == 104 or itemtype == 121 or itemtype == 122 or itemtype == 155 or itemtype == 190 or itemtype == 196 or itemtype == 198 or itemtype == 199 or itemtype == 200 or itemtype == 201 or itemtype == 202 or itemtype == 203 or itemtype == 4258 or itemtype == 204 or itemtype == 213 or itemtype == 217 or itemtype == 273 or itemtype == 367 or itemtype == 368 or itemtype == 426 or itemtype == 482 or itemtype == 483 or itemtype == 484 or itemtype == 653 or itemtype == 654 or itemtype == 656 or itemtype == 657 or itemtype == 659 or itemtype == 660 or itemtype == 671 or itemtype == 672 or itemtype == 674 or itemtype == 675 or itemtype == 676 or itemtype == 723 or itemtype == 724 or itemtype == 757 or itemtype == 776 or itemtype == 777 or itemtype == 778 or itemtype == 787 or itemtype == 795 or itemtype == 797 or itemtype == 798 or itemtype == 799 or itemtype == 881 or itemtype == 882 or itemtype == 921 or itemtype == 922 or itemtype == 989 or itemtype == 990 or itemtype == 991 or itemtype == 992 or itemtype == 993 or itemtype == 1123 or itemtype == 1166 or itemtype == 1185 or itemtype == 1188 or itemtype == 1192 or itemtype == 1195 or itemtype == 1199 or itemtype == 1202 or itemtype == 1222 or itemtype == 1223 or itemtype == 1224 or itemtype == 1226 or itemtype == 1227 or itemtype == 1230 or itemtype == 1233 or itemtype == 1234 or itemtype == 1294 or itemtype == 1304 or itemtype == 1305 or itemtype == 1306 or itemtype == 1320 or itemtype == 1327 or itemtype == 1506 or itemtype == 1507 or itemtype == 1786 or itemtype == 1826 or itemtype == 1827 or itemtype == 1909 or itemtype == 1917 or itemtype == 1928 or itemtype == 2176 or itemtype == 2273 or itemtype == 2608 or itemtype == 2341 or itemtype == 2330 or itemtype == 2320 or itemtype == 2516 or itemtype == 2517 or itemtype == 2746 or itemtype == 2745 or itemtype == 3063 or itemtype == 3018 or itemtype == 3211 or itemtype == 3013 or itemtype == 3258 or itemtype == 3106 or itemtype == 3065 or itemtype == 2880 or itemtype == 3481 or itemtype == 3482 or itemtype == 3483 or itemtype == 3484 or itemtype == 3485 or itemtype == 3487 or itemtype == 3488 or itemtype == 3489 or itemtype == 3490 or itemtype == 3491 or itemtype == 3493 or itemtype == 3494 or itemtype == 3495 or itemtype == 3496 or itemtype == 3497 or itemtype == 3499 or itemtype == 3500 or itemtype == 3501 or itemtype == 3502 or itemtype == 3503 or itemtype == 3505 or itemtype == 3506 or itemtype == 3507 or itemtype == 3508 or itemtype == 3509 or itemtype == 3511 or itemtype == 3512 or itemtype == 3513 or itemtype == 3514 or itemtype == 3515 or itemtype == 3517 or itemtype == 3518 or itemtype == 3519 or itemtype == 3520 or itemtype == 3521 or itemtype == 3522 or itemtype == 3523 or itemtype == 3524 or itemtype == 3525 or itemtype == 3462 or itemtype == 3465 or itemtype == 3466 or itemtype == 2772 or itemtype == 2775 or itemtype == 2776 or itemtype == 2777 or itemtype == 2780 or itemtype == 2781 or itemtype == 2782 or itemtype == 2785 or itemtype == 2786 or itemtype == 3349 or itemtype == 3352 or itemtype == 3351 or (itemtype >= 3764 and itemtype <= 3769) or itemtype == 4259 or itemtype == 3772 or itemtype == 3823 or itemtype == 3827 or itemtype == 186 or itemtype == 946 or itemtype == 4059 or itemtype == 4317 or itemtype == 4463 or itemtype == 486 or itemtype == 4707 or itemtype == 4711 or itemtype == 4956 or itemtype == 4923 or itemtype == 4672 or itemtype == 4913 or itemtype == 4912 or itemtype == 4911 or itemtype == 4678 or itemtype == 4679 or itemtype == 4680 or itemtype == 4914 or itemtype == 5074 or itemtype == 5094 or itemtype == 5095 or itemtype == 5096 or itemtype == 5097) then
return {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 59, 60, 61, 81
}
elseif (itemtype == 162 or itemtype == 5011 or itemtype == 5012 or itemtype == 160 or itemtype == 163 or itemtype == 220 or itemtype == 274 or itemtype == 277 or itemtype == 280 or itemtype == 383 or itemtype == 384 or itemtype == 385 or itemtype == 386 or itemtype == 387 or itemtype == 388 or itemtype == 389 or itemtype == 390 or itemtype == 406 or itemtype == 537 or itemtype == 550 or itemtype == 579 or itemtype == 756 or itemtype == 759 or itemtype == 801 or itemtype == 802 or itemtype == 1186 or itemtype == 1189 or itemtype == 1190 or itemtype == 1193 or itemtype == 1196 or itemtype == 1197 or itemtype == 1200 or itemtype == 1203 or itemtype == 1204 or itemtype == 1228 or itemtype == 1231 or itemtype == 1232 or itemtype == 1259 or itemtype == 1262 or itemtype == 1297 or itemtype == 1314 or itemtype == 1325 or itemtype == 1947 or itemtype == 2332 or itemtype == 2331 or itemtype == 2342 or itemtype == 2424 or itemtype == 2611 or itemtype == 2798 or itemtype == 3012 or itemtype == 3473 or itemtype == 3098 or itemtype == 3368 or itemtype == 3835 or itemtype == 3836 or itemtype == 3858 or itemtype == 4061 or itemtype == 4144 or itemtype == 4272 or itemtype == 2774 or itemtype == 2773 or itemtype == 2779 or itemtype == 2778 or itemtype == 2784 or itemtype == 2783 or itemtype == 3464 or itemtype == 3463 or itemtype == 4788 or itemtype == 4789 or itemtype == 4790) then
return {
36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 59, 60, 61
}
elseif (itemtype == 39 or itemtype == 44 or itemtype == 95 or itemtype == 96 or itemtype == 98 or itemtype == 99 or itemtype == 120 or itemtype == 164 or itemtype == 197 or itemtype == 219 or itemtype == 266 or itemtype == 281 or itemtype == 434 or itemtype == 435 or itemtype == 436 or itemtype == 481 or itemtype == 506 or itemtype == 533 or itemtype == 534 or itemtype == 578 or itemtype == 655 or itemtype == 658 or itemtype == 661 or itemtype == 679 or itemtype == 682 or itemtype == 725 or itemtype == 758 or itemtype == 759 or itemtype == 760 or itemtype == 796 or itemtype == 800 or itemtype == 905 or itemtype == 923 or itemtype == 964 or itemtype == 986 or itemtype == 1156 or itemtype == 1187 or itemtype == 1194 or itemtype == 1201 or itemtype == 1229 or itemtype == 1254 or itemtype == 1255 or itemtype == 1258 or itemtype == 1265 or itemtype == 1319 or itemtype == 1553 or itemtype == 1782 or itemtype == 1784 or itemtype == 1835 or itemtype == 1870 or itemtype == 1910 or itemtype == 1929 or itemtype == 1946 or itemtype == 2223 or itemtype == 2269 or itemtype == 2270 or itemtype == 2624 or itemtype == 2515 or itemtype == 2747 or itemtype == 2796 or itemtype == 2797 or itemtype == 3052 or itemtype == 2888 or itemtype == 3019 or itemtype == 3029 or itemtype == 3007 or itemtype == 3008 or itemtype == 3210 or itemtype == 3107 or itemtype == 3475 or itemtype == 3540 or itemtype == 3854 or itemtype == 3859 or itemtype == 3821 or itemtype == 3930 or itemtype == 3480 or itemtype == 3486 or itemtype == 3492 or itemtype == 3498 or itemtype == 3504 or itemtype == 3510 or itemtype == 3516 or itemtype == 3350 or itemtype == 3546 or itemtype == 3788 or itemtype == 4058 or itemtype == 4060 or itemtype == 4381 or itemtype == 4703 or itemtype == 4953 or itemtype == 5117) then
return {
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 58, 36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 42, 44, 45, 46, 47, 48, 49, 50, 51, 59, 60, 61, 82
}
elseif (itemtype == 64 or itemtype == 112 or itemtype == 113 or itemtype == 127 or itemtype == 157 or itemtype == 165 or itemtype == 218 or itemtype == 272 or itemtype == 494 or itemtype == 495 or itemtype == 496 or itemtype == 514 or itemtype == 517 or itemtype == 518 or itemtype == 519 or itemtype == 683 or itemtype == 726 or itemtype == 739 or itemtype == 740 or itemtype == 741 or itemtype == 742 or itemtype == 743 or itemtype == 744 or itemtype == 788 or itemtype == 1121 or itemtype == 1155 or itemtype == 1157 or itemtype == 1178 or itemtype == 1244 or itemtype == 1256 or itemtype == 1260 or itemtype == 1264 or itemtype == 1266 or itemtype == 1295 or itemtype == 1296 or itemtype == 1308 or itemtype == 1309 or itemtype == 1313 or itemtype == 1336 or itemtype == 1444 or itemtype == 1445 or itemtype == 1446 or itemtype == 1572 or itemtype == 1801 or itemtype == 1802 or itemtype == 1930 or itemtype == 1931 or itemtype == 2188 or itemtype == 2622 or itemtype == 2621 or itemtype == 2584 or itemtype == 2551 or itemtype == 2366 or itemtype == 2535 or itemtype == 2365 or itemtype == 2364 or itemtype == 2623 or itemtype == 2750 or itemtype == 2795 or itemtype == 3053 or itemtype == 3051 or itemtype == 3209 or itemtype == 3014 or itemtype == 3105 or itemtype == 2882 or itemtype == 3269 or itemtype == 3006 or itemtype == 3377 or itemtype == 3069 or itemtype == 2749 or itemtype == 3249 or itemtype == 3476 or itemtype == 3474 or itemtype == 3531 or itemtype == 3541 or itemtype == 3542 or itemtype == 3569 or itemtype == 3570 or itemtype == 3571 or itemtype == 3779 or itemtype == 3787 or itemtype == 3531 or itemtype == 3852 or itemtype == 3870 or itemtype == 4269 or itemtype == 4273 or itemtype == 4281 or itemtype == 4347 or itemtype == 4348 or itemtype == 4270 or itemtype == 4758 or itemtype == 4715 or itemtype == 4952 or itemtype == 4607 or itemtype == 5005 or itemtype == 5065 or itemtype == 5069 or itemtype == 5114 or itemtype == 5119 or itemtype == 5118 or itemtype == 3824 or itemtype == 3818 or itemtype == 3829 or itemtype == 3832 or itemtype == 3825 or itemtype == 3819 or itemtype == 3830 or itemtype == 3833 or itemtype == 3826 or itemtype == 3820 or itemtype == 3831 or itemtype == 3834 or itemtype == 4062) then
return {
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 52, 36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 59, 60, 61, 83,
}
elseif (itemtype == 55 or itemtype == 119 or itemtype == 191 or itemtype == 284 or itemtype == 670 or itemtype == 1122 or itemtype == 1513 or itemtype == 1569 or itemtype == 1571 or itemtype == 1825 or itemtype == 1918 or itemtype == 3054 or itemtype == 3262 or (itemtype >= 3278 and itemtype <= 3292) or (itemtype >= 3315 and itemtype <= 3317) or itemtype == 3389 or itemtype == 3030 or itemtype == 3543 or itemtype == 4764 or itemtype == 4818 or itemtype == 4760) then
if (itemtype == 3389) then
return {
36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 59, 60, 61, 84
}
end
return {
36, 37, 38, 53, 54, 55, 39, 40, 56, 41, 57, 59, 60, 61
}
end
return {}
end
---Return a table of modifier IDs that does not include those modifiers from `possiblePrefixes` that would have no effect on the specified `itemtype`; from `Terraria.Item.Prefix`, v1.4.2.1.
---@param possiblePrefixes table
---@param itemstats table
---@return table
local function normalizePossiblePrefixes(possiblePrefixes, itemstats)
local possiblePrefixesNormalized = {}
for _, prefix in ipairs(possiblePrefixes) do
local prefixEffects = getPrefixEffects(prefix)
local isValidPrefix = true
if (prefixEffects.prefixDamage ~= 1 and round(itemstats.damage * prefixEffects.prefixDamage) == itemstats.damage) then
isValidPrefix = false
end
if (prefixEffects.prefixUseAnimation ~= 1 and round(itemstats.useAnimation * prefixEffects.prefixUseAnimation) == itemstats.useAnimation) then
isValidPrefix = false
end
if (prefixEffects.prefixMana ~= 1 and round(itemstats.mana * prefixEffects.prefixMana) == itemstats.mana) then
isValidPrefix = false
end
if (prefixEffects.prefixKnockBack ~= 1 and itemstats.knockBack == 0) then
isValidPrefix = false
end
if isValidPrefix then
table.insert(possiblePrefixesNormalized, prefix)
end
end
return possiblePrefixesNormalized
end
-----------------------------------------------------------------
-- main return object
return {
-- for template, returns a string with a comma-separated list of modifiers
go = function(frame)
currentFrame = frame
local itemtype = tonumber(getArg(1))
local itemstats = iteminfo(itemtype)
local possiblePrefixes = getPossiblePrefixes(itemtype)
local possiblePrefixesNormalized = normalizePossiblePrefixes(possiblePrefixes, itemstats)
return table.concat(possiblePrefixesNormalized, ', ')
end,
-- for module, returns a table with modifiers
getPossibleModifiers = function(itemtype)
local itemtype = tonumber(itemtype)
local itemstats = iteminfo(itemtype)
local possiblePrefixes = getPossiblePrefixes(itemtype)
local possiblePrefixesNormalized = normalizePossiblePrefixes(possiblePrefixes, itemstats)
return possiblePrefixesNormalized
end,
}