Minecraft Wiki
Advertisement
인쇄용 판은 더 이상 지원되지 않으며 렌더링 오류가 있을 수 있습니다. 브라우저 북마크를 업데이트해 주시고 기본 브라우저 인쇄 기능을 대신 사용해 주십시오.
[만들기 | 역사 | 캐시 제거]설명문서
이 모듈의 설명문서가 없습니다. 이 모듈의 사용 방법을 안다면, 설명문서를 만들어 주십시오.
local p = {}

local paramsGrp = {
	cookable           = 'able',
	renewable          = 'able',

	canspawn           = 'can',
	gravity            = 'can',
	lavasusceptible    = 'can',
	transparent        = 'can',

	['end support']    = 'some',
	['nether support'] = 'some',

	dirt                 = true,
	light                = true,
	paid                 = true,
	['source available'] = true,
	['stackable']        = true,
	flammable            = true,
	type                 = true,
	behavior             = true,
	rarity               = true
}

local i18n = {
	na = '?',

	yesAble = '가능',
	yesCan  = '할 수 있음',
	yesSome = '있음',
	noAble  = '불가능',
	noCan   = '할 수 없음',
	noSome  = '없음',
	partial = '일부',

	yesDirt       = '햇빛과 흙 필요',
	yesLight      = '있음 (%s)',
	yesLightP     = '있음',
	yesPaid       = '유료',
	yesSource     = '[%s 가능]',
	yesSourceP    = '가능',
	yesStackable  = '가능 (%s)',
	yesStackableP = '가능',
	yesFlammable  = '있음 (%s)',
	yesFlammableP = '있음',
	noDirt        = '햇빛과 모래 필요',
	noLight       = '불가능',
	noPaid        = '무료',
	noSource      = '불가능',
	noStackable   = '불가능',
	noFlammable   = '없음',

	type = {
		armor                  = '갑옷',
		block                  = '블록',
		['block entity']       = '블록 개체',
		['building block']     = '건축 블록',
		combat                 = '전투',
		['decoration block']   = '장식 블록',
		decorations            = '장식',
		dyes                   = '염료',
		entity                 = '개체',
		fluid                  = '액체',
		food                   = '음식',
		foodstuff              = '음식',
		item                   = '아이템',
		items                  = '아이템',
		['non-solid block']    = '비고체 블록',
		plant                  = '식물',
		plants                 = '식물',
		potions                = '물약',
		projectile             = '발사체',
		['raw materials']      = '재료',
		['manufactured items'] = '제작된 아이템',
		['solid block']        = '고체 블록',
		['tile entity']        = 'tile개체',
		tool                   = '도구',
		tools                  = '도구',
		transport              = '수송',
		unknown                = '알 수 없음',
		vehicles               = '탈것',
		weapon                 = '무기',
		['wearable items']     = '입을 수 있는 아이템'
	},

	behavior = {
		passive   = '우호적',
		defensive = '방어적',
		neutral   = '중립',
		hostile   = '적대적'
	},

	rarity = {
		['very common'] = '매우 흔함',
		common          = '흔함',
		uncommon        = '흔하지 않음',
		rare            = '희귀',
		['very rare']   = '매우 희귀'
	}
}

function p.conv( f )
	local args = require( '모듈:ProcessArgs' ).merge( true )
	local param = args[ 1 ]
	local origVal = args[ 2 ]
	local val = origVal
	local result

	if not param or not origVal then
		if param == 'flammable' then
			return i18n.noSome
		elseif param and paramsGrp[ param:lower() ] then
			return i18n.na
		end
		return origVal or ''
	end

	param = param:lower()
	val   = val:lower()

	if i18n.type[ val ] then
		return i18n.type[ val ]
	end

	if i18n.behavior[ val ] then
		return i18n.behavior[ val ]
	end

	if i18n.rarity[ val ] then
		return i18n.rarity[ val ]
	end

	-- Normal yes/no check
	if paramsGrp[ param ] == 'able' then
		result = val == 'yes'
			and i18n.yesAble or val == 'no'
			and i18n.noAble  or origVal
	elseif paramsGrp[ param ] == 'can' then
		result = val == 'yes'
			and i18n.yesCan  or val == 'no'
			and i18n.noCan   or val == 'partial'
			and i18n.partial or origVal
	elseif paramsGrp[ param ] == 'some' then
		result = val == 'yes'
			and i18n.yesSome or val == 'no'
			and i18n.noSome  or origVal
	end

	if result then return result end

	-- Special yes/no check
	if param == 'dirt' then
		result = val == 'yes'
			and i18n.yesDirt or val == 'no'
			and i18n.noDirt  or origVal
	elseif param == 'light' then
		local lightLv = val:match( '^%d+$' ) or val:match( 'yes,?%s*%(?(%d+)%)?' )
		lightLv = tonumber( lightLv )

		result = ( lightLv and 0 < lightLv and lightLv < 16 )
			and i18n.yesLight:format( lightLv ) or val == 'yes'
			and i18n.yesLightP                  or ( val == 'no' or lightLv == 0 )
			and i18n.noLight                    or origVal
	elseif param == 'paid' then
		result = ( val == 'yes' or val == '유료' )
			and i18n.yesPaid or ( val == 'no' or val == '무료' )
			and i18n.noPaid  or origVal
	elseif param == 'source available' then
		local link = val:match( '^%[(%S+)%s' )
		local text = val:match( '%s(.+)%]$' )
		result = text == 'yes'
			and i18n.yesSource:format( link ) or val == 'yes'
			and i18n.yesSourceP               or val == 'no'
			and i18n.noSource                 or origVal
	elseif param == 'stackable' then
		local stackSize = val:match( 'yes%s*%((%d+)%)' )
		stackSize = stackSize or 0
		result = ( 0 < tonumber( stackSize ) and tonumber( stackSize ) <= 64 )
			and i18n.yesStackable:format( stackSize ) or val == 'yes'
			and i18n.yesStackableP                    or val == 'no'
			and i18n.noStackable                      or origVal
	elseif param == 'flammable' then
		local encouragement = val:match( 'yes,?%s*%(?(%d+)%)' )
		encouragement = tonumber( encouragement )

		result = ( encouragement ~= nil )
			and i18n.yesFlammable:format( encouragement ) or ( val == 'yes' or val == '있음' )
			and i18n.yesFlammableP                        or ( val == 'no' or val == '없음' )
			and i18n.noFlammable                          or origVal
	end

	return result or origVal
end

return p
Advertisement