본문으로 이동
  • 이 서버는 리버티게임의 개발용 베타 서버로, 게임 플레이 용도로 제작된 사이트가 아닙니다.
  • 리버티게임의 자동 인증된 사용자라면 개발에 필요한 관리자 권한을 신청할 수 있습니다.
  • 틀 및 기능별 소도구를 필요한 문서에만 선택적으로 로딩하는 테스트를 진행하고 있습니다. 작동하지 않는 문서가 있다면 담당자에게 알려주세요.

모듈:SimMD5: 두 판 사이의 차이

리버티게임(개발), 모두가 만들어가는 자유로운 게임
백괴게임>Gustmd7410
잔글편집 요약 없음
백괴게임>Gustmd7410
잔글편집 요약 없음
19번째 줄: 19번째 줄:
value = tonumber(string.format("0x%s", string.sub(hash, index, index + 1)))
value = tonumber(string.format("0x%s", string.sub(hash, index, index + 1)))
if not (index == 11) then
if (index == 11) then
value = value / 2.55 * 3
else
value = value / 2.55
value = value / 2.55
end
end

2018년 6월 25일 (월) 20:15 판


모듈 설명문서[보기] [편집] [역사] [새로 고침]

마법의 MD-5 시뮬레이터 등에서 사용되는 스탯 계산 모듈입니다.


local p = {}
	
	function p.stat (frame)
		local hash = mw.hash.hashValue("md5", frame.args[1])
		local data = frame.args[2]
		
		local key = ""
		local index = 1
		local value = 0
		local stat = {}
		while (index < 12) do
			if (index == 1) then key = "attack"
			elseif (index == 3) then key = "quick"
			elseif (index == 5) then key = "defense"
			elseif (index == 7) then key = "hit"
			elseif (index == 9) then key = "luck"
			elseif (index == 11) then key = "HP"
			end
			
			value = tonumber(string.format("0x%s", string.sub(hash, index, index + 1)))
			if (index == 11) then
				value = value / 2.55 * 3
			else
				value = value / 2.55
			end
			
			stat[key] = math.floor(value + 0.5)
			
			index = index + 2
		end
		
		if (data == "JSON") then
			stat = mw.text.jsonEncode(stat)
		else
			stat = stat[data]
		end
		return stat
	end
	
return p