[Release] Questlib-Erweiterung

12/07/2011 15:20 Mijago#31
Um euch den Spaß zu bieten die Datei zu decompilen ;)
12/07/2011 15:56 Tofus#32
Quote:
Originally Posted by Mijago View Post
Um euch den Spaß zu bieten die Datei zu decompilen ;)
Verschlüsselt werde ich es aber garantiert nicht hochladen, theoretisch kann da ja alles drin stehen.
Soll nichts gegen dich sein, aber ich wüsste schon gerne was die neuen Funktionen genau machen.

Kannst du bitte noch die dekompilierte Version anhängen?


€: LuaDec gibt den Fehler bad header aus.. xD
12/07/2011 16:03 Mijago#33
LuaDec ist für 5.1 oder 5.0.2

Compiled with Lua 5.0.3..
12/07/2011 16:05 Tofus#34
Gibt's ne andere Möglichkeit?
12/07/2011 16:58 .Nagato#35
Hm.. du sagtest ja, dass du hier was pubst, mir aber die Final Version gibst. xD
Also ganz nice.
12/07/2011 17:30 Mijago#36
Wenn es überhaupt ne Final version geben wird, mache ja andauernd neues rein xD
12/08/2011 00:20 Testerek#37
This complicated but at the end of the file throws an error. Is editing the same compiler that you used already finished? This file can have any collateral?
So much I could do.
Sorry for my english I'm from Polish. :D


@Add my decommpiler
12/08/2011 09:31 Mijago#38
Quote:
Originally Posted by Testerek View Post
This complicated but at the end of the file throws an error. Is editing the same compiler that you used already finished? This file can have any collateral?
So much I could do.
Sorry for my english I'm from Polish. :D


@Add my decommpiler
Looks funny :D
So you can see, There aren't any bad things in it^^
12/08/2011 11:29 xMichiix#39
hallo,

bei mir kommt wen ich die IS.quest einfügen will "Calls undeclared function"
aber die erweiterung ist eingefügt ....
12/08/2011 11:40 .Delta#40
hast du denn auch die functionen in die quest_functions eingetragen? ;)
12/08/2011 12:05 .Alpha.#41
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(arrabbr)
   
local d "sel = select("
   
local i 0
   
for 1getn(arr) do
      
.. "\\\"" .. arr[i] .. "\\\","
      
if abbr ~= nil and == getn(arrthen
         d 
.. "\\\"" .. abbr .. "\\\""
      
end
   end
   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(selfname)
   
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.info.x[1]
   
out.info.y[1]
   
out.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.info.x[1]
   
self.info.y[1]
   
self.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(queryuserpwdbip)
   
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.0
   g
.li = {}
   
g.out = {}
   
g.count 0
   
for line in f:lines() do
      
g.g.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(lbln)
      
g.out[ln] = {}
   
end)
   
table.foreachi(g.li, function(ou1ou2)
      if 
ou1 1 then
         local la 
split(ou2"\t")
         do
            
g.count g.count 1
            table
.foreachi(g.fields, function(lbln)
               
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(queryuserpwdbip)
   
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(selfipuserpasswddb)
   
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(selfquery)
   
self.lastquery 
   (
queryself.userself.passself.dbself.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(selfipuserpassdb)
   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
12/08/2011 12:41 Mijago#42
Quote:
FUFU xD ist ja ne decompilte version angehängt
xD jaa, vll erst nachsehen o:

Nunja, ich schreibe gerne Funktionen selbst nach - einerseits aus langeweile (getn ist das selbe wie table.getn) oder, um zusätzliche dinge einzubringen (wie bei writelog)
12/08/2011 12:47 .Alpha.#43
Quote:
Originally Posted by Mijago View Post
xD jaa, vll erst nachsehen o:

Nunja, ich schreibe gerne Funktionen selbst nach - einerseits aus langeweile (getn ist das selbe wie table.getn) oder, um zusätzliche dinge einzubringen (wie bei writelog)
Ja, mache ich auch gelegentlich^^ Allerdings verlasse ich mich mehr auf die Funktionen die "Hard Coded" sind weil die meistens schneller sind.

Das mit pci ist interessant so könnte man die pc table um einige werte erweitern wie z.B pc.ip. Wenn man es einfach beim Login Event neu lädt. Notfalls speichert man es zwischen.
12/08/2011 13:04 Mijago#44
Quote:
Originally Posted by .Nova. View Post
Ja, mache ich auch gelegentlich^^ Allerdings verlasse ich mich mehr auf die Funktionen die "Hard Coded" sind weil die meistens schneller sind.

Das mit pci ist interessant so könnte man die pc table um einige werte erweitern wie z.B pc.ip. Wenn man es einfach beim Login Event neu lädt. Notfalls speichert man es zwischen.
pc. ist ja eine tabelle^^
Dh:
pc.ip = mysql_select("select ip from player.player WHERE name = \'"..pc.get_name().."\'")["ip"][1]
und du hast die IP..

Oder so wie alle andren, als funktion: (nur ohne die vid-funktion)
PHP Code:
pc.ip = function(name) if name == '' then name pc.get_name() end return mysql_select("select ip from player.player WHERE name = \'"..name.."\'")["ip"][1end 
(ja, das fungiert auch als Einzeiler ;)

pc.ip() = IP des jetzigen Charakters
pc.ip('Mijago') = Meine IP (Wann ich das letzte mal on war auf dem Sv..^^)

Danke für die idee!
wird gleich mal gemacht xP


Da ich mit Lua auch meinen Laptop "etwas" automatisiert habe und Funktionen für ihn geschrieben habe, hab ich einige Erfahrung mit Lua.
12/08/2011 13:30 .Alpha.#45
Quote:
Originally Posted by Mijago View Post
pc. ist ja eine tabelle^^
Dh:
pc.ip = mysql_select("select ip from player.player WHERE name = \'"..pc.get_name().."\'")["ip"][1]
und du hast die IP..

Oder so wie alle andren, als funktion: (nur ohne die vid-funktion)
PHP Code:
pc.ip = function(name) if name == '' then name pc.get_name() end return mysql_select("select ip from player.player WHERE name = \'"..name.."\'")["ip"][1end 
(ja, das fungiert auch als Einzeiler ;)

pc.ip() = IP des jetzigen Charakters
pc.ip('Mijago') = Meine IP (Wann ich das letzte mal on war auf dem Sv..^^)

Danke für die idee!
wird gleich mal gemacht xP


Da ich mit Lua auch meinen Laptop "etwas" automatisiert habe und Funktionen für ihn geschrieben habe, hab ich einige Erfahrung mit Lua.
Naja das wären zu viele Querys ich würde eher auf einen Query zum holen aller werte setzen beim Login Event.