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

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

리버티게임(개발), 모두가 만들어가는 자유로운 게임
백괴게임>Gustmd7410
잔글편집 요약 없음
백괴게임>Gustmd7410
잔글편집 요약 없음
4번째 줄: 4번째 줄:
function p.stat (frame)
function p.stat (frame)
local hash = mw.hash.hashValue("md5", frame.args[1])
local hash = mw.hash.hashValue('md5', frame.args[1])
local data = frame.args[2] or "json"
local data = frame.args[2] or 'json'
local key = ""
local key = ''
local index = 1
local index = 1
local value = 0
local value = 0
local stat = {}
local stat = {}
while (index < 12) do
while (index < 12) do
if (index == 1) then key = "attack"
if (index == 1) then key = 'attack'
elseif (index == 3) then key = "quick"
elseif (index == 3) then key = 'quick'
elseif (index == 5) then key = "defense"
elseif (index == 5) then key = 'defense'
elseif (index == 7) then key = "hit"
elseif (index == 7) then key = 'hit'
elseif (index == 9) then key = "luck"
elseif (index == 9) then key = 'luck'
elseif (index == 11) then key = "HP"
elseif (index == 11) then key = 'HP'
end
end
value = tonumber(string.format("0x%s", string.sub(hash, index, index + 1)))
value = tonumber('0x' .. string.sub(hash, index, index + 1))
if (index == 11) then
if (index == 11) then
value = value / 2.55 * 3
value = value / 2.55 * 3

2018년 6월 28일 (목) 18:02 판


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

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


--나무위키:MD5 배틀 문서의 내용을 바탕으로 제작되었습니다.

local p = {}
	
	function p.stat (frame)
		local hash = mw.hash.hashValue('md5', frame.args[1])
		local data = frame.args[2] or 'json'
		
		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('0x' .. 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
		
		stat.JSON = mw.text.jsonEncode(stat)
		
		return stat[data]
	end
	
return p