8,756
edits
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
function p.decode(code, title, author) | function p.decode(code, title, author) | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
local | local gzdecode = zlib.gzdecode(zlib.base64_decode(code)) | ||
if gzdecode == false or gzdecode == nil then -- error handling | |||
error("This code isn't in base64. Please double check your input!") | |||
end | |||
local decoded = mw.text.jsonDecode(gzdecode) | |||
local version = decoded["gameversion"] | local version = decoded["gameversion"] | ||
Line 64: | Line 68: | ||
extNoun='Mutation' | extNoun='Mutation' | ||
end | end | ||
stats = decoded["modules"][statPos]["data"]["PointsPurchased"] | stats = decoded["modules"][statPos]["data"]["PointsPurchased"] | ||
-- No cybernetics means extra toughness | -- No cybernetics means extra toughness | ||
Line 141: | Line 144: | ||
end | end | ||
return p | return p |