Finally! OTAL v 1.2 has been released!
You can use 302~ lua functions!
Is just enter on O.T.A.L - Open Tibia Advanced Lib
and download, it's good read manual.
This lib have an self install, you just need add
in last line of data.lua or global.lua (unzip all content on folder lib)
This lib, wne executed at first time this lib will set all tables on DB and create folder data/storage to save files .tbl (to functions (saveTable(table,name) andgetTable(name), Save tables in files)
and create file called Your Server Function List.txt, it contains ALL lua functions of your server, and file called OTAL-REINSTALL, delete it to reinstall lib.
Use TFS console to see it:
TFS gui dont show it.
All functions:
Please report bugs!
Changelog:
Feathures:
Folder install, you ascess here: Create luai file and create a .luai file, you pastew this file on data/install and open you server, while server is loading lib will open this folder and open all .luai. This function is to AUTO install scripts! Now you can just post .lui file and pp download and server will add tag SQL query if need and create script AUTOMATICALY!
The same of folder data/sql, it just execute an SQL query inside of an .sql .sqlite or .mysql file ^^
eace:
Fixed auto installer bug!
You can use 302~ lua functions!
Is just enter on O.T.A.L - Open Tibia Advanced Lib
and download, it's good read manual.
This lib have an self install, you just need add
Code:
dofile(getDataDir() .. 'lib/index.lua')
This lib, wne executed at first time this lib will set all tables on DB and create folder data/storage to save files .tbl (to functions (saveTable(table,name) andgetTable(name), Save tables in files)
and create file called Your Server Function List.txt, it contains ALL lua functions of your server, and file called OTAL-REINSTALL, delete it to reinstall lib.
Use TFS console to see it:
TFS gui dont show it.
All functions:
Lua:
--- Xmls
xml:open(file[,kind])
xml:setSess(sessname,tagname,name)
xml:getSess(SessName)
xml:readSess(SessName)
xml:readFree(tagname)
--- Vip
vip.getVip(cid)
vip.getVipByAcc(acc)
vip.setVip(cid,time)
vip.getVipByAccount(acc)
vip.hasVip(cid)
vip.accountHasVip(acc)
vip.getDays(days)
vip.addVipByAccount(acc,time)
vip.setVipByAccount(acc,time)
vip.returnVipString(cid)
-- Tibia
doScrollMessage(uid, message)
doSummonCreatureWithCheck(name, pos)
isLevel(cid,level)
stringcontains(txt, str)
isWalkable(pos)
getStringCount(msg)
isOnline(name)
getAccountStorageValue(accid,value_id)
setAccountStorageValue(accid,value_id,value)
doInArea(pos,radius,luaString,var)
setPlayerName(cid,name,msg)
doActionForAllPlayers(luaString)
isWeapon(uid)
isArmor(uid)
hasSqm(pos)
getFileString(file[,limit])
getPlayerInfo(cid,val)
executeInArea(cmd, pos, area)
doPlayerAddDepotItem(cid, item, count)
getInstantSpells(vocid)
setPlayerRecoveryKey(cid)
getPlayerTotalDefense(cid)
ddNumberOnArray(array, number)
getArrPosByName(array, name)
getCountOnArr(array, search)
doCalculateArray(array, calc)
changeLookDir(cid, dir)
getLuaFunctions()
doFindItemInPos(itens, pos)
doDelayAttack(cid, delay, min, max, type, effect, projectile, frompos, topos)
tableToString(tb)
saveTable(table,name)
getTable(name)
getItemIdByName2(name)
var_dump(...)
printT(tx,t)
animatedTextBig(pos,text,color)
doWriteLogFile(file, text,line)
getDirFiles(dir, ext)
getPlayerTotalArmor(cid)
getPlayerTotalAttack(cid)
onFile(type, directory, content)
isStair(uid, stepin, rope, ground, ladder)
utf8Decode(str)
utf8Encode(str)
findItemById(pos, id)
doKillCreature(cid)
isMoney(itemid)
getCurrentPlayers()
--- More lua
math.factorial(n)
string.impode(arr,sep)
string.trim(str)
string.explode(str, sep[,limit])
string.expand(s)
table.find(t, v, c)
table.countv(t, i)
table.maxv(t)
table.clean(t, ...)
table.asort(t, s)
table.tofile(t, nf, tn)
math.percent(v, t, f)
math.module(x)
math.interval(x, y)
-- Dns --- Socket
socket.dns.toip(ip)
socket.dns.gethostname()
socket.dns.tohostname(address)
--- HTTP
socket.http.request(url [, body])
--- lnt12
ltn12.filter.chain(filter1, filter2 [, ... filterN])
ltn12.filter.cycle(low [, ctx, extra])
ltn12.pump.all(source, sink)
ltn12.pump.step(source, sink)
ltn12.sink.chain(filter, sink)
ltn12.sink.error(message)
ltn12.sink.file(handle, message)
ltn12.sink.null()
ltn12.sink.simplify(sink)
ltn12.sink.table([table])
ltn12.source.cat(source1 [, source2, ..., sourceN])
ltn12.source.chain(source, filter)
ltn12.source.empty()
ltn12.source.error(message)
ltn12.source.file(handle, message)
ltn12.source.simplify(source)
ltn12.source.string(string)
-- Mime functions
mime.normalize([marker])
mime.decode(vr)
mime.encode(vt)
mime.stuff()
mime.wrap("text" [, length])
mime.b64(C [, D])
mime.dot(m [, B])
mime.eol(C [, D, marker])
mime.qp(C [, D, marker])
mime.qpwrp(n [, B, length])
mime.unb64(C [, D])
mime.unqp(C [, D])
mime.wrp(n [, B, length])
-- Socket
socket.bind(address, port [, backlog])
socket.connect(address, port [, locaddr, locport])
socket.newtry(finalizer)
socket.protect(func)
socket.select(recvt, sendt [, timeout])
socket.sink(mode, socket)
socket.skip(d [, ret1, ret2 ... retN])
socket.sleep(time)
socket.source(mode, socket [, length])
socket.gettime()
socket.try(ret1 [, ret2 ... retN])
-- Tcp functions
socket.tcp()
server:accept()
master:bind(address, port)
master:close()
master:connect(address, port)
client:getpeername()
master:getsockname()
master:getstats()
master:listen(backlog)
client:receive([pattern [, prefix]])
client:send(data [, i [, j]])
client:setoption(option [, value])
master:setstats(received, sent, age)
master:settimeout(value [, mode])
client:shutdown(mode)
-- Udp functions
socket.udp()
connected:close()
connected:getpeername()
connected:getsockname()
connected:receive([size])
unconnected:receivefrom([size])
connected:send(datagram)
unconnected:sendto(datagram, ip, port)
unconnected:setpeername(address, port)
connected:setpeername('*')
unconnected:setsockname(address, port)
connected:setoption(option [, value])
connected:settimeout(value)
--- Ex lib
ex.getenv(name)
ex.setenv(name, value)
ex.environ()
ex.chdir(pathname)
ex.mkdir(pathname)
ex.currentdir()
ex.dir(pathname)
ex.dirent(pathname)
ex.lock(file, mode, offset, length)
ex.unlock(file, offset, length)
ex.pipe()
ex.sleep(interval, [unit])
ex.spawn(...)
ex.wait(proc)
--- Luasql
conn:close()
conn:commit()
conn:execute(statement)
conn:rollback()
conn:setautocommit(boolean)
cur:close()
cur:fetch([table[,modestring]])
cur:getcolnames()
cur:numrows()
env:connect(sourcename[,username[,password[,hostname[,port]]]])
--- Rings
rings.new(env)
state:close ()
state:dostring(string, ...)
remotedostring(string, ...)
stable.get(key)
stable.set(key, value)
-- Coexpcall [url]http://coxpcall.luaforge.net/index.htm[/url]
coxpcall(f, err)
copcall(f, ...)
--- Copas [url=http://www.keplerproject.org/copas/index.html]Copas - Coroutine Oriented Portable Asynchronous Services for Lua[/url] (Coroutine Oriented Portable Asynchronous Services)
copas.addserver(server, handler[, timeout])
copas.addthread(thrd[, ...])
copas.loop(timeout)
copas.step(timeout)
copas.flush(skt)
copas.receive(skt, pattern)
copas.send(skt, data)
copas.wrap(skt)
-- Luagd: [url=http://lua-gd.luaforge.net/manual.html]Lua-GD Reference Manual[/url]
gd.create(x, sy)
gd.createPalette(x, y)
gd.createTrueColor(x, y)gdImage:createPaletteFromTrueColor(dither, colorsWanted)
gd.createFromJpeg(filename)
gd.createFromPng(filename)
gd.createFromGif(filename)
gd.createFromGd(filename)
gd.createFromGd2(filename)
gd.createFromGd2Part(filename, x, y, w, h)
gd.createFromXbm(filename)
gd.createFromXpm(filename)
gd.createFromJpegStr(string)
gd.createFromGifStr(string)
gd.createFromPngStr(string)
gd.createFromGdStr(string)
gd.createFromGd2Str(string)
gd.createFromGd2PartStr(string, x, y, w, h)
gdImage:png(filename)
gdImage:pngEx(filename, compression_level)
gdImage:jpeg(filename, quality)
gdImage:gif(filename)
gdImage:gd(filename)
gdImage:gd2(filename, chunkSize, format)
gdImage:wbmp(filename, fg)
gdImage:pngStr()
gdImage:jpegStr(quality)
gdImage:gifStr()
gdImage:gdStr()
gdImage:gd2Str(chunkSize, format)
gdImage:wbmpStr(fg)
gdImage:colorAllocate(red, green, blue)
gdImage:colorAllocateAlpha(red, green, blue, alpha)
gdImage:colorClosest(red, green, blue)
gdImage:colorClosestAlpha(red, green, blue, alpha)
gdImage:colorClosestHWB(red, green, blue)
gdImage:colorExact(red, green, blue)
gdImage:colorExactAlpha(red, green, blue, alpha)
gdImage:colorResolve(red, green, blue)
gdImage:colorResolveAlpha(red, green, blue, alpha)
gdImage:colorsTotal()
gdImage:red(color)
gdImage:blue(color)
gdImage:green(color)
gdImage:alpha(color)
gdImage:getTransparent()
gdImage:colorTransparent(color)
gdImage:colorDeallocate(color)
gdImage:boundsSafe(x, y)
gdImage:getPixel(x, y)
gdImage:sizeX()
gdImage:sizeY()
gdImage:sizeXY()
gdImage:getClip()
gdImage:setClip(x1, y1, x2, y2)
gdImage:setPixel(x, y, color)
gdImage:line(x1, y1, x2, y2, color)
gdImage:rectangle(x1, y1, x2, y2, color)
gdImage:filledRectangle(x1, y1, x2, y2, color)
gdImage:polygon({ { x1, y1 }, { x2, y2 } ... }, color)
gdImage:filledPolygon({ { x1, y1 }, { x2, y2 } ... }, color)
gdImage:openPolygon({ { x1, y1 }, { x2, y2 } ... }, color)
gdImage:arc(cx, cy, w, h, s, e, color)
gdImage:filledArc(cx, cy, w, h, s, e, color, style)
gdImage:filledEllipse(cx, cy, w, h, color)
gdImage:fillToBorder(x, y, border_color, color)
gdImage:saveAlpha(boolean)
gdImage:alphaBlending(boolean)
gdImage:string(font, x, y, string, color)
gdImage:stringUp(fontname, x, y, string, color)
gdImage:stringFT(color, fontname, ptsize, angle, x, y, string)
gdImage:stringFTEx(color, fontname, ptsize, angle, x, y, string, extra)
gdImage:stringFTCircle(cx, cy, radius, textRadius, fillPortion, fontname, points, top, bottom, color)
gd.useFontConfig(bool)
gd.fontCacheSetup()
gd.fontCacheShutdown()
gd.copy(dstImage, srcImage, dstX, dstY, srcX, srcY, w, h)
dstImage:copy(srcImage, dstX, dstY, srcX, srcY, w, h)
gd.copyResized(dstImage, srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH)
dstImage:copyResized(srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH)
gd.copyResampled(dstImage, srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH)
dstImage:copyResampled(srcImage, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH)
gd.copyRotated(dstImage, srcImage, dstX, dstY, srcX, srcY, srcW, srcH, ang)
dstImage:copyRotated(srcImage, dstX, dstY, srcX, srcY, srcW, srcH, ang)
gd.copyMerge(dstImage, srcImage, dstX, dstY, srcX, srcY, w, h, pct)
dstImage:copyMerge(srcImage, dstX, dstY, srcX, srcY, w, h, pct)
gd.copyMergeGray(dstImage, srcImage, dstX, dstY, srcX, srcY, w, h, pct)
dstImage:copyMergeGray(srcImage, dstX, dstY, srcX, srcY, w, h, pct)
gd.paletteCopy(dstImage, srcImage)
dstImage:paletteCopy(srcImage)
gdImage:sharpen(pct)
gdImage:trueColorToPalette(dither, colorsWanted)
gdImage:squareToCircle(radius)
gdImage:gifAnimBegin(filename, globalCM, loops)
gdImage:gifAnimBeginStr(globalCM, loops)
gdImage:gifAnimAdd(filename, localCM, leftOfs, topOfs, delay, disposal [, previm])
gdImage:gifAnimAddStr(localCM, leftOfs, topOfs, delay, disposal [, previm])
gdImage:gifAnimEnd(filename)
gdImage:gifAnimEndStr()
Please report bugs!
Changelog:
--- 1.1
=========New functions==========
math.factorial(n) -- By mock
isMoney(itemid) -- by shawak
doKillCreature(cid) -- by shawak
getCurrentPlayers() -- Colandus + shawak
===========Changes===========
--- 1.2
Changes in execute in area/ doActionForAllPlayers / doInArea
cmd can be string or function.
cmd = [[
doSendMagicEffect(pos,1)
]]
cmd = function(pos)
doSendMagicEffect(pos,1,)
end
====
Change in: string.impode
=========Features==========
Folder sql: put an .sql, .sqlite, .mysql file
and script will execute all sql querys and delete files
Folder install: put an luai file to install some script on your server.
=========LIB==========
Luagd: Lua-GD Reference Manual
Feathures:
Folder install, you ascess here: Create luai file and create a .luai file, you pastew this file on data/install and open you server, while server is loading lib will open this folder and open all .luai. This function is to AUTO install scripts! Now you can just post .lui file and pp download and server will add tag SQL query if need and create script AUTOMATICALY!
The same of folder data/sql, it just execute an SQL query inside of an .sql .sqlite or .mysql file ^^
eace:
Fixed auto installer bug!
Attachments
-
OTAL v1.21.rar823.5 KB · Views: 360 · VirusTotal
Last edited: