Module:CryptogullJr: Difference between revisions

101 bytes removed ,  14:58, 7 August 2023
no edit summary
(error handling)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 25: Line 25:
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
local gzdecode = zlib.gzdecode(zlib.base64_decode(code))
local gzdecode = zlib.gzdecode(zlib.base64_decode(code))
if gzdecode == false then -- error handling
if gzdecode == false or gzdecode == nil then -- error handling
error("This code isn't in base64. Please double check your input!")
error("This code isn't in base64. Please double check your input!")
end
end
local decoded = mw.text.jsonDecode()
local decoded = mw.text.jsonDecode(gzdecode)
local version = decoded["gameversion"]
local version = decoded["gameversion"]
Line 68: Line 68:
extNoun='Mutation'
extNoun='Mutation'
end
end
mw.logObject(decoded["modules"][4]["data"]["selections"])
stats = decoded["modules"][statPos]["data"]["PointsPurchased"]
stats = decoded["modules"][statPos]["data"]["PointsPurchased"]
-- No cybernetics means extra toughness
-- No cybernetics means extra toughness
Line 145: Line 144:
end
end


function p.test()
return getCyberneticName("BiologicalIndexer")
end
return p
return p