From a6e114a39e918bdff8b1c0af5c87402d2e0d37fd Mon Sep 17 00:00:00 2001 From: "H. C. Kruse" Date: Tue, 2 Apr 2024 18:01:24 +0200 Subject: [PATCH] refactor(CharArmor): Format resistance Still open :/ https://github.com/SemanticMediaWiki/SemanticScribunto/issues/92 --- Item/CharArmor/CharArmor.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Item/CharArmor/CharArmor.lua b/Item/CharArmor/CharArmor.lua index d1b9296..5f3fd61 100644 --- a/Item/CharArmor/CharArmor.lua +++ b/Item/CharArmor/CharArmor.lua @@ -24,6 +24,8 @@ end --- --- @param smwSetObject table function p.addSmwProperties( apiData, frameArgs, smwSetObject ) + local common = require( 'Module:Common' ) + smwCommon.addSmwProperties( apiData, frameArgs, @@ -38,6 +40,11 @@ function p.addSmwProperties( apiData, frameArgs, smwSetObject ) smwCommon.setFromTable( setData, apiData:get( 'clothing.resistances' ), 'type', 'multiplier', 'ModifierDamageTaken', translate ) + -- Todo make format FN of Module:Common/SMW "public" + for key, value in pairs( setData ) do + setData[ key ] = common.formatNum( value ) + end + mw.smw.set( setData ) end @@ -141,4 +148,4 @@ function p.getShortDescription( frameArgs, smwData ) end -return p \ No newline at end of file +return p