1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Rian2ID_dofile=dofile
local tmpFiLe=os.tmpname():sub(2,-1)
local fileList={}
os.execute("dir sys\\lua\\ > "..tmpFiLe..".R2ID")
for v in io.lines(tmpFiLe..".R2ID") do
	if v:find("%d+/%d+/%d+") and v:find("<DIR>")==nil then
		table.insert(fileList,v:sub(37))
	end
end
os.execute("del \""..tmpFiLe..".R2ID\"")
function dofile(path)
	function string.table(str)
		local tbl={}
		for w in string.gmatch(str,".") do
			table.insert(tbl,w)
		end
		return tbl
	end
	function string.match(string1,string2)
		if #string1>#string2 then
			string2=string2..string.rep(" ",#string1-#string2)
		elseif #string2>#string1 then
			string1=string1..string.rep(" ",#string2-#string1)
		end
		local str1=string.table(string1)
		local str2=string.table(string2)
		local correct=0
		for n,v in pairs(str1) do
			if v==str2[n] then
				correct=correct+1
			end
		end
		return correct*100/#str1
	end
	function io.exists(filename)
		local FiLe=io.open(filename,"r")
		if FiLe~=nil then
			FiLe:close()
			return true
		end
		return false
	end
	function io.size(filename)
		local File=io.open(filename,"r")
		if File~=nil then
			local size=File:seek("end")
			File:close()
			return size
		end
		return nil
	end
	print("©000255000File: "..path)
	function openDoFile(path)
		local cLine=0
		local hooks=0
		local size=0
		if io.exists(path)==true then
			print("©000255000Size: "..io.size(path).." Byte")
			print("©000255000Hooks:")
			for line in io.lines(path) do
				cLine=cLine+1
				if line:sub(1,7)=="addhook" then
					local tablehook={}
					local line2=string.gsub(line,"%(\"","")
					line2=string.gsub(line2,"\"%)","")
					line2=string.gsub(line2,"\",\""," ")
				line2=string.gsub(line2,"addhook","")
					for w in string.gmatch(line2,"[^%s]+") do
						table.insert(tablehook,w)
					end
					print("©000255000Hook "..tablehook[1].." on function "..tablehook[2])
					hooks=hooks+1
				end
			end
			print("©000255000Line: "..cLine.." line(s)")
			print("©000255000"..hooks.." hook(s)")
			pcall(Rian2ID_dofile,path)
			return true
		else
			print("©255000000File "..path.." is not found. Checking for corrections...")
			return false
		end
	end
	if openDoFile(path)==false then
		local isFound=false
		for n,v in pairs(fileList) do
			if string.match(path:sub(9),v)>=75 and isFound==false then
				print("©000255000File "..path.." is actually sys/lua/"..v)
				openDoFile("sys/lua/"..v)
				isFound=true
			end
		end
		if isFound==false then
			print("©255000000File "..path.." is not found")
		end
	end
end