Huhu zusammen,
ich habe die letzten beiden Abende damit verbracht, bei mir das Gildenlager von Professor Ente einzubauen, bekomme es allerdings nicht hin, dass man auch Items einlagern kann (alles andere geht).
Das Problem habe ich, so zumindest meiner Meinung nach, soweit eingegrenzt, dass es an diesem Part in der Quest liegt:
- local attr = {{item3.get_attr(0)}, {item3.get_attr(1)}, {item3.get_attr(2)}, {item3.get_attr(3)},{item3.get_attr(4)},{item3.get_attr(5)}, {item3.get_attr(6)}}
Ich habe dies auch mit item2.get_attr() versucht, ebenso mit item.attr_type(), item.attr_value() und item.get_attr_type(), item.get_attr_value().
Nachstehend die Function mit meinen "Messages", welche ich mir zum Debuggen in die Quest eingebaut habe.
- function insert_item(cell,slot,tab)
- chat('Item einlagern!')
- local result = item.select_cell(cell)
- if not result then syschat'Probier es nochmal.' return end
- local itemId1 = item.get_id()
- chat('Einzulagerndes Item '..itemId1)
- local itemVnum1 = item.get_vnum()
- chat('Item Vnum '..itemVnum1)
- item.select_cell(cell)
- chat('cell '..cell)
- chat('item type '..item.attr_type(1))
- chat('item value '..item.attr_value(1))
- chat('item2 '..item2.get_attr(1))
- chat('item3 '..item3.get_attr(1))
- chat('item1 type '..item.get_attr_type(1))
- chat('item1 value '..item.get_attr_value(1))
- local attr = {{item3.get_attr(0)}, {item3.get_attr(1)}, {item3.get_attr(2)}, {item3.get_attr(3)},{item3.get_attr(4)},{item3.get_attr(5)}, {item3.get_attr(6)}}
- chat('attr '..attr)
- local socket, itemCount, itemVnum = {item.get_socket(0), item.get_socket(1), item.get_socket(2),item.get_socket(3),item.get_socket(4),item.get_socket(5)}, item.get_count(),item.get_vnum()
- if itemId1 != item.get_id() or itemVnum1 != itemVnum then syschat'wtf?' return end
- if not guildstorage.item_can_store(itemVnum) then syschat'Dieses Item kann nicht gelagert werden.' return end
- if itemCount > 1 then
- for i = 1, itemCount do
- item.remove()
- item.select_cell(cell)
- end
- elseif itemCount == 1 then
- item.remove()
- else
- chat'Fehler'
- return
- end
- cmdchat('GUILDSTORAGE_ADDITEMSLOT '..slot..' '..tab..' '..itemVnum..' '..itemCount..' '..socket[1]..' '..socket[2]..' '..socket[3]..' '..socket[4]..' '..socket[5]..' '..socket[6]..' '..attr[1][1]..' '..attr[1][2]..' '..attr[2][1]..' '..attr[2][2]..' '..attr[3][1]..' '..attr[3][2]..' '..attr[4][1]..' '..attr[4][2]..' '..attr[5][1]..' '..attr[5][2]..' '..attr[6][1]..' '..attr[6][2]..' '..attr[7][1]..' '..attr[7][2])
- guildstorage.add_log(pc.get_name(),'Item','einlagern',item_name(itemVnum)..' ('..itemCount..')')
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt", "a+")
- syschat(itemVnum.."#"..itemCount.."#"..(slot+120*tab).."#"..socket[1].."#"..socket[2].."#"..socket[3].."#"..socket[4].."#"..socket[5].."#"..socket[6].."#"..attr[1][1].."#"..attr[1][2].."#"..attr[2][1].."#"..attr[2][2].."#"..attr[3][1].."#"..attr[3][2].."#"..attr[4][1].."#"..attr[4][2].."#"..attr[5][1].."#"..attr[5][2].."#"..attr[6][1].."#"..attr[6][2].."#"..attr[7][1].."#"..attr[7][2])
- guildstorage:write(itemVnum.."#"..itemCount.."#"..(slot+120*tab).."#"..socket[1].."#"..socket[2].."#"..socket[3].."#"..socket[4].."#"..socket[5].."#"..socket[6].."#"..attr[1][1].."#"..attr[1][2].."#"..attr[2][1].."#"..attr[2][2].."#"..attr[3][1].."#"..attr[3][2].."#"..attr[4][1].."#"..attr[4][2].."#"..attr[5][1].."#"..attr[5][2].."#"..attr[6][1].."#"..attr[6][2].."#"..attr[7][1].."#"..attr[7][2].."\\n")
- guildstorage:flush()
- guildstorage:close()
- end
Alles anzeigen
Ingame sieht das dann so aus, wenn ich ein Item versucht habe ins Lager zu ziehen:
Bitte melden Sie sich an, um dieses Bild zu sehen.
Die syserr ist Clientside, sowie Serverside leer.
Alles andere beim Gildenlager funktioniert...Rechte vergabe, Yang ein- und auszahlen usw.
Functions sind auch vorhanden und auch in der quest_functions aufgelistet.
Eingebaut habe ich das ganze nach dem Tut, dass bei seinem Release auf Epvp dabei war.
Der Link zum Release Bitte melden Sie sich an, um diesen Link zu sehen.
Hier nochmal die komplette Quest:
- --[[
- |---------------------------------------------------------------------------------------|
- | __________ _____ |
- | \______ \_______ ____ _/ ____\ ____ ______ ______ ____ _______ |
- | | ___/\_ __ \ / _ \\ __\_/ __ \ / ___/ / ___// _ \\_ __ \ |
- | | | | | \/( <_> )| | \ ___/ \___ \ \___ \( <_> )| | \/ |
- | |____| |__| \____/ |__| \___ >/____ >/____ >\____/ |__| |
- | \/ \/ \/ |
- | ___________ __ |
- | \_ _____/ ____ _/ |_ ____ |
- | | __)_ / \\ __\_/ __ \ |
- | | \| | \| | \ ___/ |
- | /_______ /|___| /|__| \___ > |
- | \/ \/ \/ |
- |---------------------------------------------------------------------------------------|
- ]]
- quest guildstorage begin
- state start begin
- when login begin
- cmdchat("GUILDSTORAGE QID/"..q.getcurrentquestindex())
- pc.setqf('login',get_time()+15)
- end
- when 9005.chat. "Gildenlager" begin
- setskin(NOWINDOW)
- guildstorage.open_gs()
- end
- function open_gs()
- if pc.getqf('login') >= get_time() then syschat'Du kannst das Gildenlager erst 15 Sekunden nach dem Login benutzen.' return end --NEU 06.07.2014
- if game.get_event_flag('gildenlager') == 0 then syschat'Das Gildenlager ist zurzeit deaktiviert.' return end
- if not pc.has_guild() then syschat'Du benoetigst eine Gilde um das Gildenlager benutzen zu koennen.' setskin(NOWINDOW) return end
- if not guildstorage.has_guildstorage() then guildstorage.create_guildstorage() end
- if pc.is_polymorphed() then syschat'Du kannst das Gildenlager nicht verwenden wenn du verwandelt bist.' return end -- NEW
- if pc.is_guild_master() then
- cmdchat('GUILDSTORAGE OPEN/1')
- else
- cmdchat('GUILDSTORAGE OPEN/0')
- end
- guildstorage.refresh()
- pc.setqf("GUILDSTORAGE",1)
- end
- when button begin
- if game.get_event_flag('gildenlager') == 0 then syschat'Das Gildenlager ist zurzeit deaktiviert.' return end
- local cmd = guildstorage.client_command(getinput("GUILDSTORAGE QUESTCMD"))
- if pc.is_polymorphed() and cmd[1] != 'UPDATE' then syschat'Du kannst das Gildenlager nicht verwenden wenn du verwandelt bist.' return end -- NEW
- -- [ITEM]
- if cmd[1] == 'TAKE_ITEM' then
- if not guildstorage.get_authority(1) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
- -- if pc.get_empty_inventory_count() < 3 then syschat'Du hast nicht genug Platz im Inventar, du brauchst mindestens drei freie Plaetze' return end
- local slot = tonumber(cmd[2])+120*tonumber(cmd[3])
- local item = guildstorage.get_slot_item(slot)
- if not pc.enough_inventory(item[1]) then syschat'Du hast nicht genug Platz im Inventar.' return end
- if guildstorage.slot_empty(slot) then syschat'Dieses Item befindet sich an einer anderen Position, oder wurde schon rausgenommen' return end
- if game.get_event_flag('GUILDS_USE_'..pc.get_guild()) == 1 then syschat'Fehler #101' return end
- guildstorage.remove_item(slot)
- guildstorage.give_item(item)
- elseif cmd[1] == 'MOVE_ITEM' then
- item.select_cell(tonumber(cmd[3]))
- if not guildstorage.get_authority(0) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
- --possible to store the item? antiflag/flag
- if cmd[2] == 'INVENTORY' then
- if not guildstorage.slot_empty(tonumber(cmd[4])+120*tonumber(cmd[5])) then syschat'Dieser Slot ist bereits belegt.' return end
- guildstorage.insert_item(tonumber(cmd[3]),tonumber(cmd[4]),tonumber(cmd[5]))
- elseif cmd[2] == 'GUILDSTORAGE' then
- if not guildstorage.slot_empty(tonumber(cmd[5])+120*tonumber(cmd[6])) then syschat'Dieser Slot ist bereits belegt, oder das Item existiert nichtmehr.' return end
- guildstorage.move_item(tonumber(cmd[3])+120*tonumber(cmd[4]),tonumber(cmd[5])+120*tonumber(cmd[6]))
- end
- -- [MONEY]
- elseif cmd[1] == 'TAKE_MONEY' then
- if not guildstorage.get_authority(3) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
- local old_money = guildstorage.get_money()
- if old_money < tonumber(cmd[2]) then syschat'Soviel Yang ist nicht im Gildenlager.' return end
- local new_money = tonumber(cmd[2])
- if new_money < 0 then return end
- if new_money+pc.get_money() >= 1999999999 then syschat'Du kannst nicht mehr wie 2.000.000.000 Yang bei dir haben.' return end
- guildstorage.change_money(-new_money)
- pc.change_money(new_money)
- guildstorage.add_log(pc.get_name(),'Yang','abheben',new_money)
- cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money-new_money))
- elseif cmd[1] == 'GIVE_MONEY' then
- if not guildstorage.get_authority(2) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
- local old_money = guildstorage.get_money()
- local new_money = tonumber(cmd[2])
- if new_money < 0 then return end
- if new_money > pc.get_money() then syschat'Soviel Yang besitzt du nicht' return end
- pc.change_money(-new_money)
- guildstorage.change_money(new_money)
- guildstorage.add_log(pc.get_name(),'Yang','einzahlen',new_money)
- cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money+new_money))
- -- [MEMBER]
- elseif cmd[1] == 'ADD_MEMBER' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- local members = guildstorage.get_members()
- if table.getn(members) >= 12 then syschat'Du kannst maximal nur 12 Member eintragen.' return end
- guildstorage.add_member(cmd[2])
- cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
- elseif cmd[1] == 'DELETE_MEMBER' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- guildstorage.delete_member(cmd[2])
- cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
- elseif cmd[1] == 'AUTHORITY' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- guildstorage.set_authority(cmd[2],tonumber(cmd[3]),cmd[4])
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- -- id, membername, authority 1-4
- cmdchat('GUILDSTORAGE_ADDMEMBER '..(i-1)..' '..members[i][1]..' '..members[i][2]..' '..members[i][3]..' '..members[i][4]..' '..members[i][5])
- end
- elseif cmd[1] == 'GETMEMBERLIST' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- -- id, membername, authority 1-4
- cmdchat('GUILDSTORAGE_ADDMEMBER '..(i-1)..' '..members[i][1]..' '..members[i][2]..' '..members[i][3]..' '..members[i][4]..' '..members[i][5])
- end
- cmdchat('GUILDSTORAGE REFRESH_MEMBERS')
- elseif cmd[1] == 'UPDATE' then
- guildstorage.refresh_tempslots()
- elseif cmd[1] == 'OPEN' then
- guildstorage.open_gs()
- elseif cmd[1] == 'LOAD_LOGS' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- local logs = guildstorage.load_logs()
- local logsLen = table.getn(logs)
- for i = 0, logsLen-1 do
- local var = (logsLen-i)
- cmdchat('GUILDSTORAGE_ADDLOG '..(var-1)..' '..logs[var][1]..' '..logs[var][2]..' '..logs[var][3]..' '..logs[var][4]..' '..logs[var][5])
- end
- elseif cmd[1] == 'DELETE_LOGS' then
- if not pc.is_guild_master() then syschat'Cheese. ;p' return end
- guildstorage.clear_logs()
- end
- end
- function item_can_store(itemvnum)
- local antiflags = guildstorage.item_get_real_antiflags(guildstorage.item_antiflag(itemvnum))
- local blackListItem = {50821,50822,50823,50824,50825,50826,51002}
- for i = 1, table.getn(blackListItem) do
- if blackListItem[i] == itemvnum then
- return false
- end
- end
- for i = 1 , table.getn(antiflags) do
- if antiflags[i] == 128 or antiflags[i] == 131072 or antiflags[i] == 8192 or antiflags[i] == 64 then return false end
- -- Wenn das item die Antiflag hat wird es nicht eingelagert.
- end
- return true
- end
- function item_get_real_antiflags(antiflag_)
- antiflags = {131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1}
- tab2 = {}
- table.foreach(antiflags,function(_,v) if antiflag_ >= v then table.insert(tab2,v) antiflag_ = antiflag_ - v end end)
- return tab2
- end
- function item_antiflag(item_vnum)
- local result = mysql_query("SELECT antiflag from player.item_proto where vnum = "..item_vnum..";")
- return tonumber(result.antiflag[1])
- end
- ----------------------
- --LOGS START
- ----------------------
- function load_logs()
- local logs = {}
- local gs_logs = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "r")
- for line in gs_logs:lines() do
- table.insert(logs,guildstorage.split_(line,"#"))
- end
- return logs
- end
- function clear_logs()
- local gs_log = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
- gs_log:flush()
- gs_log:close()
- end
- function add_log(name_,type_,do_,desc_)
- local gs_logs = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "r")
- local lineCount = 0
- for line in gs_logs:lines() do
- lineCount = lineCount + 1
- end
- if lineCount >= 1000 then
- local gs_log = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
- gs_log:flush()
- gs_log:close()
- end
- local gs_log = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "a+")
- local date_ = os.date()
- date_ = string.gsub(date_," ", "+-+")
- desc_ = string.gsub(desc_," ", "+-+")
- gs_log:write(name_..'#'..date_..'#'..type_..'#'..do_..'#'..desc_..'\\n')
- gs_log:flush()
- gs_log:close()
- end
- ----------------------
- --LOGS END
- ----------------------
- ----------------------
- --MEMBER & AUTHORITY START
- ----------------------
- -- Auth 0 = einlagern
- -- Auth 1 = rausnehmen
- -- Auth 2 = einzahlen
- -- Auth 3 = auszahlen
- function get_members()
- local members = {}
- local gs_member = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/authority.txt", "r")
- for line in gs_member:lines() do
- table.insert(members,guildstorage.split_(line,"#"))
- end
- return members
- end
- function get_authority(authID)
- if pc.is_guild_master() then return true end
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- if members[i][1] == pc.get_name() then
- if tonumber(members[i][authID+2]) == 0 then return false else return true end
- end
- end
- return false
- end
- function set_authority(member,authID,auth)
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- if members[i][1] == member then
- members[i][authID+2] = auth
- break
- end
- end
- local gs_member = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
- for i = 1, table.getn(members) do
- gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
- end
- gs_member:flush()
- gs_member:close()
- end
- function add_member(member)
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- if members[i][1] == member then
- syschat'Member ist schon eingetragen.'
- return
- end
- end
- local gs_member = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/authority.txt", "a+")
- gs_member:write(member..'#0#0#0#0\\n')
- gs_member:flush()
- gs_member:close()
- end
- function delete_member(member)
- local members = guildstorage.get_members()
- for i = 1, table.getn(members) do
- if members[i][1] == member then
- table.remove(members,i)
- break
- end
- end
- local gs_member = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
- for i = 1, table.getn(members) do
- gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
- end
- gs_member:flush()
- gs_member:close()
- end
- ----------------------
- --MEMBER & AUTHORITY END
- ----------------------
- ----------------------
- --MONEY START
- ----------------------
- function get_money()
- local gs_money = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/money.txt", "r")
- for line in gs_money:lines() do
- return tonumber(line)
- end
- end
- function change_money(money)
- local old_money = guildstorage.get_money()
- local gs_money = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
- gs_money:write(old_money+money)
- gs_money:flush()
- gs_money:close()
- end
- ----------------------
- --MONEY END
- ----------------------
- ----------------------
- --STORAGE START
- ----------------------
- function has_guildstorage()
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
- if guildstorage == nil then
- return false
- else
- return true
- end
- end
- function give_item(itemTab)
- pc.give_item2_select(itemTab[1],itemTab[2])
- local attr,socket = {},{}
- for i = 10,23 do table.insert(attr,{itemTab[i],itemTab[i+1]}) i = i+1 end
- for i = 4,6 do table.insert(socket,itemTab[i]) end
- for i = 1, table.getn(attr) do
- item.set_value(i-1, attr[i][1], attr[i][2])
- end
- for i = 1, table.getn(socket) do if tonumber(socket[i]) > 0 then item.set_socket(i-1, socket[i]) end end
- game.set_event_flag('GUILDS_USE_'..pc.get_guild(),0)
- end
- function get_slot_item(slot)
- local items = guildstorage.get_items()
- for i = 1, table.getn(items) do
- local item = guildstorage.split_(items[i],"#")
- if tonumber(item[3]) == slot then
- return item
- end
- end
- return 0
- end
- function refresh()
- cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
- local items = guildstorage.get_items()
- if items != 0 then
- for i = 1, table.getn(items) do
- local item = guildstorage.split_(items[i],"#")
- -- chat(table.getn(item))
- cmdchat('GUILDSTORAGE_ADDITEM '..item[3]..' '..item[1]..' '..item[2]..' '..item[4]..' '..item[5]..' '..item[6]..' '..item[7]..' '..item[8]..' '..item[9]..' '..item[10]..' '..item[11]..' '..item[12]..' '..item[13]..' '..item[14]..' '..item[15]..' '..item[16]..' '..item[17]..' '..item[18]..' '..item[19]..' '..item[20]..' '..item[21]..' '..item[22]..' '..item[23])
- end
- end
- cmdchat('GUILDSTORAGE REFRESH')
- end
- function refresh_tempslots()
- cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
- cmdchat('GUILDSTORAGE CLEAR_TEMPSLOTS')
- local items = guildstorage.get_items()
- if items != 0 then
- for i = 1, table.getn(items) do
- local item = guildstorage.split_(items[i],"#")
- cmdchat('GUILDSTORAGE_ADDTEMPSLOT '..item[3]..' '..item[1]..' '..item[2]..' '..item[4]..' '..item[5]..' '..item[6]..' '..item[7]..' '..item[8]..' '..item[9]..' '..item[10]..' '..item[11]..' '..item[12]..' '..item[13]..' '..item[14]..' '..item[15]..' '..item[16]..' '..item[17]..' '..item[18]..' '..item[19]..' '..item[20]..' '..item[21]..' '..item[22]..' '..item[23])
- end
- end
- cmdchat('GUILDSTORAGE COMPARE_TEMPSLOTS')
- end
- function slot_empty(slot)
- local itemList = guildstorage.get_items()
- for i = 1 , table.getn(itemList) do
- local item = guildstorage.split_(itemList[i],"#")
- if tonumber(item[3]) == slot then
- return false
- end
- end
- return true
- end
- function create_guildstorage()
- os.execute("mkdir "..guildstorage_path.."Guildstorage/"..pc.get_guild())
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt", "w+")
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
- guildstorage:write("0")
- guildstorage:close()
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
- guildstorage:close()
- end
- function insert_item(cell,slot,tab)
- chat('Item einlagern!')
- local result = item.select_cell(cell)
- if not result then syschat'Probier es nochmal.' return end
- local itemId1 = item.get_id()
- chat('Einzulagerndes Item '..itemId1)
- local itemVnum1 = item.get_vnum()
- chat('Item Vnum '..itemVnum1)
- item.select_cell(cell)
- chat('cell '..cell)
- chat('item type '..item.attr_type(1))
- chat('item value '..item.attr_value(1))
- chat('item2 '..item2.get_attr(1))
- chat('item3 '..item3.get_attr(1))
- chat('item1 type '..item.get_attr_type(1))
- chat('item1 value '..item.get_attr_value(1))
- local attr = {{item3.get_attr(0)}, {item3.get_attr(1)}, {item3.get_attr(2)}, {item3.get_attr(3)},{item3.get_attr(4)},{item3.get_attr(5)}, {item3.get_attr(6)}}
- chat('attr '..attr)
- local socket, itemCount, itemVnum = {item.get_socket(0), item.get_socket(1), item.get_socket(2),item.get_socket(3),item.get_socket(4),item.get_socket(5)}, item.get_count(),item.get_vnum()
- if itemId1 != item.get_id() or itemVnum1 != itemVnum then syschat'wtf?' return end
- if not guildstorage.item_can_store(itemVnum) then syschat'Dieses Item kann nicht gelagert werden.' return end
- if itemCount > 1 then
- for i = 1, itemCount do
- item.remove()
- item.select_cell(cell)
- end
- elseif itemCount == 1 then
- item.remove()
- else
- chat'Fehler'
- return
- end
- cmdchat('GUILDSTORAGE_ADDITEMSLOT '..slot..' '..tab..' '..itemVnum..' '..itemCount..' '..socket[1]..' '..socket[2]..' '..socket[3]..' '..socket[4]..' '..socket[5]..' '..socket[6]..' '..attr[1][1]..' '..attr[1][2]..' '..attr[2][1]..' '..attr[2][2]..' '..attr[3][1]..' '..attr[3][2]..' '..attr[4][1]..' '..attr[4][2]..' '..attr[5][1]..' '..attr[5][2]..' '..attr[6][1]..' '..attr[6][2]..' '..attr[7][1]..' '..attr[7][2])
- guildstorage.add_log(pc.get_name(),'Item','einlagern',item_name(itemVnum)..' ('..itemCount..')')
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt", "a+")
- syschat(itemVnum.."#"..itemCount.."#"..(slot+120*tab).."#"..socket[1].."#"..socket[2].."#"..socket[3].."#"..socket[4].."#"..socket[5].."#"..socket[6].."#"..attr[1][1].."#"..attr[1][2].."#"..attr[2][1].."#"..attr[2][2].."#"..attr[3][1].."#"..attr[3][2].."#"..attr[4][1].."#"..attr[4][2].."#"..attr[5][1].."#"..attr[5][2].."#"..attr[6][1].."#"..attr[6][2].."#"..attr[7][1].."#"..attr[7][2])
- guildstorage:write(itemVnum.."#"..itemCount.."#"..(slot+120*tab).."#"..socket[1].."#"..socket[2].."#"..socket[3].."#"..socket[4].."#"..socket[5].."#"..socket[6].."#"..attr[1][1].."#"..attr[1][2].."#"..attr[2][1].."#"..attr[2][2].."#"..attr[3][1].."#"..attr[3][2].."#"..attr[4][1].."#"..attr[4][2].."#"..attr[5][1].."#"..attr[5][2].."#"..attr[6][1].."#"..attr[6][2].."#"..attr[7][1].."#"..attr[7][2].."\\n")
- guildstorage:flush()
- guildstorage:close()
- end
- function remove_item(slot)
- game.set_event_flag('GUILDS_USE_'..pc.get_guild(),1)
- local gsPath = guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt"
- local items = {}
- local itemList = guildstorage.get_items()
- if slot > 720 then syschat'Dieser Slot existiert nicht.' return end
- for i = 1 , table.getn(itemList) do
- table.insert(items,guildstorage.split_(itemList[i],"#"))
- end
- for i = 1, table.getn(items) do
- if items[i][3] == tostring(slot) then
- guildstorage.add_log(pc.get_name(),'Item','rausnehmen',item_name(items[i][1])..' ('..items[i][2]..')')
- table.remove(items,i)
- break
- end
- end
- local gs = io.open(gsPath, "w+")
- for i = 1, table.getn(items) do
- gs:write(items[i][1]..'#'..items[i][2]..'#'..items[i][3]..'#'..items[i][4]..'#'..items[i][5]..'#'..items[i][6]..'#'..items[i][7]..'#'..items[i][8]..'#'..items[i][9]..'#'..items[i][10]..'#'..items[i][11]..'#'..items[i][12]..'#'..items[i][13]..'#'..items[i][14]..'#'..items[i][15]..'#'..items[i][16]..'#'..items[i][17]..'#'..items[i][18]..'#'..items[i][19]..'#'..items[i][20]..'#'..items[i][21]..'#'..items[i][22]..'#'..items[i][23]..'\\n')
- end
- gs:flush()
- gs:close()
- end
- function get_items()
- local guildstorageTab = {}
- local guildstorage = io.open(guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
- for item in guildstorage:lines() do
- table.insert(guildstorageTab,item)
- end
- return guildstorageTab or 0
- end
- function move_item(from,to)
- local gsPath = guildstorage_path.."Guildstorage/"..pc.get_guild().."/storage.txt"
- local items = {}
- local itemList = guildstorage.get_items()
- for i = 1 , table.getn(itemList) do
- table.insert(items,guildstorage.split_(itemList[i],"#"))
- end
- for i = 1, table.getn(items) do
- if items[i][3] == tostring(from) then items[i][3] = tostring(to) end
- end
- local gs = io.open(gsPath, "w+")
- for i = 1, table.getn(items) do
- gs:write(items[i][1]..'#'..items[i][2]..'#'..items[i][3]..'#'..items[i][4]..'#'..items[i][5]..'#'..items[i][6]..'#'..items[i][7]..'#'..items[i][8]..'#'..items[i][9]..'#'..items[i][10]..'#'..items[i][11]..'#'..items[i][12]..'#'..items[i][13]..'#'..items[i][14]..'#'..items[i][15]..'#'..items[i][16]..'#'..items[i][17]..'#'..items[i][18]..'#'..items[i][19]..'#'..items[i][20]..'#'..items[i][21]..'#'..items[i][22]..'#'..items[i][23]..'\\n')
- end
- gs:flush()
- gs:close()
- end
- ----------------------
- --STORAGE END
- ----------------------
- function client_command(command_)
- return guildstorage.split_(command_,"#")
- end
- function split_(string_,delimiter)
- local result = { }
- local from = 1
- local delim_from, delim_to = string.find( string_, delimiter, from )
- while delim_from do
- table.insert( result, string.sub( string_, from , delim_from-1 ) )
- from = delim_to + 1
- delim_from, delim_to = string.find( string_, delimiter, from )
- end
- table.insert( result, string.sub( string_, from ) )
- return result
- end
- end
- end
Alles anzeigen
Da ich nicht weiß, ob der Prof. Ente noch aktiv ist, habe ich jetzt erstmal hier den Thread aufgemacht...wenn ihr sagt, da sollte ich mich besser an ihn wenden, weil er noch aktiv ist, dann werde ich das machen.
Ansonsten:
Kann mir hier jemand helfen?