Add files via upload
@ -598,6 +598,16 @@ function io.getFullName(name)
|
||||
end
|
||||
return temp
|
||||
end
|
||||
function io.getName(file)
|
||||
local name=io.getFullName(file)
|
||||
name=string.reverse(name)
|
||||
a,b=string.find(name,'.',1,true)
|
||||
name=string.sub(name,a+1,-1)
|
||||
return string.reverse(name)
|
||||
end
|
||||
function io.getPathName(path)
|
||||
return path:sub(1,#path-#io.getFullName(path))
|
||||
end
|
||||
function table.merge(t1, t2)
|
||||
for k,v in pairs(t2) do
|
||||
if type(v) == 'table' then
|
||||
@ -902,8 +912,184 @@ function randomGen:newND(a,b,s)
|
||||
return temp
|
||||
end
|
||||
--[[----------------------------------------
|
||||
LWZ
|
||||
------------------------------------------]]
|
||||
--~ bitM=2^8
|
||||
--~ bitS=2^7
|
||||
--~ lzw = {}
|
||||
--~ local function enc_reset(dict, size)
|
||||
--~ for k, _ in pairs(dict) do dict[k] = nil end
|
||||
--~ for i = 0, size-1 do dict[string.char(i)] = i end
|
||||
--~ return dict
|
||||
--~ end
|
||||
--~ local function dec_reset(dict, size)
|
||||
--~ for k, _ in pairs(dict) do dict[k] = nil end
|
||||
--~ for i = 0, size-1 do dict[i] = string.char(i) end
|
||||
--~ return dict
|
||||
--~ end
|
||||
--~ lzw.encode = function(message)
|
||||
--~ local w, result, size = "", {}, bitM
|
||||
--~ local dict = enc_reset({}, size)
|
||||
--~ for k in message:gmatch('.') do
|
||||
--~ local wk = w .. k
|
||||
--~ if dict[wk] then
|
||||
--~ w = wk
|
||||
--~ else
|
||||
--~ result[#result+1] = dict[w]
|
||||
--~ dict[wk] = size
|
||||
--~ size = size + 1
|
||||
--~ w = k
|
||||
--~ end
|
||||
--~ end
|
||||
--~ if w:len() > 0 then
|
||||
--~ result[#result+1] = dict[w]
|
||||
--~ end
|
||||
--~ return result
|
||||
--~ end
|
||||
--~ lzw.short_encode = function(message)
|
||||
--~ local w, result, size = "", {}, bitS
|
||||
--~ local dict = enc_reset({}, size)
|
||||
--~ for k in string.gmatch(message, '.') do
|
||||
--~ local wk = w .. k
|
||||
--~ if dict[wk] then
|
||||
--~ w = wk
|
||||
--~ else
|
||||
--~ result[#result+1] = string.char(dict[w])
|
||||
--~ dict[wk] = size
|
||||
--~ size = size + 1
|
||||
--~ if size == bitM then
|
||||
--~ size = bitS
|
||||
--~ enc_reset(dict, size)
|
||||
--~ end
|
||||
--~ w = k
|
||||
--~ end
|
||||
--~ end
|
||||
--~ if w:len() > 0 then
|
||||
--~ result[#result+1] = string.char(dict[w])
|
||||
--~ end
|
||||
--~ return table.concat(result)
|
||||
--~ end
|
||||
--~ lzw.decode = function(cipher)
|
||||
--~ local w, entry, result = "", "", {}
|
||||
--~ local size = bitM
|
||||
--~ local dict = dec_reset({}, size)
|
||||
--~ w = string.char(cipher[1])
|
||||
--~ result[1] = w
|
||||
--~ for i = 2, #cipher do
|
||||
--~ local codeword = cipher[i]
|
||||
--~ if dict[codeword] then
|
||||
--~ entry = dict[codeword]
|
||||
--~ else
|
||||
--~ entry = w .. w:sub(1,1)
|
||||
--~ end
|
||||
--~ dict[size] = w .. entry:sub(1, 1)
|
||||
--~ result[#result+1], w, size = entry, entry, size + 1
|
||||
--~ end
|
||||
--~ return table.concat(result)
|
||||
--~ end
|
||||
--~ lzw.short_decode = function(cipher)
|
||||
--~ local w, entry, result, size = "", "", {}, bitS
|
||||
--~ local dict = dec_reset({}, size)
|
||||
--~ w = cipher:sub(1, 1)
|
||||
--~ result[1] = w
|
||||
--~ for i = 2, cipher:len() do
|
||||
--~ local k = string.byte(cipher:sub(i, i))
|
||||
--~ if dict[k] then
|
||||
--~ entry = dict[k]
|
||||
--~ else
|
||||
--~ entry = w .. w:sub(1,1)
|
||||
--~ end
|
||||
--~ dict[size] = w .. entry:sub(1, 1)
|
||||
--~ result[#result+1], w, size = entry, entry, size + 1
|
||||
--~ if size >= bitM then
|
||||
--~ size = bitS
|
||||
--~ dec_reset(dict, size)
|
||||
--~ end
|
||||
--~ end
|
||||
--~ return table.concat(result)
|
||||
--~ end
|
||||
lzw = {}
|
||||
function lzw.encode(uncompressed) -- string
|
||||
local dictionary, result, dictSize, w, c = {}, {}, 255, ""
|
||||
for i = 0, 255 do
|
||||
dictionary[string.char(i)] = i
|
||||
end
|
||||
for i = 1, #uncompressed do
|
||||
c = string.sub(uncompressed, i, i)
|
||||
if dictionary[w .. c] then
|
||||
w = w .. c
|
||||
else
|
||||
table.insert(result, dictionary[w])
|
||||
dictSize = dictSize + 1
|
||||
dictionary[w .. c] = dictSize
|
||||
w = c
|
||||
end
|
||||
end
|
||||
if w ~= "" then
|
||||
table.insert(result, dictionary[w])
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function lzw.decode(compressed) -- table
|
||||
local dictionary, dictSize, entry, result, w, k = {}, 255, "", "", ""
|
||||
for i = 0, 255 do
|
||||
dictionary[i] = string.char(i)
|
||||
end
|
||||
for i = 1, #compressed do
|
||||
k = compressed[i]
|
||||
if dictionary[k] then
|
||||
entry = dictionary[k]
|
||||
elseif k == dictSize then
|
||||
entry = w .. string.sub(w, 1, 1)
|
||||
else
|
||||
return nil, i
|
||||
end
|
||||
result = result .. entry
|
||||
dictionary[dictSize] = w .. string.sub(entry, 1, 1)
|
||||
dictSize = dictSize + 1
|
||||
w = entry
|
||||
end
|
||||
return result
|
||||
end
|
||||
--[[----------------------------------------
|
||||
BIN
|
||||
------------------------------------------]]
|
||||
function bin.compress(uncomp,n)
|
||||
n=n or 9
|
||||
local cipher = lzw.encode(uncomp)
|
||||
local dat={}
|
||||
for i=1,#cipher do
|
||||
local fix=bits.new(cipher[i]).data:match("0*(%d+)")
|
||||
if cipher[i]==0 then
|
||||
fix=string.rep("0",n)
|
||||
end
|
||||
fix=string.rep("0",n-#fix)..fix
|
||||
table.insert(dat,fix)
|
||||
end
|
||||
str=table.concat(dat,"")
|
||||
str=string.rep("0",8-#str%8)..str
|
||||
comp={}
|
||||
for i=0,(#str/8) do
|
||||
table.insert(comp,bits.new(str:sub(i*8+1,i*8+8)):toSbytes())
|
||||
end
|
||||
return table.concat(comp,"")
|
||||
end
|
||||
function bin.decompress(comp,n)
|
||||
n=n or 9
|
||||
local tab={}
|
||||
for i=1,#comp do
|
||||
table.insert(tab,bits.new(comp:sub(i,i)).data)
|
||||
end
|
||||
tab=table.concat(tab,"")
|
||||
tab=tab:match("0*(%d+)")
|
||||
tab=string.rep("0",n-#tab%n)..tab
|
||||
uncomp={}
|
||||
for i=0,(#tab/n) do
|
||||
table.insert(uncomp,tonumber(tab:sub(i*n+1,i*n+n),2))
|
||||
end
|
||||
return lzw.decode(uncomp)
|
||||
end
|
||||
function bin:getSize()
|
||||
return self:getlength()
|
||||
end
|
||||
@ -2547,10 +2733,13 @@ end
|
||||
--[[----------------------------------------
|
||||
BITS
|
||||
------------------------------------------]]
|
||||
function bits.new(n)
|
||||
function bits.new(n,s)
|
||||
if type(n)=='string' then
|
||||
local t=tonumber(n,2)
|
||||
if not t then
|
||||
if t and #n<8 and not(s) then
|
||||
t=nil
|
||||
end
|
||||
if not(t) then
|
||||
t={}
|
||||
for i=#n,1,-1 do
|
||||
table.insert(t,bits:conv(string.byte(n,i)))
|
||||
|
||||
BIN
client/loading/image-0000001.png
Normal file
|
After Width: | Height: | Size: 293 B |
BIN
client/loading/image-0000002.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000003.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000004.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000005.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000006.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000007.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000008.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000009.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000010.png
Normal file
|
After Width: | Height: | Size: 297 B |
BIN
client/loading/image-0000011.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000012.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000013.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000014.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000015.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000016.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000017.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000018.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000019.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000020.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000021.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000022.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000023.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000024.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000025.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000026.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000027.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000028.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000029.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000030.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000031.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000032.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000033.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000034.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000035.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000036.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000037.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000038.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000039.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000040.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
client/loading/image-0000041.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000042.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000043.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000044.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000045.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000046.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000047.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000048.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000049.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000050.png
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
client/loading/image-0000051.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000052.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000053.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000054.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000055.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000056.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000057.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000058.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000059.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000060.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
client/loading/image-0000061.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000062.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000063.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000064.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000065.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000066.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000067.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000068.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000069.png
Normal file
|
After Width: | Height: | Size: 290 B |
BIN
client/loading/image-0000070.png
Normal file
|
After Width: | Height: | Size: 290 B |
@ -7,7 +7,7 @@ server:OnChatRecieved(function({user,msg}) end)
|
||||
client:OnChatRecieved(function(user,msg) end)
|
||||
client:sendChat(user,msg)
|
||||
]]
|
||||
net:registerModule("chatting",{1,0,0})
|
||||
net:registerModule("chatting",{2,1,0})
|
||||
function net.chatting:init() -- calling this initilizes the library and binds it to the servers and clients created
|
||||
--Server Stuff
|
||||
net.OnServerCreated:connect(function(s)
|
||||
|
||||
7
client/net/logging.lua
Normal file
@ -0,0 +1,7 @@
|
||||
net.OnServerCreated:connect(function(s)
|
||||
print("The logging Module has been loaded onto the server!")
|
||||
s.OnDataRecieved:connect(function(self,data,cid,ip,port)
|
||||
log(tostring(ip)..":"..tostring(port),"Server-log.log")
|
||||
log(data,"Server-log.log")
|
||||
end)
|
||||
end)
|
||||
48
client/net/settings.lua
Normal file
@ -0,0 +1,48 @@
|
||||
require("net")
|
||||
--General Stuff
|
||||
--[[ What this module does!
|
||||
Adds
|
||||
net.settings:init()
|
||||
server:regSetting(namespace,setting)
|
||||
]]
|
||||
net:registerModule("settings",{1,0,0})
|
||||
net.settings.config={}
|
||||
function net.settings:init() -- calling this initilizes the library and binds it to the servers and clients created
|
||||
--Server Stuff
|
||||
net.OnServerCreated:connect(function(s)
|
||||
print("The Settings Module has been loaded onto the server!")
|
||||
s.OnDataRecieved:connect(function(self,data,cid,ip,port) -- when the server recieves data this method is triggered
|
||||
local namespace,args=data:match("!settings! (%s+) (.+)")
|
||||
local args
|
||||
if namespace then
|
||||
for i,v in pairs(net.settings.config) do
|
||||
args={data:match(v[1])}
|
||||
if #args~=0 then
|
||||
v[2]:Fire(self,data,cid,ip,port,unpack(args))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
function s:regSetting(namespace,settings)
|
||||
if not net.settings.config[namespace] then
|
||||
net.settings.config[namespace]={}
|
||||
end
|
||||
local connection=multi:newConnection()
|
||||
table.insert(net.settings.config[namespace],{"!settings! "..namespace.." "..settings,connection})
|
||||
return connection
|
||||
end
|
||||
end)
|
||||
--Client Stuff
|
||||
net.OnClientCreated:connect(function(c)
|
||||
c.OnDataRecieved:connect(function(self,data) -- when the client recieves data this method is triggered
|
||||
--First Lets make sure we are getting Setting data
|
||||
end)
|
||||
function sendSetting(namespace,args)
|
||||
self:send("!settings! "..namespace.." "..args)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if net.autoInit then
|
||||
net.settings:init()
|
||||
end
|
||||