Die writelog funktion is mal richtig Sinnlos sys_err und sys_log reichen doch :o
Aber sonst recht nice
rawscript("[TEXT_HORIZONTAL_ALIGN_CENTER]")
gibts übrigens auch
PHP Code:
print("Questlib by Mijago")
ql = {}
col = {}
zt = {}
proc = {}
local old_print = print
do
if pc == nil then
pc = {}
pc.get_name = function()
return "-name-"
end
end
if wait == nil then
wait = function()
old_print("<wait>")
end
end
if say == nil then
say = function(txt)
old_print("<say>", txt)
end
end
if chat == nil then
chat = function(txt)
old_print("<Chat>", txt)
end
end
if notice == nil then
notice = function(txt)
old_print("<notice>", txt)
end
end
if notice_all == nil then
notice_all = function(txt)
old_print("<notice_all>", txt)
end
end
end
doit = os.execute
arraytoselect = function(arr, abbr)
local d = "sel = select("
local i = 0
for i = 1, getn(arr) do
d = d .. "\\\"" .. arr[i] .. "\\\","
if abbr ~= nil and i == getn(arr) then
d = d .. "\\\"" .. abbr .. "\\\""
end
end
d = d .. ")\\nreturn sel"
return assert(loadstring(d))()
end
writelog = function(text, var, file)
if var == nil then
var = 1
end
if var == 1 then
local data = io.open("syserr", "a+")
data:write(os.date() .. "::\t" .. text .. "\n")
data:close()
elseif var == 2 then
local data = io.open("syslog", "a+")
data:write(os.date() .. "::\t" .. text .. "\n")
data:close()
elseif var == 3 then
local data = io.open(file, "a+")
data:write(os.date() .. "::\t" .. text .. "\n")
data:close()
end
end
pci = {}
pci.new = function(self, name)
local out = {}
local info = mysql_query("SELECT * FROM player.player WHERE name = '" .. name
.. "' LIMIT 1")
local reich = mysql_query("select player_index.empire FROM player.player INNE
R JOIN player.player_index ON player.account_id = player_index.id WHERE player.n
ame = '" .. pc.get_name() .. "'")
out.name = name
out.level = info.level[1]
out.playtime = info.playtime[1]
out.job = info.job[1]
out.account_id = info.account_id[1]
out.id = info.id[1]
out.voice = info.voice[1]
out.dir = info.dir[1]
out.x = info.x[1]
out.y = info.y[1]
out.z = info.z[1]
out.map_index = info.map_index[1]
out.exit_y = info.exit_y[1]
out.exit_x = info.exit_x[1]
out.exit_map_index = info.exit_map_index[1]
out.hp = info.hp[1]
out.mp = info.mp[1]
out.stamina = info.stamina[1]
out.random_hp = info.random_hp[1]
out.random_sp = info.random_sp[1]
out.level_step = info.level_step[1]
out.st = info.st[1]
out.ht = info.ht[1]
out.dx = info.dx[1]
out.iq = info.iq[1]
out.exp = info.exp[1]
out.gold = info.gold[1]
out.stat_point = info.stat_point[1]
out.skill_point = info.skill_point[1]
out.ip = info.ip[1]
out.part_main = info.part_main[1]
out.part_hair = info.part_hair[1]
out.skill_group = info.skill_group[1]
out.last_play = info.last_play[1]
out.alignment = info.alignment[1]
out.change_name = info.change_name[1]
out.sub_skill_point = info.sub_skill_point[1]
out.horse_skill_point = info.horse_skill_point[1]
out.horse_riding = info.horse_riding[1]
out.horse_hp_droptime = info.horse_hp_droptime[1]
out.horse_level = info.horse_level[1]
out.horse_stamina = info.horse_stamina[1]
out.horse_hp = info.horse_hp[1]
out.stat_reset_count = info.stat_reset_count[1]
out.empire = reich.empire[1]
setmetatable(out, {__index = pci})
print("Daten f\252r " .. name .. " erfolgreich geladen!")
return out
end
pci.update = function(self)
local info = mysql_query("SELECT * FROM player.player WHERE name = '" .. self
.name .. "' LIMIT 1")
self.level = info.level[1]
self.playtime = info.playtime[1]
self.job = info.job[1]
self.account_id = info.account_id[1]
self.id = info.id[1]
self.voice = info.voice[1]
self.dir = info.dir[1]
self.x = info.x[1]
self.y = info.y[1]
self.z = info.z[1]
self.map_index = info.map_index[1]
self.exit_y = info.exit_y[1]
self.exit_x = info.exit_x[1]
self.exit_map_index = info.exit_map_index[1]
self.hp = info.hp[1]
self.mp = info.mp[1]
self.stamina = info.stamina[1]
self.random_hp = info.random_hp[1]
self.random_sp = info.random_sp[1]
self.level_step = info.level_step[1]
self.st = info.st[1]
self.ht = info.ht[1]
self.dx = info.dx[1]
self.iq = info.iq[1]
self.exp = info.exp[1]
self.gold = info.gold[1]
self.stat_point = info.stat_point[1]
self.skill_point = info.skill_point[1]
self.ip = info.ip[1]
self.part_main = info.part_main[1]
self.part_hair = info.part_hair[1]
self.skill_group = info.skill_group[1]
self.last_play = info.last_play[1]
self.alignment = info.alignment[1]
self.change_name = info.change_name[1]
self.sub_skill_point = info.sub_skill_point[1]
self.horse_skill_point = info.horse_skill_point[1]
self.horse_riding = info.horse_riding[1]
self.horse_hp_droptime = info.horse_hp_droptime[1]
self.horse_level = info.horse_level[1]
self.horse_stamina = info.horse_stamina[1]
self.horse_hp = info.horse_hp[1]
self.stat_reset_count = info.stat_reset_count[1]
print("Daten f\252r " .. self.name .. " erfolgreich geupdated!")
end
mysql_query = function(query, user, pw, db, ip)
local var = {}
var.pre = ""
if ip ~= nil then
var.pre = var.pre .. " -h" .. ip
end
if user ~= nil then
var.pre = var.pre .. " -u" .. user
end
if pw ~= nil then
var.pre = var.pre .. " -p" .. pw
end
if db ~= nil then
var.pre = var.pre .. " -D" .. db
end
var.scriptfile = "sc_" .. pc.get_name()
var.outputfile = "op_" .. pc.get_name()
query = string.gsub(query, "\"", "'")
var.str = "mysql " .. var.pre .. " < " .. var.scriptfile .. " > " .. var.outputfile
script = io.open(var.scriptfile, "w")
script:write(query)
script:close()
os.execute(var.str)
local g = {}
local f = io.open(var.outputfile)
g.i = 0
g.li = {}
g.out = {}
g.count = 0
for line in f:lines() do
g.i = g.i + 1
g.li[g.i] = line
end
if g.li[1] == nil then
return "ERROR"
end
if string.len(g.li[1]) == 0 then
return "ERROR"
end
g.fields = split(g.li[1], "\t")
table.foreachi(g.fields, function(lb, ln)
g.out[ln] = {}
end)
table.foreachi(g.li, function(ou1, ou2)
if ou1 > 1 then
local la = split(ou2, "\t")
do
g.count = g.count + 1
table.foreachi(g.fields, function(lb, ln)
g.out[ln][ou1 - 1] = la[lb]
end)
end
end
end)
f:close()
g.out.__data = {}
g.out.__data.fields = g.fields
g.out.__data.lines = g.count
g.out.__data.user = user
g.out.__data.pass = pw
g.out.__data.host = ip
g.out.__data.db = db
g.out.__data.query = query
os.execute("rm " .. var.scriptfile)
os.execute("rm " .. var.outputfile)
return g.out
end
mysql_query2 = function(query, user, pw, db, ip)
local var = {}
var.pre = ""
if ip ~= nil then
var.pre = var.pre .. " -h" .. ip
end
if user ~= nil then
var.pre = var.pre .. " -u" .. user
end
if pw ~= nil then
var.pre = var.pre .. " -p" .. pw
end
if db ~= nil then
var.pre = var.pre .. " -D" .. db
end
query = string.gsub(query, "\"", "'")
os.execute("mysql -s" .. var.pre .. " -e=\\\"" .. query .. "\\\"")
end
mysql = {}
mysql.connect = function(self, ip, user, passwd, db)
local out = {}
out.ip = ip
out.user = user
out.pass = passwd
out.db = db
out.querycount = 0
out.querylist = {}
out.ql = {}
setmetatable(out, {__index = mysql})
return out
end
mysql.query = function(self, query)
self.lastquery =
(query, self.user, self.pass, self.db, self.ip)
self.lq = self.lastquery
self.querycount = self.querycount + 1
self.querylist[self.querycount] = self.lq
self.ql = self.querylist
return self.lastquery
end
mysql.setcfg = function(self, ip, user, pass, db)
if ip ~= nil then
self.ip = ip
end
if user ~= nil then
self.user = user
end
if pass ~= nil then
self.pass = pass
end
self.db = db
end
;/ das auslesen scheitert bei mir an der Farbtabelle oder was das darstellen soll
FUFU xD ist ja ne decompilte version angehängt