About quest:
It's very simple script in lua for metin2, from
.The script is very short, it have only 1100 line.
The source code by: masodikbela, from hungary.
If be more than 50 records in the tables, it will very laggy
Use:
In the rar archive are two .sql files, you have to put these tables into the player database.
Stuffs in the questlib.lua, put the end of the quest/questlib.lua.
If you want to take something to auction, you have to put the item to the first position in the warehouse.
The quest:
PHP Code:
----------------------------------------------------------------
--------------- Author: [TECH]masodikbela ----------------------
--------------- Create time: 2013.01.05. -----------------------
--------------- Auction quest for AzorisMt2 --------------------
----------------------------------------------------------------
quest mb_02_auction begin
state start begin
when 20355.chat."Aukcióra" begin
local owner_id = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owner_id) do
id = v[1]
end
local tbla = mysql_sweb("SELECT auid FROM fwmt2_bela.auction WHERE owner_id='"..id.."' LIMIT 5;")
local count = {}
for i,v in ipairs(tbla) do
table.insert(count, v[1])
end
if pc.get_level() < 100 then
say("Legalább 100-as szintűnek kell lenned!")
elseif table.getn(count) >= 5 then
say("Maximum 5 tárgyad lehet aukción egyszerre!")
else
say_title("Aukció vezető:")
say_reward("FIGYELEM! A raktárad első helyén lévő ")
say_reward("tárgyat fogod aukcióra küldeni!!!")
say_reward("Jól gondold meg[DELAY value;1000]. . .[/DELAY]")
say("Biztosan aukcióra szeretnéd bocsájtani ezt")
say("a tárgyat?")
local select1 = select("Igen", "Nem")
if select1 == 1 then
say("Add meg, hogy hány rúd legyen a kezdő (0 ha nincs)")
say()
local inp = input()
if inp == "" or tonumber(inp) == nil then
say("Nem hagyhatod üresen!")
end
if tonumber(inp) < 0 or tonumber(inp) > 200 then
say("Meg kell adnod egy számot, ami:")
say("- nem kisebb mint 0")
say("- nem nagyobb mint 200")
return
end
local ipn = string.format("%.0f", tonumber(inp))
local owner_id = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owner_id) do
id = v[1]
end
local acc_id = mysql_select("SELECT account_id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local accid
for i,v in ipairs(acc_id) do
accid = v[1]
end
local tbl = mysql_select("SELECT vnum FROM player.item WHERE owner_id="..string.format("%q",accid).." and window='SAFEBOX' and pos='0';")
local vnum = 0
for i,v in ipairs(tbl) do
vnum = tonumber(v[1])
end
if tonumber(vnum) > 0 then
say_reward("A tárgyad elhelyeztük az aukcióházban")
else
say_reward("Nincs tárgyad a raktárad 1. pozícióján!")
return
end
local table = mysql_select("SELECT owner_id, count, vnum, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, id FROM player.item WHERE owner_id="..string.format("%q",accid).." and window='SAFEBOX' and pos='0';")
for i,v in ipairs(table) do
mysql_notsweb("INSERT INTO fwmt2_bela.auction (id, started, date, owner_id, count, vnum, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, minlimit) VALUES ('"..v[24].."', "..string.format("%q",get_time()+60*60*24)..", "..string.format("%q",os.date('%Y%m%d'))..", '"..id.."', '"..v[2].."', '"..v[3].."', '"..v[4].."', '"..v[5].."', '"..v[6].."', '"..v[7].."', '"..v[8].."', '"..v[9].."', '"..v[10].."', '"..v[11].."', '"..v[12].."', '"..v[13].."', '"..v[14].."', '"..v[15].."', '"..v[16].."', '"..v[17].."', '"..v[18].."', '"..v[19].."', '"..v[20].."', '"..v[21].."', '"..v[22].."', '"..v[23].."', '"..ipn.."');")
mysql_notselect("DELETE FROM player.item WHERE id='"..v[24].."';")
end
end
end
end
when 20355.chat."Áruk" begin
local curpage = 1
local curloaded = 5
local data = mb_02_auction.loaddata()
if table.getn(data[1]) < 1 then
say("Jelenleg nincs aukció!")
return
end
local auid_list = data[1]
local name_list = data[2]
local menu_list = {}
--table.foreach(name_list, function(i, name) table.insert(menu_list, name) end)
table.insert(menu_list, name_list[1])
table.insert(menu_list, name_list[2])
table.insert(menu_list, name_list[3])
table.insert(menu_list, name_list[4])
table.insert(menu_list, name_list[5])
if table.getn(name_list) > 5 then
table.insert(menu_list, "Tovább")
table.insert(menu_list, "Mégse")
else
table.insert(menu_list, "Mégse")
end
local s=select_table(menu_list)
if table.getn(menu_list) <= 6 then
if s == table.getn(menu_list) then
return
end
else
if s == table.getn(menu_list) then
return
elseif s == table.getn(menu_list) - 1 then
mb_02_auction.nextpage(curpage + 1, curloaded + 5, auid_list, name_list)
end
end
if table.getn(menu_list) < 7 then
if table.getn(menu_list) == 2 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 3 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 4 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 5 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 6 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 3)
end
end
else
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 3)
end
end
end
function loaddata()
local tbla = mysql_sweb("SELECT auid FROM fwmt2_bela.auction WHERE started > '"..get_time().."';")
local tbl = {}
for i,v in ipairs(tbla) do
table.insert(tbl, v[1])
end
local name_list = {}
local auid_list = {}
table.foreach(tbl,
function(i, auid)
local vnum
local vnuam = mysql_sweb("SELECT vnum FROM fwmt2_bela.auction WHERE auid='"..auid.."';")
for i,v in ipairs(vnuam) do
vnum = v[1]
end
local namet = mysql_select("SELECT locale_name FROM player.item_proto WHERE vnum ='"..vnum.."';")
local name
for i,v in ipairs(namet) do
name = v[1]
end
table.insert(auid_list, auid)
table.insert(name_list, name)
end)
return {auid_list, name_list}
end
function nextpage(curpage, curloaded, auid_list, name_list)
local menu_list = {}
local loadbug = curloaded - 5
local maradek = table.getn(auid_list) - loadbug
if maradek <= 5 then
if maradek == 1 then
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
elseif maradek == 2 then
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, name_list[curloaded -3])
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
elseif maradek == 3 then
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, name_list[curloaded -3])
table.insert(menu_list, name_list[curloaded -2])
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
elseif maradek == 4 then
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, name_list[curloaded -3])
table.insert(menu_list, name_list[curloaded -2])
table.insert(menu_list, name_list[curloaded -1])
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
elseif maradek == 5 then
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, name_list[curloaded -3])
table.insert(menu_list, name_list[curloaded -2])
table.insert(menu_list, name_list[curloaded -1])
table.insert(menu_list, name_list[curloaded])
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
end
else
table.insert(menu_list, name_list[curloaded -4])
table.insert(menu_list, name_list[curloaded -3])
table.insert(menu_list, name_list[curloaded -2])
table.insert(menu_list, name_list[curloaded -1])
table.insert(menu_list, name_list[curloaded])
table.insert(menu_list, "Tovább")
table.insert(menu_list, "Vissza")
table.insert(menu_list, "Mégse")
end
local s=select_table(menu_list)
if s == table.getn(menu_list) - 1 then
mb_02_auction.prevpage(curpage - 1, curloaded - 5, auid_list, name_list)
end
if maradek > 5 and s == table.getn(menu_list) - 2 then
mb_02_auction.nextpage(curpage + 1, curloaded + 5, auid_list, name_list)
end
if s == table.getn(menu_list) then
return
end
if table.getn(menu_list) < 8 then
if table.getn(menu_list) == 3 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
end
elseif table.getn(menu_list) == 4 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 2)
end
elseif table.getn(menu_list) == 5 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 2)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 2)
end
elseif table.getn(menu_list) == 6 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 2)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 2)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 2)
end
elseif table.getn(menu_list) == 7 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 2)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 2)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 2)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 2)
end
end
else
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 2)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 2)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 2)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 2)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 2)
end
end
end
function prevpage(page, loaded, auid_list, name_list)
local menu_list = {}
local maradek = table.getn(auid_list)
if page == 1 then
if maradek == 1 then
table.insert(menu_list, name_list[loaded -4])
elseif maradek == 2 then
table.insert(menu_list, name_list[loaded -4])
table.insert(menu_list, name_list[loaded -3])
elseif maradek == 3 then
table.insert(menu_list, name_list[loaded -4])
table.insert(menu_list, name_list[loaded -3])
table.insert(menu_list, name_list[loaded -2])
elseif maradek == 4 then
table.insert(menu_list, name_list[loaded -4])
table.insert(menu_list, name_list[loaded -3])
table.insert(menu_list, name_list[loaded -2])
table.insert(menu_list, name_list[loaded -1])
elseif maradek >= 5 then
table.insert(menu_list, name_list[loaded -4])
table.insert(menu_list, name_list[loaded -3])
table.insert(menu_list, name_list[loaded -2])
table.insert(menu_list, name_list[loaded -1])
table.insert(menu_list, name_list[loaded])
end
else
table.insert(menu_list, name_list[loaded -4])
table.insert(menu_list, name_list[loaded -3])
table.insert(menu_list, name_list[loaded -2])
table.insert(menu_list, name_list[loaded -1])
table.insert(menu_list, name_list[loaded])
end
if page == 1 and table.getn(auid_list) > 5 then
table.insert(menu_list, "Tovább")
elseif page != 1 then
table.insert(menu_list, "Tovább")
table.insert(menu_list, "Vissza")
end
table.insert(menu_list, "Mégse")
local s = select_table(menu_list)
if s == table.getn(menu_list) then
return
end
if page == 1 and s == table.getn(menu_list) - 1 then
mb_02_auction.nextpage(page + 1, loaded +5, auid_list, name_list)
end
if page > 1 and s == table.getn(menu_list) - 2 then
mb_02_auction.nextpage(page + 1, loaded +5, auid_list, name_list)
end
if page > 1 and s == table.getn(menu_list) - 1 then
mb_02_auction.prevpage(page - 1, loaded - 5, auid_list, name_list)
end
if s == 1 then
mb_02_auction.item(auid_list[loaded - 4], name_list[loaded - 4], page, loaded, auid_list, name_list, 1)
elseif s == 2 then
mb_02_auction.item(auid_list[loaded - 3], name_list[loaded - 3], page, loaded, auid_list, name_list, 1)
elseif s == 3 then
mb_02_auction.item(auid_list[loaded - 2], name_list[loaded - 2], page, loaded, auid_list, name_list, 1)
elseif s == 4 then
mb_02_auction.item(auid_list[loaded - 1], name_list[loaded - 1], page, loaded, auid_list, name_list, 1)
elseif s == 5 then
mb_02_auction.item(auid_list[loaded], name_list[loaded], page, loaded, auid_list, name_list, 1)
end
end
function item(auid, name, page, loaded, auid_list, name_list, pg)
local owid = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owid) do
id = v[1]
end
local acc_id = mysql_select("SELECT account_id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local accid
for i,v in ipairs(acc_id) do
accid = v[1]
end
local d
local da
local namex
local load_d = mysql_sweb("SELECT lastprice, lastid, started, owner_id, count, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6, minlimit FROM fwmt2_bela.auction WHERE auid='"..auid.."';")
local lastprice
local started
local lastid
local owner_id
local count
local attrtype0
local attrvalue0
local socket2
local socket1
local socket0
local attrtype1
local attrvalue1
local attrtype2
local attrvalue2
local attrtype3
local attrvalue3
local attrtype4
local attrvalue4
local attrtype5
local attrvalue5
local attrtype6
local attrvalue6
local minlimit
for i,v in ipairs(load_d) do
lastprice = v[1]
lastid = v[2]
started = v[3]
owner_id = v[4]
count = v[5]
socket0 = v[6]
socket1 = v[7]
socket2 = v[8]
attrtype0 = v[9]
attrvalue0 = v[10]
attrtype1 = v[11]
attrvalue1 = v[12]
attrtype2 = v[13]
attrvalue2 = v[14]
attrtype3 = v[15]
attrvalue3 = v[16]
attrtype4 = v[17]
attrvalue4 = v[18]
attrtype5 = v[19]
attrvalue5 = v[20]
attrtype6 = v[21]
attrvalue6 = v[22]
minlimit = v[23]
end
if tonumber(lastprice) == 0 and tonumber(minlimit) > 0 then
say_title(name.." Ár: "..minlimit.." rúd")
else
say_title(name.." Ár: "..lastprice.." rúd")
end
local savezeit = tonumber(started)
local akzeit = get_time()
local wartezeit = savezeit - akzeit
if wartezeit > 0 then
local wartemin = 0
local wartestunde = 0
while (wartezeit >= 3600) do
wartestunde = wartestunde + 1
wartezeit = wartezeit - 3600
end
while (wartezeit >= 60) do
wartemin = wartemin + 1
wartezeit = wartezeit - 60
end
if wartestunde > 0 then
say("Aukció vége: "..wartestunde.." óra "..wartemin.." perc múlva.")
elseif wartemin > 0 then
say("Aukció vége: "..wartemin.." perc és "..wartezeit.." másodperc múlva.")
else
say("Aukció vége: "..wartezeit.." másodperc múlva.")
end
else
say_reward("Az aukciónak vége!")
end
if tonumber(count) != 1 then
say("Darab: "..count)
end
if tonumber(socket0) != 1 and tonumber(socket0) !=0 and tonumber(socket1) !=3 then
da = mysql_select("SELECT locale_name FROM player.item_proto WHERE vnum='"..socket0.."';")
for i,v in ipairs(da) do
d = v[1]
end
say("1. kő: "..d)
end
if tonumber(socket1) != 1 and tonumber(socket1) !=0 and tonumber(socket1) !=3 then
da = mysql_select("SELECT locale_name FROM player.item_proto WHERE vnum='"..socket1.."';")
for i,v in ipairs(da) do
d = v[1]
end
say("2. kő: "..d)
end
if tonumber(socket2) != 1 and tonumber(socket2) !=0 and tonumber(socket2) != 21600 then
da = mysql_select("SELECT locale_name FROM player.item_proto WHERE vnum='"..socket2.."';")
for i,v in ipairs(da) do
d = v[1]
end
say("3. kő: "..d)
end
if tonumber(attrtype0) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype0))
say("1. opt: "..namex..": "..attrvalue0)
end
if tonumber(attrtype1) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype1))
say("2. opt: "..namex..": "..attrvalue1)
end
if tonumber(attrtype2) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype2))
say("3. opt: "..namex..": "..attrvalue2)
end
if tonumber(attrtype3) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype3))
say("4. opt: "..namex..": "..attrvalue3)
end
if tonumber(attrtype4) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype4))
say("5. opt: "..namex..": "..attrvalue4)
end
if tonumber(attrtype5) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype5))
say("6. opt: "..namex..": "..attrvalue5)
end
if tonumber(attrtype6) != 0 then
namex = mb_02_auction.bonus(tonumber(attrtype6))
say("7. opt: "..namex..": "..attrvalue6)
end
local s = select("Licitál", "Frissít", "Vissza")
if s == 2 then
local updaterog = mb_02_auction.giverog()
if tonumber(updaterog) > 0 then
say_reward("Visszakaptál "..tonumber(updaterog).." darab rögöt.")
end
mb_02_auction.item(auid, name, page, loaded, auid_list, name_list, pg)
elseif s == 3 then
if pg == 1 or pg == 3 then
mb_02_auction.prevpage(page, loaded, auid_list, name_list)
elseif pg == 2 then
mb_02_auction.nextpage(page, loaded, auid_list, name_list)
end
elseif s == 1 then
if tonumber(started) <= get_time() then
say("Az aukciónak vége!")
mb_02_auction.item(auid, name, page, loaded, auid_list, name_list, pg)
else
local xa = mysql_sweb("SELECT lastprice FROM fwmt2_bela.auction WHERE auid='"..auid.."';")
local xc
for i,v in ipairs(xa) do
xc = v[1]
end
if tonumber(lastprice) - tonumber(xc) != 0 then
say("Megelőztek!")
mb_02_auction.item(auid, name, page, loaded, auid_list, name_list, pg)
end
local count1 = pc.countitem(80007)
if count1 < tonumber(lastprice) + 1 then
say("Szegény vagy mint a templom egere...")
say("Nincs elég rudad!")
mb_02_auction.item(auid, name, page, loaded, auid_list, name_list, pg)
end
if tonumber(lastprice) == 0 and tonumber(minlimit) > 0 then
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastprice=minlimit + 1 WHERE auid='"..auid.."';")
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastid='"..id.."' WHERE auid='"..auid.."';")
pc.removeitem(80007, tonumber(minlimit + 1))
elseif tonumber(lastprice) == 0 and tonumber(minlimit) == 0 then
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastprice=lastprice + 1 WHERE auid='"..auid.."';")
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastid='"..id.."' WHERE auid='"..auid.."';")
pc.removeitem(80007, 1)
elseif tonumber(lastprice) > 0 and tonumber(lastid) != tonumber(id) then
local asddwq = tonumber(lastprice) + 1
mysql_notsweb("INSERT INTO fwmt2_bela.auction_reward (id, count) VALUES ('"..lastid.."', '"..lastprice.."');")
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastprice=lastprice + 1 WHERE auid='"..auid.."';")
mysql_notsweb("UPDATE fwmt2_bela.auction SET lastid='"..id.."' WHERE auid='"..auid.."';")
pc.removeitem(80007, tonumber(lastprice)+1)
end
mb_02_auction.item(auid, name, page, loaded, auid_list, name_list, pg)
end
end
end
function bonus(id)
local name
if id == 1 then
name = "Max TP"
elseif id == 2 then
name = "Max MP"
elseif id == 3 then
name = "VIT"
elseif id == 4 then
name = "INT"
elseif id == 5 then
name = "ERŐ "
elseif id == 6 then
name = "ÜGY"
elseif id == 7 then
name = "Támadó sebesség"
elseif id == 8 then
name = "Mozgási sebesség"
elseif id == 9 then
name = "Varázs sebesség"
elseif id == 10 then
name = "TP regenerálódás"
elseif id == 11 then
name = "MP regenerálódás"
elseif id == 12 then
name = "Mérgezési esély"
elseif id == 13 then
name = "Ájulási esély"
elseif id == 14 then
name = "Lelassulás esély"
elseif id == 15 then
name = "Esély kritikus találatra"
elseif id == 16 then
name = "Esély átható találatra"
elseif id == 17 then
name="Félemberek elleni erő "
elseif id == 18 then
name = "Állatok elleni erő "
elseif id == 19 then
name = "Ork elleni erő "
elseif id == 20 then
name = "Ezotéria elleni erő "
elseif id == 21 then
name = "Nemhalottak elleni erő "
elseif id == 22 then
name = "Ördög elleni erő "
elseif id == 23 then
name = "Veszteségek a TP-böl eltűnnek"
elseif id == 24 then
name= "Veszteségek az MP-böl eltűnnek"
elseif id == 25 then
name = "Esély az ellenség Mp-inek átvételére"
elseif id == 26 then
name = "Esély hogy az MP-t találatnál megtartsd"
elseif id == 27 then
name = "Esély a testi támadás kivédésére"
elseif id == 28 then
name ="Esély a nyilak elkerülésére"
elseif id == 29 then
name = "Kard védelem"
elseif id == 30 then
name = "Kétkezes védelem"
elseif id == 31 then
name = "Tőr védekezés"
elseif id == 32 then
name = "Harang védelem"
elseif id == 33 then
name = "Legyező védekezés"
elseif id == 34 then
name = "Nyíl ellenállás"
elseif id == 35 then
name = "Tűz ellenállás"
elseif id == 36 then
name = "Villám ellenállás"
elseif id == 37 then
name = "Mágia ellenállás"
elseif id == 38 then
name = "Szél ellenállás"
elseif id == 39 then
name = "Esély a támadás visszaverésére"
elseif id == 40 then
name = "Esély az átok visszaverésére"
elseif id == 41 then
name = "Méreg ellenállás"
elseif id == 42 then
name = "Esély MP visszaállítására"
elseif id == 43 then
name = "Esély EXP bónuszra"
elseif id == 44 then
name = "Esély dupla mennyiségű Yang eldobására"
elseif id == 45 then
name = "Esély dupla mennyiségű tárgy eldobására"
elseif id == 46 then
name = "Ital hatásnövekedés"
elseif id == 47 then
name = "Esély TP visszaállítására"
elseif id == 48 then
name = "Immunis az ájulás ellen"
elseif id == 49 then
name = "Immunis a lelassulás ellen"
elseif id == 50 then
name ="Immunis az elesésre"
elseif id == 52 then
name = "Íjjász hatótávolság"
elseif id == 53 then
name = "Támadó érték"
elseif id == 54 then
name = "Védekezés"
elseif id == 55 then
name = "Mágikus támadó érték"
elseif id == 56 then
name = "Mágikus védelem"
elseif id == 58 then
name = "Max. Kitartás"
elseif id == 59 then
name = "Harcosok elleni erő "
elseif id == 60 then
name = "Nindzsák elleni erő "
elseif id == 61 then
name = "Sura elleni erő "
elseif id == 62 then
name = "Sámán elleni erő "
elseif id == 63 then
name = "Szörny elleni erő "
elseif id == 64 then
name = "Támadó érték"
elseif id == 65 then
name = "Védekezés"
elseif id == 66 then
name = "EXP"
elseif id == 67 then
name = "Tárgy ledobási esély"
elseif id == 68 then
name = "Yang eldobási esély"
elseif id == 71 then
name ="Készség károk"
elseif id == 72 then
name ="Átlagos károk"
elseif id == 73 then
name = "Készség károkkal szembeni ellenállás"
elseif id == 74 then
name = "Átlagos veszteség ellenállás"
elseif id == 76 then
name = "EXP bónusz"
elseif id == 77 then
name ="Tárgy zsákmányolási esély plusz"
elseif id == 78 then
name = "Védekezési esély harcos támadás ellen"
elseif id == 79 then
name = "Védekezési esély nindzsatámadás ellen"
elseif id == 80 then
name = "Védekezési esély Sura támadás ellen"
elseif id == 81 then
name = "Védekezési esély sámántámadás ellen"
else
name = tostring("Error "..id)
end
return name
end
when 20355.chat."Rögök az aukciósházban" begin
local s = select("Az aukciósház raktárában lévő rögeid", "Végetért aukcióból szerzett rögök", "Mégse")
if s == 1 then
local owid = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owid) do
id = v[1]
end
local s = mysql_sweb("SELECT count FROM fwmt2_bela.auction_reward WHERE id='"..id.."';")
local reward = {}
for i,v in ipairs(s) do
table.insert(reward, v[1])
end
local totalcount = 0
if table.getn(reward) > 1 then
for i in mb_02_auction.range(1, table.getn(reward)) do
totalcount = totalcount + tonumber(reward[i])
end
else
if table.getn(reward) == 1 and tonumber(reward[1]) > 0 then
totalcount = tonumber(reward[1])
end
end
if tonumber(totalcount) == 0 then
say("Jelenleg az aukcióház nem tartozik neked semmivel.")
else
local need = tonumber(totalcount)
while (need > 0) do
if need >= 200 then
pc.give_item2(80007, 200)
need = need - 200
else
pc.give_item2(80007, 1)
need = need - 1
end
end
mysql_notsweb("DELETE FROM fwmt2_bela.auction_reward WHERE id='"..id.."';")
say("Kaptál "..tonumber(totalcount).." rögöt.")
end
elseif s == 2 then
local owid = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owid) do
id = v[1]
end
local s = mysql_sweb("SELECT auid, lastprice FROM fwmt2_bela.auction WHERE owner_id='"..id.."' and lastprice > '0' and started < '"..get_time().."';")
local reward = {}
local auid = {}
for i,v in ipairs(s) do
table.insert(auid, v[1])
table.insert(reward, v[2])
end
local totalcount = 0
if table.getn(reward) > 1 then
for i in mb_02_auction.range(1, table.getn(reward)) do
totalcount = totalcount + tonumber(reward[i])
mysql_notsweb("UPDATE fwmt2_bela.auction SET owner_id='0' WHERE auid='"..auid[i].."';")
end
else
if table.getn(reward) == 1 and tonumber(reward[1]) > 0 then
totalcount = tonumber(reward[1])
mysql_notsweb("UPDATE fwmt2_bela.auction SET owner_id='0' WHERE auid='"..auid[1].."';")
end
end
if tonumber(totalcount) == 0 then
say("Jelenleg az aukcióház nem tartozik neked semmivel.")
else
local need = tonumber(totalcount)
while (need > 0) do
if need >= 200 then
pc.give_item2(80007, 200)
need = need - 200
else
pc.give_item2(80007, 1)
need = need - 1
end
end
say("Kaptál "..tonumber(totalcount).." rögöt.")
end
end
end
when 20355.chat."Nyereményeim" begin
local owid = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owid) do
id = v[1]
end
local s = mysql_sweb("SELECT auid FROM fwmt2_bela.auction WHERE owner_id='"..id.."' and started < '"..get_time().."' and lastprice='0' LIMIT 1;")
local reward = 0
for i,v in ipairs(s) do
reward = tonumber(v[1])
end
if tonumber(reward) > 0 then
say("Van egy(vagy több) lejárt aukciós tárgyad amire nem")
say("licitáltak. A raktárad 1. helyére fog kerülni.")
local acc_id = mysql_select("SELECT account_id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local accid
for i,v in ipairs(acc_id) do
accid = v[1]
end
local raktara = mysql_select("SELECT id FROM player.item WHERE owner_id='"..accid.."' and window='SAFEBOX' and pos='0' LIMIT 1;")
local raktar = 0
for i,v in ipairs(raktara) do
raktar = tonumber(v[1])
end
if tonumber(raktar) > 0 then
say("Van már valami a raktárad 1. helyén! Vedd ki!")
else
local sss = mysql_sweb("SELECT vnum, window, count, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6 FROM fwmt2_bela.auction WHERE auid='"..reward.."';")
for i,v in ipairs(sss) do
mysql_notselect("INSERT INTO player.item (owner_id, window, pos, count, vnum, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6) VALUES ('"..accid.."', '"..v[2].."', '0', '"..v[3].."', '"..v[1].."', '"..v[4].."', '"..v[5].."', '"..v[6].."', '0', '0', '0', '"..v[7].."', '"..v[8].."','"..v[9].."', '"..v[10].."', '"..v[11].."', '"..v[12].."', '"..v[13].."', '"..v[14].."', '"..v[15].."', '"..v[16].."', '"..v[17].."', '"..v[18].."', '"..v[19].."', '"..v[20].."');")
end
mysql_notsweb("DELETE FROM fwmt2_bela.auction WHERE auid='"..reward.."';")
say()
say_reward("A tárgy bekerült a raktáradba!")
end
else
local s2 = mysql_sweb("SELECT auid FROM fwmt2_bela.auction WHERE lastid='"..id.."' and started < '"..get_time().."' LIMIT 1;")
local reward2 = 0
for i,v in ipairs(s2) do
reward2 = tonumber(v[1])
end
if tonumber(reward2) > 0 then
say("Van egy(vagy több) tárgy amit liciten nyertél.")
say("A raktárad 1. helyére fog kerülni.")
local acc_id = mysql_select("SELECT account_id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local accid
for i,v in ipairs(acc_id) do
accid = v[1]
end
local raktara = mysql_select("SELECT id FROM player.item WHERE owner_id='"..accid.."' and window='SAFEBOX' and pos='0' LIMIT 1;")
local raktar = 0
for i,v in ipairs(raktara) do
raktar = tonumber(v[1])
end
if tonumber(raktar) > 0 then
say("Van már valami a raktárad 1. helyén! Vedd ki!")
else
local sss = mysql_sweb("SELECT vnum, window, count, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6 FROM fwmt2_bela.auction WHERE auid='"..reward2.."';")
for i,v in ipairs(sss) do
mysql_notselect("INSERT INTO player.item (owner_id, window, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6) VALUES ('"..accid.."', '"..v[2].."', '0', '"..v[3].."', '"..v[1].."', '"..v[4].."', '"..v[5].."', '"..v[6].."', '"..v[7].."', '"..v[8].."','"..v[9].."', '"..v[10].."', '"..v[11].."', '"..v[12].."', '"..v[13].."', '"..v[14].."', '"..v[15].."', '"..v[16].."', '"..v[17].."', '"..v[18].."', '"..v[19].."', '"..v[20].."');")
end
local sa = mysql_sweb("SELECT owner_id, lastprice FROM fwmt2_bela.auction WHERE auid='"..reward2.."';")
local owid = 0
local countwin
for i,v in ipairs(sa) do
owid = tonumber(v[1])
countwin = tonumber(v[2])
end
if tonumber(owid) == 0 then
mysql_notsweb("DELETE FROM fwmt2_bela.auction WHERE auid='"..reward2.."';")
else
mysql_notsweb("INSERT INTO fwmt2_bela.auction_reward (id, count) VALUES ('"..owid.."', '"..countwin.."');")
mysql_notsweb("DELETE FROM fwmt2_bela.auction WHERE auid='"..reward2.."';")
end
say()
say_reward("A tárgy bekerült a raktáradba!")
end
else
say("Nincs semmilyen tárgyad, ami az aukciósháznál van")
end
end
end
function range(a, b, step)
if not b then
b = a
a = 1
end
step = step or 1
local f =
step > 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue <= b then return nextvalue end
end or
step < 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue >= b then return nextvalue end
end or
function(_, lastvalue) return lastvalue end
return f, nil, a - step
end
function giverog()
local owid = mysql_select("SELECT id FROM player.player WHERE name='"..pc.get_name().."' LIMIT 1;")
local id
for i,v in ipairs(owid) do
id = v[1]
end
local s = mysql_sweb("SELECT count FROM fwmt2_bela.auction_reward WHERE id='"..id.."';")
local reward = {}
for i,v in ipairs(s) do
table.insert(reward, v[1])
end
local totalcount = 0
if table.getn(reward) > 1 then
for i in mb_02_auction.range(1, table.getn(reward)) do
totalcount = totalcount + tonumber(reward[i])
end
else
if table.getn(reward) == 1 and tonumber(reward[1]) > 0 then
totalcount = tonumber(reward[1])
end
end
if tonumber(totalcount) != 0 then
local need = tonumber(totalcount)
while (need > 0) do
if need >= 200 then
pc.give_item2(80007, 200)
need = need - 200
else
pc.give_item2(80007, 1)
need = need - 1
end
end
mysql_notsweb("DELETE FROM fwmt2_bela.auction_reward WHERE id='"..id.."';")
end
return totalcount
end
when 20355.chat."Kereső " begin
local curpage = 1
local curloaded = 5
say_title("Keresés")
say("Itt a tárgyakat kereshetsz nevük szerint.")
say("Nem fontos a teljes nevét beírnod.")
local inp = input()
local data = mb_02_auction.loadresult(tostring(inp))
if inp == "" or inp == nil then
say("Nem hagyhatod üresen!")
return
end
if table.getn(data[1]) < 1 then
say("Nincs találat!")
return
end
local auid_list = data[1]
local name_list = data[2]
local menu_list = {}
--table.foreach(name_list, function(i, name) table.insert(menu_list, name) end)
table.insert(menu_list, name_list[1])
table.insert(menu_list, name_list[2])
table.insert(menu_list, name_list[3])
table.insert(menu_list, name_list[4])
table.insert(menu_list, name_list[5])
if table.getn(name_list) > 5 then
table.insert(menu_list, "Tovább")
table.insert(menu_list, "Mégse")
else
table.insert(menu_list, "Mégse")
end
local s=select_table(menu_list)
if table.getn(menu_list) <= 6 then
if s == table.getn(menu_list) then
return
end
else
if s == table.getn(menu_list) then
return
elseif s == table.getn(menu_list) - 1 then
mb_02_auction.nextpage(curpage + 1, curloaded + 5, auid_list, name_list)
end
end
if table.getn(menu_list) < 7 then
if table.getn(menu_list) == 2 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 3 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 4 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 5 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
end
elseif table.getn(menu_list) == 6 then
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 3)
end
end
else
if s == 1 then
mb_02_auction.item(auid_list[curloaded - 4], name_list[curloaded - 4], curpage, curloaded, auid_list, name_list, 3)
elseif s == 2 then
mb_02_auction.item(auid_list[curloaded - 3], name_list[curloaded - 3], curpage, curloaded, auid_list, name_list, 3)
elseif s == 3 then
mb_02_auction.item(auid_list[curloaded - 2], name_list[curloaded - 2], curpage, curloaded, auid_list, name_list, 3)
elseif s == 4 then
mb_02_auction.item(auid_list[curloaded - 1], name_list[curloaded - 1], curpage, curloaded, auid_list, name_list, 3)
elseif s == 5 then
mb_02_auction.item(auid_list[curloaded], name_list[curloaded], curpage, curloaded, auid_list, name_list, 3)
end
end
end
function loadresult(text)
local tbla = mysql_sweb("SELECT auid FROM fwmt2_bela.auction WHERE started > '"..get_time().."';")
local tbl = {}
for i,v in ipairs(tbla) do
table.insert(tbl, v[1])
end
local name_list = {}
local auid_list = {}
table.foreach(tbl,
function(i, auid)
local vnum
local vnuam = mysql_sweb("SELECT vnum FROM fwmt2_bela.auction WHERE auid='"..auid.."';")
for i,v in ipairs(vnuam) do
vnum = v[1]
end
local namet = mysql_select("SELECT locale_name FROM player.item_proto WHERE vnum ='"..vnum.."';")
local name
for i,v in ipairs(namet) do
name = v[1]
end
if string.find(tostring(name), text) > 0 then
table.insert(auid_list, auid)
table.insert(name_list, name)
end
end)
return {auid_list, name_list}
end
end
end






