Module:Dlc

From Binding of Isaac: Rebirth Wiki
Jump to: navigation, search

local p = {}

--local w_bit   = require( 'module:bit'   )
local w_frame = require( 'module:frame' )


function p.parse( f )
	return mw.loadData( 'module:dlc/data' ).values[w_frame.args( f )[1] or ''] or 0
end


function p.test( f )
	local args = w_frame.args( f )
	return ( mw.loadData( 'module:dlc/data' ).test[tonumber( args[1] )] or {} )[tonumber( args[2] ) or 15] or 0
	--[[
	local value   = args[1]
	local context = args[2]
	local data    = mw.loadData( 'module:dlc/data' )
	
	if context == 15 then
		return value
	end
	
	local filtered = w_bit['and']{ value, context }
	if filtered == 0 then
		return 0
	end
	
	if w_bit['or']{ value, context } == value then
		return 15
	end
	
	local limits = w_bit['and']{ 9, filtered }
	if limits == value then
	    return limits
	end
	]]
end


return p