Guest User

Almera2 Gildenlager Fixx

a guest
Oct 24th, 2014
705
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Es gibt 2 Varianten:
  2.  
  3. - eine für die 40k Game ("Source fix")
  4. - eine für alle Games
  5.  
  6.  
  7. Die Source-Variante:
  8.  
  9. Quest:
  10. quest guildstorage begin
  11. state start begin
  12.  
  13. function getinput(c)
  14. cmdchat("GetInputStart")
  15. local ret = input(cmdchat(c))
  16. cmdchat("GetInputStop")
  17. return ret
  18. end
  19.  
  20. function item_can_store(itemvnum)
  21. local antiflags = guildstorage.item_get_real_antiflags(guildstorage.item_antiflag(itemvnum))
  22. for i = 1 , table.getn(antiflags) do
  23. if antiflags[i] == 128 or antiflags[i] == 131072 or antiflags[i] == 8192 or antiflags[i] == 64 then return false end
  24. end
  25. return true
  26. end
  27.  
  28. function item_get_real_antiflags(antiflag_)
  29. antiflags = {131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1}
  30. tab2 = {}
  31. table.foreach(antiflags,function(_,v) if antiflag_ >= v then table.insert(tab2,v) antiflag_ = antiflag_ - v end end)
  32. return tab2
  33. end
  34.  
  35. function item_antiflag(item_vnum)
  36. local result = mysql_query("SELECT antiflag from player.item_proto where vnum = "..item_vnum..";")
  37. return (result[1][1])--pack
  38. end
  39.  
  40. ----------------------
  41. --LOGS START
  42. ----------------------
  43.  
  44. function load_logs()
  45. local logs = {}
  46. local gs_logs = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "r")
  47. for line in gs_logs:lines() do
  48. table.insert(logs,guildstorage.split_(line,"#"))
  49. end
  50. return logs
  51. end
  52.  
  53. function clear_logs()
  54. local gs_log = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
  55. gs_log:flush()
  56. gs_log:close()
  57. end
  58.  
  59. function add_log(name_,type_,do_,desc_)
  60. local gs_log = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "a+")
  61. local date_ = os.date()
  62. date_ = string.gsub(date_," ", "+-+")
  63. desc_ = string.gsub(desc_," ", "+-+")
  64. gs_log:write(name_..'#'..date_..'#'..type_..'#'..do_..'#'..desc_..'\\n')
  65. gs_log:flush()
  66. gs_log:close()
  67. end
  68.  
  69. ----------------------
  70. --LOGS END
  71. ----------------------
  72.  
  73. ----------------------
  74. --MEMBER & AUTHORITY START
  75. ----------------------
  76. -- Auth 0 = einlagern
  77. -- Auth 1 = rausnehmen
  78. -- Auth 2 = einzahlen
  79. -- Auth 3 = auszahlen
  80.  
  81. function get_members()
  82. local members = {}
  83. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "r")
  84. for line in gs_member:lines() do
  85. table.insert(members,guildstorage.split_(line,"#"))
  86. end
  87. return members
  88. end
  89.  
  90. function get_authority(authID)
  91. if pc.is_guild_master() then return true end
  92. local members = guildstorage.get_members()
  93. for i = 1, table.getn(members) do
  94. if members[i][1] == pc.get_name() then
  95. if tonumber(members[i][authID+2]) == 0 then return false else return true end
  96. end
  97. end
  98. return false
  99. end
  100.  
  101. function set_authority(member,authID,auth)
  102. local members = guildstorage.get_members()
  103.  
  104. for i = 1, table.getn(members) do
  105. if members[i][1] == member then
  106. members[i][authID+2] = auth
  107. break
  108. end
  109. end
  110.  
  111. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  112.  
  113. for i = 1, table.getn(members) do
  114. gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
  115. end
  116. gs_member:flush()
  117. gs_member:close()
  118. end
  119.  
  120. function add_member(member)
  121. local members = guildstorage.get_members()
  122.  
  123. for i = 1, table.getn(members) do
  124. if members[i][1] == member then
  125. syschat'Member ist schon eingetragen.'
  126. return
  127. end
  128. end
  129.  
  130. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "a+")
  131. gs_member:write(member..'#0#0#0#0\\n')
  132. gs_member:flush()
  133. gs_member:close()
  134. end
  135.  
  136. function delete_member(member)
  137. local members = guildstorage.get_members()
  138.  
  139. for i = 1, table.getn(members) do
  140. if members[i][1] == member then
  141. table.remove(members,i)
  142. break
  143. end
  144. end
  145.  
  146. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  147.  
  148. for i = 1, table.getn(members) do
  149. gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
  150. end
  151. gs_member:flush()
  152. gs_member:close()
  153. end
  154.  
  155. ----------------------
  156. --MEMBER & AUTHORITY END
  157. ----------------------
  158.  
  159. ----------------------
  160. --MONEY START
  161. ----------------------
  162. function get_money()
  163. local gs_money = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "r")
  164. for line in gs_money:lines() do
  165. return tonumber(line)
  166. end
  167. end
  168.  
  169. function change_money(money)
  170. local old_money = guildstorage.get_money()
  171. local gs_money = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
  172.  
  173. gs_money:write(old_money+money)
  174. gs_money:flush()
  175. gs_money:close()
  176. end
  177.  
  178. ----------------------
  179. --MONEY END
  180. ----------------------
  181.  
  182. ----------------------
  183. --STORAGE START
  184. ----------------------
  185.  
  186. function has_guildstorage()
  187. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
  188. if guildstorage == nil then
  189. return false
  190. else
  191. return true
  192. end
  193. end
  194.  
  195. function give_item(itemTab)
  196. pc.give_item2_select(itemTab[1],itemTab[2])
  197. local attr,socket = {},{}
  198. for i = 10,23 do table.insert(attr,{itemTab[i],itemTab[i+1]}) i = i+1 end
  199. for i = 4,6 do table.insert(socket,itemTab[i]) end
  200. for i = 1, table.getn(attr) do
  201. item.set_attr(i-1, attr[i][1], attr[i][2])
  202. end
  203. for i = 1, table.getn(socket) do if tonumber(socket[i]) > 0 then item.set_socket(i-1, socket[i]) end end
  204. end
  205.  
  206. function get_slot_item(slot)
  207. local items = guildstorage.get_items()
  208. for i = 1, table.getn(items) do
  209. local item = guildstorage.split_(items[i],"#")
  210. if tonumber(item[3]) == slot then
  211. return item
  212. end
  213. end
  214. return 0
  215. end
  216.  
  217. function refresh()
  218. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
  219. local items = guildstorage.get_items()
  220. if items != 0 then
  221. for i = 1, table.getn(items) do
  222. local item = guildstorage.split_(items[i],"#")
  223. -- chat(table.getn(item))
  224. 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])
  225. end
  226. end
  227. cmdchat('GUILDSTORAGE REFRESH')
  228. end
  229.  
  230. function refresh_tempslots()
  231. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
  232. cmdchat('GUILDSTORAGE CLEAR_TEMPSLOTS')
  233. local items = guildstorage.get_items()
  234. if items != 0 then
  235. for i = 1, table.getn(items) do
  236. local item = guildstorage.split_(items[i],"#")
  237. 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])
  238. end
  239. end
  240. cmdchat('GUILDSTORAGE COMPARE_TEMPSLOTS')
  241. end
  242.  
  243. function slot_empty(slot)
  244. local itemList = guildstorage.get_items()
  245.  
  246. for i = 1 , table.getn(itemList) do
  247. local item = guildstorage.split_(itemList[i],"#")
  248. if tonumber(item[3]) == slot then
  249. return false
  250. end
  251. end
  252. return true
  253. end
  254.  
  255. function create_guildstorage()
  256. os.execute("mkdir ".."/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild())
  257. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "w+")
  258. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
  259. guildstorage:write("0")
  260. guildstorage:close()
  261. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  262. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
  263.  
  264. guildstorage:close()
  265. end
  266.  
  267. function insert_item(cell,slot,tab)
  268. item.select_cell(cell)
  269. local attr = {{item.attr_type(0),item.attr_value(0)}, {item.attr_type(1),item.attr_value(1)}, {item.attr_type(2),item.attr_value(2)}, {item.attr_type(3),item.attr_value(3)},{item.attr_type(4),item.attr_value(4)},{item.attr_type(5),item.attr_value(5)},{item.attr_type(6),item.attr_value(6)}}
  270. local socket, itemVnum, itemCount = {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_vnum(), item.get_count()
  271. if not guildstorage.item_can_store(itemVnum) then syschat'Dieses Item kann nicht gelagert werden.' return end
  272. guildstorage.add_log(pc.get_name(),'Item','einlagern',item_name(itemVnum)..' ('..itemCount..')')
  273. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "a+")
  274. item.select(cell)
  275. if item.vnum == 0 then return end
  276. if item.rem(item.get_count()) then
  277. 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")
  278. guildstorage:flush()
  279. guildstorage:close()
  280. 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])
  281. else
  282. syschat("Du hast das Item nicht mehr")
  283. end
  284. end
  285.  
  286. function remove_item(slot)
  287. local gsPath = "/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt"
  288. local items = {}
  289. local itemList = guildstorage.get_items()
  290.  
  291. for i = 1 , table.getn(itemList) do
  292. table.insert(items,guildstorage.split_(itemList[i],"#"))
  293. end
  294.  
  295. for i = 1, table.getn(items) do
  296. if items[i][3] == tostring(slot) then
  297. guildstorage.add_log(pc.get_name(),'Item','rausnehmen',item_name(items[i][1])..' ('..items[i][2]..')')
  298. table.remove(items,i)
  299. break
  300. end
  301. end
  302. local gs = io.open(gsPath, "w+")
  303. for i = 1, table.getn(items) do
  304. 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')
  305. end
  306. gs:flush()
  307. gs:close()
  308. end
  309.  
  310. function get_items()
  311. local guildstorageTab = {}
  312. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
  313. for item in guildstorage:lines() do
  314. table.insert(guildstorageTab,item)
  315. end
  316. return guildstorageTab or 0
  317. end
  318.  
  319. function move_item(from,to)
  320. local gsPath = "/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt"
  321.  
  322. local items = {}
  323. local itemList = guildstorage.get_items()
  324.  
  325. for i = 1 , table.getn(itemList) do
  326. table.insert(items,guildstorage.split_(itemList[i],"#"))
  327. end
  328.  
  329. for i = 1, table.getn(items) do
  330. if items[i][3] == tostring(from) then items[i][3] = tostring(to) end
  331. end
  332. local gs = io.open(gsPath, "w+")
  333. for i = 1, table.getn(items) do
  334. 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')
  335. end
  336. gs:flush()
  337. gs:close()
  338. end
  339.  
  340. ----------------------
  341. --STORAGE END
  342. ----------------------
  343.  
  344. function client_command(command_)
  345. return guildstorage.split_(command_,"#")
  346. end
  347.  
  348. function split_(string_,delimiter)
  349. local result = { }
  350. local from = 1
  351. local delim_from, delim_to = string.find( string_, delimiter, from )
  352. while delim_from do
  353. table.insert( result, string.sub( string_, from , delim_from-1 ) )
  354. from = delim_to + 1
  355. delim_from, delim_to = string.find( string_, delimiter, from )
  356. end
  357. table.insert( result, string.sub( string_, from ) )
  358. return result
  359. end
  360.  
  361.  
  362. when login begin
  363. cmdchat("GUILDSTORAGE QID/"..q.getcurrentquestindex())
  364. end
  365. when 70028.use begin
  366. cmdchat("GetInputStop")
  367. end
  368. when 20095.chat."Gildenlager" begin
  369. if not pc.has_guild() then syschat'Du benoetigst eine Gilde um das Gildenlager benutzen zu koennen.' setskin(NOWINDOW) return end
  370. if not guildstorage.has_guildstorage() then guildstorage.create_guildstorage() end
  371. -- chat("PENIS")
  372. if pc.is_guild_master() then
  373. cmdchat('GUILDSTORAGE OPEN/1')
  374. else
  375. cmdchat('GUILDSTORAGE OPEN/0')
  376. end
  377.  
  378. -- chat("2")--pack reload mein ich xD wo ist mein chat du judenkind frag das die quest nicht mich
  379. guildstorage.refresh()
  380. pc.setqf("GUILDSTORAGE",1)
  381. setskin(NOWINDOW)
  382. -- say("TEST")
  383. --ka ob das am setskin liegt, ich nutze das nie hm...
  384. end
  385.  
  386. when button begin
  387. local cmd = guildstorage.client_command(guildstorage.getinput("GUILDSTORAGE QUESTCMD"))
  388. -- [ITEM]
  389. --chat(cmd)
  390. --bist in ner gilde? xD erst auf unserem server testen haben das doch auch danach da sonst müsste ich leveln xDok xD
  391. if cmd[1] == 'TAKE_ITEM' then
  392. if not guildstorage.get_authority(1) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  393. if pc.get_empty_inventory_count() < 3 then syschat'Du hast nicht genug Platz im Inventar, du brauchst mindestens drei freie Plaetze' return end
  394. local slot = tonumber(cmd[2])+120*tonumber(cmd[3])
  395. local item = guildstorage.get_slot_item(slot)
  396. if guildstorage.slot_empty(slot) then syschat'Dieses Item befindet sich an einer anderen Position, oder wurde schon rausgenommen' return end
  397. guildstorage.remove_item(slot)
  398. guildstorage.give_item(item)
  399. elseif cmd[1] == 'MOVE_ITEM' then
  400. if not guildstorage.get_authority(0) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  401. --possible to store the item? antiflag/flag
  402.  
  403. if cmd[2] == 'INVENTORY' then
  404. if not guildstorage.slot_empty(tonumber(cmd[4])+120*tonumber(cmd[5])) then syschat'Dieser Slot ist bereits belegt.' return end
  405. guildstorage.insert_item(tonumber(cmd[3]),tonumber(cmd[4]),tonumber(cmd[5]))
  406. elseif cmd[2] == 'GUILDSTORAGE' then
  407. 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
  408. guildstorage.move_item(tonumber(cmd[3])+120*tonumber(cmd[4]),tonumber(cmd[5])+120*tonumber(cmd[6]))
  409. end
  410. -- [MONEY]
  411. elseif cmd[1] == 'TAKE_MONEY' then
  412. if not guildstorage.get_authority(3) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  413. local old_money = guildstorage.get_money()
  414. if old_money < tonumber(cmd[2]) then syschat'Soviel Yang ist nicht im Gildenlager.' return end
  415. local new_money = tonumber(cmd[2])
  416. if new_money+pc.get_money() >= 1999999999 then syschat'Du kannst nicht mehr wie 2.000.000.000 Yang bei dir haben.' return end
  417. guildstorage.change_money(-new_money)
  418. pc.change_money(new_money)
  419. guildstorage.add_log(pc.get_name(),'Yang','abheben',new_money)
  420. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money-new_money))
  421. elseif cmd[1] == 'GIVE_MONEY' then
  422. if not guildstorage.get_authority(2) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  423. local old_money = guildstorage.get_money()
  424. local new_money = tonumber(cmd[2])
  425. if new_money > pc.get_money() then syschat'Soviel Yang besitzt du nicht' return end
  426. pc.change_money(-new_money)
  427. guildstorage.change_money(new_money)
  428. guildstorage.add_log(pc.get_name(),'Yang','einzahlen',new_money)
  429. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money+new_money))
  430. elseif cmd[1] == 'GETGUILDSTORAGEMONEY' then
  431. cmdchat('GUILDSTORAGE REFRESH_GUILDWINDOW_MONEY/'..guildstorage.get_money())
  432. -- [MEMBER]
  433. elseif cmd[1] == 'ADD_MEMBER' then
  434. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  435. local members = guildstorage.get_members()
  436. if table.getn(members) >= 12 then syschat'Du kannst maximal nur 12 Member eintragen.' return end
  437. guildstorage.add_member(cmd[2])
  438. cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
  439. elseif cmd[1] == 'DELETE_MEMBER' then
  440. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  441. guildstorage.delete_member(cmd[2])
  442. cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
  443. elseif cmd[1] == 'AUTHORITY' then
  444. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  445. guildstorage.set_authority(cmd[2],tonumber(cmd[3]),cmd[4])
  446. elseif cmd[1] == 'GETMEMBERLIST' then
  447. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  448. local members = guildstorage.get_members()
  449. for i = 1, table.getn(members) do
  450. -- id, membername, authority 1-4
  451. cmdchat('GUILDSTORAGE_ADDMEMBER '..(i-1)..' '..members[i][1]..' '..members[i][2]..' '..members[i][3]..' '..members[i][4]..' '..members[i][5])
  452. end
  453. cmdchat('GUILDSTORAGE REFRESH_MEMBERS')
  454. elseif cmd[1] == 'UPDATE' then
  455. guildstorage.refresh_tempslots()
  456. elseif cmd[1] == 'LOAD_LOGS' then
  457. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  458. local logs = guildstorage.load_logs()
  459. local logsLen = table.getn(logs)
  460. for i = 0, logsLen-1 do
  461. local var = (logsLen-i)
  462. cmdchat('GUILDSTORAGE_ADDLOG '..(var-1)..' '..logs[var][1]..' '..logs[var][2]..' '..logs[var][3]..' '..logs[var][4]..' '..logs[var][5])
  463. end
  464. elseif cmd[1] == 'DELETE_LOGS' then
  465. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  466. guildstorage.clear_logs()
  467.  
  468. elseif cmd[1] == 'BUTTON' then
  469. if cmd[2] == "0" then
  470. setskin(NOWINDOW)
  471. game.open_mall()
  472. elseif cmd[2] == "1" then
  473. setskin(NOWINDOW)
  474. game.open_safebox()
  475. elseif cmd[2] == "2" then
  476. if not pc.has_guild() then syschat'Du benoetigst eine Gilde um das Gildenlager benutzen zu koennen.' setskin(NOWINDOW) return end
  477. if not guildstorage.has_guildstorage() then guildstorage.create_guildstorage() end
  478.  
  479. if pc.is_guild_master() then
  480. cmdchat('GUILDSTORAGE OPEN/1')
  481. else
  482. cmdchat('GUILDSTORAGE OPEN/0')
  483. end
  484.  
  485. guildstorage.refresh()
  486. pc.setqf("GUILDSTORAGE",1)
  487. setskin(NOWINDOW)
  488. end
  489. end
  490. cmdchat("Finish banane")--pack
  491. end
  492.  
  493.  
  494.  
  495. end
  496. end
  497.  
  498.  
  499.  
  500.  
  501.  
  502. Die remove Funktion (in die questlua_item.cpp packen):
  503.  
  504.  
  505. int item_rem(lua_State* L)
  506. {
  507. LPITEM item = CQuestManager::instance().GetCurrentItem();
  508.  
  509. if(!item || CQuestManager::instance().GetCurrentCharacterPtr() != item->GetOwner())
  510. {
  511. lua_pushboolean(L, 0);
  512. return 0;
  513. }
  514.  
  515. int count = (int)lua_tonumber(L, 1);
  516.  
  517. item->SetCount(item->GetCount() - count);
  518. lua_pushboolean(L, 1);
  519.  
  520. return 1;
  521. }
  522.  
  523.  
  524.  
  525. Die Quest-Variante:
  526.  
  527.  
  528. quest guildstorage begin
  529. state start begin
  530.  
  531. function getinput(c)
  532. cmdchat("GetInputStart")
  533. local ret = input(cmdchat(c))
  534. cmdchat("GetInputStop")
  535. return ret
  536. end
  537.  
  538. function item_can_store(itemvnum)
  539. local antiflags = guildstorage.item_get_real_antiflags(guildstorage.item_antiflag(itemvnum))
  540. for i = 1 , table.getn(antiflags) do
  541. if antiflags[i] == 128 or antiflags[i] == 131072 or antiflags[i] == 8192 or antiflags[i] == 64 then return false end
  542. end
  543. return true
  544. end
  545.  
  546. function item_get_real_antiflags(antiflag_)
  547. antiflags = {131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1}
  548. tab2 = {}
  549. table.foreach(antiflags,function(_,v) if antiflag_ >= v then table.insert(tab2,v) antiflag_ = antiflag_ - v end end)
  550. return tab2
  551. end
  552.  
  553. function item_antiflag(item_vnum)
  554. local result = mysql_query("SELECT antiflag from player.item_proto where vnum = "..item_vnum..";")
  555. return (result[1][1])--pack
  556. end
  557.  
  558. ----------------------
  559. --LOGS START
  560. ----------------------
  561.  
  562. function load_logs()
  563. local logs = {}
  564. local gs_logs = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "r")
  565. for line in gs_logs:lines() do
  566. table.insert(logs,guildstorage.split_(line,"#"))
  567. end
  568. return logs
  569. end
  570.  
  571. function clear_logs()
  572. local gs_log = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
  573. gs_log:flush()
  574. gs_log:close()
  575. end
  576.  
  577. function add_log(name_,type_,do_,desc_)
  578. local gs_log = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "a+")
  579. local date_ = os.date()
  580. date_ = string.gsub(date_," ", "+-+")
  581. desc_ = string.gsub(desc_," ", "+-+")
  582. gs_log:write(name_..'#'..date_..'#'..type_..'#'..do_..'#'..desc_..'\\n')
  583. gs_log:flush()
  584. gs_log:close()
  585. end
  586.  
  587. ----------------------
  588. --LOGS END
  589. ----------------------
  590.  
  591. ----------------------
  592. --MEMBER & AUTHORITY START
  593. ----------------------
  594. -- Auth 0 = einlagern
  595. -- Auth 1 = rausnehmen
  596. -- Auth 2 = einzahlen
  597. -- Auth 3 = auszahlen
  598.  
  599. function get_members()
  600. local members = {}
  601. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "r")
  602. for line in gs_member:lines() do
  603. table.insert(members,guildstorage.split_(line,"#"))
  604. end
  605. return members
  606. end
  607.  
  608. function get_authority(authID)
  609. if pc.is_guild_master() then return true end
  610. local members = guildstorage.get_members()
  611. for i = 1, table.getn(members) do
  612. if members[i][1] == pc.get_name() then
  613. if tonumber(members[i][authID+2]) == 0 then return false else return true end
  614. end
  615. end
  616. return false
  617. end
  618.  
  619. function set_authority(member,authID,auth)
  620. local members = guildstorage.get_members()
  621.  
  622. for i = 1, table.getn(members) do
  623. if members[i][1] == member then
  624. members[i][authID+2] = auth
  625. break
  626. end
  627. end
  628.  
  629. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  630.  
  631. for i = 1, table.getn(members) do
  632. gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
  633. end
  634. gs_member:flush()
  635. gs_member:close()
  636. end
  637.  
  638. function add_member(member)
  639. local members = guildstorage.get_members()
  640.  
  641. for i = 1, table.getn(members) do
  642. if members[i][1] == member then
  643. syschat'Member ist schon eingetragen.'
  644. return
  645. end
  646. end
  647.  
  648. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "a+")
  649. gs_member:write(member..'#0#0#0#0\\n')
  650. gs_member:flush()
  651. gs_member:close()
  652. end
  653.  
  654. function delete_member(member)
  655. local members = guildstorage.get_members()
  656.  
  657. for i = 1, table.getn(members) do
  658. if members[i][1] == member then
  659. table.remove(members,i)
  660. break
  661. end
  662. end
  663.  
  664. local gs_member = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  665.  
  666. for i = 1, table.getn(members) do
  667. gs_member:write(members[i][1]..'#'..members[i][2]..'#'..members[i][3]..'#'..members[i][4]..'#'..members[i][5]..'\\n')
  668. end
  669. gs_member:flush()
  670. gs_member:close()
  671. end
  672.  
  673. ----------------------
  674. --MEMBER & AUTHORITY END
  675. ----------------------
  676.  
  677. ----------------------
  678. --MONEY START
  679. ----------------------
  680. function get_money()
  681. local gs_money = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "r")
  682. for line in gs_money:lines() do
  683. return tonumber(line)
  684. end
  685. end
  686.  
  687. function change_money(money)
  688. local old_money = guildstorage.get_money()
  689. local gs_money = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
  690.  
  691. gs_money:write(old_money+money)
  692. gs_money:flush()
  693. gs_money:close()
  694. end
  695.  
  696. ----------------------
  697. --MONEY END
  698. ----------------------
  699.  
  700. ----------------------
  701. --STORAGE START
  702. ----------------------
  703.  
  704. function has_guildstorage()
  705. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
  706. if guildstorage == nil then
  707. return false
  708. else
  709. return true
  710. end
  711. end
  712.  
  713. function give_item(itemTab)
  714. pc.give_item2_select(itemTab[1],itemTab[2])
  715. local attr,socket = {},{}
  716. for i = 10,23 do table.insert(attr,{itemTab[i],itemTab[i+1]}) i = i+1 end
  717. for i = 4,6 do table.insert(socket,itemTab[i]) end
  718. for i = 1, table.getn(attr) do
  719. item.set_attr(i-1, attr[i][1], attr[i][2])
  720. end
  721. for i = 1, table.getn(socket) do if tonumber(socket[i]) > 0 then item.set_socket(i-1, socket[i]) end end
  722. end
  723.  
  724. function get_slot_item(slot)
  725. local items = guildstorage.get_items()
  726. for i = 1, table.getn(items) do
  727. local item = guildstorage.split_(items[i],"#")
  728. if tonumber(item[3]) == slot then
  729. return item
  730. end
  731. end
  732. return 0
  733. end
  734.  
  735. function refresh()
  736. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
  737. local items = guildstorage.get_items()
  738. if items != 0 then
  739. for i = 1, table.getn(items) do
  740. local item = guildstorage.split_(items[i],"#")
  741. -- chat(table.getn(item))
  742. 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])
  743. end
  744. end
  745. cmdchat('GUILDSTORAGE REFRESH')
  746. end
  747.  
  748. function refresh_tempslots()
  749. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..guildstorage.get_money())
  750. cmdchat('GUILDSTORAGE CLEAR_TEMPSLOTS')
  751. local items = guildstorage.get_items()
  752. if items != 0 then
  753. for i = 1, table.getn(items) do
  754. local item = guildstorage.split_(items[i],"#")
  755. 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])
  756. end
  757. end
  758. cmdchat('GUILDSTORAGE COMPARE_TEMPSLOTS')
  759. end
  760.  
  761. function slot_empty(slot)
  762. local itemList = guildstorage.get_items()
  763.  
  764. for i = 1 , table.getn(itemList) do
  765. local item = guildstorage.split_(itemList[i],"#")
  766. if tonumber(item[3]) == slot then
  767. return false
  768. end
  769. end
  770. return true
  771. end
  772.  
  773. function create_guildstorage()
  774. os.execute("mkdir ".."/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild())
  775. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "w+")
  776. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/money.txt", "w+")
  777. guildstorage:write("0")
  778. guildstorage:close()
  779. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/authority.txt", "w+")
  780. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/logs.txt", "w+")
  781.  
  782. guildstorage:close()
  783. end
  784.  
  785. function insert_item(cell,slot,tab)
  786. item.select_cell(cell)
  787. local attr = {{item.attr_type(0),item.attr_value(0)}, {item.attr_type(1),item.attr_value(1)}, {item.attr_type(2),item.attr_value(2)}, {item.attr_type(3),item.attr_value(3)},{item.attr_type(4),item.attr_value(4)},{item.attr_type(5),item.attr_value(5)},{item.attr_type(6),item.attr_value(6)}}
  788. local socket, itemVnum, itemCount = {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_vnum(), item.get_count()
  789. if not guildstorage.item_can_store(itemVnum) then syschat'Dieses Item kann nicht gelagert werden.' return end
  790. guildstorage.add_log(pc.get_name(),'Item','einlagern',item_name(itemVnum)..' ('..itemCount..')')
  791. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "a+")
  792. if not pc.can_warp() then return end
  793. item.select(cell)
  794. if item.vnum == 0 then return end
  795. --if item.rem(item.get_count()) then
  796. item.remove()
  797. 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")
  798. guildstorage:flush()
  799. guildstorage:close()
  800. 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])
  801. --else
  802. --syschat("Du hast das Item nicht mehr")
  803. --end
  804. end
  805.  
  806. function remove_item(slot)
  807. local gsPath = "/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt"
  808. local items = {}
  809. local itemList = guildstorage.get_items()
  810.  
  811. for i = 1 , table.getn(itemList) do
  812. table.insert(items,guildstorage.split_(itemList[i],"#"))
  813. end
  814.  
  815. for i = 1, table.getn(items) do
  816. if items[i][3] == tostring(slot) then
  817. guildstorage.add_log(pc.get_name(),'Item','rausnehmen',item_name(items[i][1])..' ('..items[i][2]..')')
  818. table.remove(items,i)
  819. break
  820. end
  821. end
  822. local gs = io.open(gsPath, "w+")
  823. for i = 1, table.getn(items) do
  824. 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')
  825. end
  826. gs:flush()
  827. gs:close()
  828. end
  829.  
  830. function get_items()
  831. local guildstorageTab = {}
  832. local guildstorage = io.open("/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt", "r")
  833. for item in guildstorage:lines() do
  834. table.insert(guildstorageTab,item)
  835. end
  836. return guildstorageTab or 0
  837. end
  838.  
  839. function move_item(from,to)
  840. local gsPath = "/usr/home/game/share/locale/singapore/quest/Guildstorage/".."Guildstorage/"..pc.get_guild().."/storage.txt"
  841.  
  842. local items = {}
  843. local itemList = guildstorage.get_items()
  844.  
  845. for i = 1 , table.getn(itemList) do
  846. table.insert(items,guildstorage.split_(itemList[i],"#"))
  847. end
  848.  
  849. for i = 1, table.getn(items) do
  850. if items[i][3] == tostring(from) then items[i][3] = tostring(to) end
  851. end
  852. local gs = io.open(gsPath, "w+")
  853. for i = 1, table.getn(items) do
  854. 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')
  855. end
  856. gs:flush()
  857. gs:close()
  858. end
  859.  
  860. ----------------------
  861. --STORAGE END
  862. ----------------------
  863.  
  864. function client_command(command_)
  865. return guildstorage.split_(command_,"#")
  866. end
  867.  
  868. function split_(string_,delimiter)
  869. local result = { }
  870. local from = 1
  871. local delim_from, delim_to = string.find( string_, delimiter, from )
  872. while delim_from do
  873. table.insert( result, string.sub( string_, from , delim_from-1 ) )
  874. from = delim_to + 1
  875. delim_from, delim_to = string.find( string_, delimiter, from )
  876. end
  877. table.insert( result, string.sub( string_, from ) )
  878. return result
  879. end
  880.  
  881.  
  882. when login begin
  883. cmdchat("GUILDSTORAGE QID/"..q.getcurrentquestindex())
  884. end
  885. when 70028.use begin
  886. cmdchat("GetInputStop")
  887. end
  888. when 20095.chat."Gildenlager" begin
  889. if not pc.has_guild() then syschat'Du benoetigst eine Gilde um das Gildenlager benutzen zu koennen.' setskin(NOWINDOW) return end
  890. if not guildstorage.has_guildstorage() then guildstorage.create_guildstorage() end
  891. -- chat("PENIS")
  892. if pc.is_guild_master() then
  893. cmdchat('GUILDSTORAGE OPEN/1')
  894. else
  895. cmdchat('GUILDSTORAGE OPEN/0')
  896. end
  897.  
  898. -- chat("2")--pack reload mein ich xD wo ist mein chat du judenkind frag das die quest nicht mich
  899. guildstorage.refresh()
  900. pc.setqf("GUILDSTORAGE",1)
  901. setskin(NOWINDOW)
  902. -- say("TEST")
  903. --ka ob das am setskin liegt, ich nutze das nie hm...
  904. end
  905.  
  906. when button begin
  907. local cmd = guildstorage.client_command(guildstorage.getinput("GUILDSTORAGE QUESTCMD"))
  908. -- [ITEM]
  909. --chat(cmd)
  910. --bist in ner gilde? xD erst auf unserem server testen haben das doch auch danach da sonst müsste ich leveln xDok xD
  911. if cmd[1] == 'TAKE_ITEM' then
  912. if not guildstorage.get_authority(1) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  913. if pc.get_empty_inventory_count() < 3 then syschat'Du hast nicht genug Platz im Inventar, du brauchst mindestens drei freie Plaetze' return end
  914. local slot = tonumber(cmd[2])+120*tonumber(cmd[3])
  915. local item = guildstorage.get_slot_item(slot)
  916. if guildstorage.slot_empty(slot) then syschat'Dieses Item befindet sich an einer anderen Position, oder wurde schon rausgenommen' return end
  917. guildstorage.remove_item(slot)
  918. guildstorage.give_item(item)
  919. elseif cmd[1] == 'MOVE_ITEM' then
  920. if not guildstorage.get_authority(0) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  921. --possible to store the item? antiflag/flag
  922.  
  923. if cmd[2] == 'INVENTORY' then
  924. if not guildstorage.slot_empty(tonumber(cmd[4])+120*tonumber(cmd[5])) then syschat'Dieser Slot ist bereits belegt.' return end
  925. guildstorage.insert_item(tonumber(cmd[3]),tonumber(cmd[4]),tonumber(cmd[5]))
  926. elseif cmd[2] == 'GUILDSTORAGE' then
  927. 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
  928. guildstorage.move_item(tonumber(cmd[3])+120*tonumber(cmd[4]),tonumber(cmd[5])+120*tonumber(cmd[6]))
  929. end
  930. -- [MONEY]
  931. elseif cmd[1] == 'TAKE_MONEY' then
  932. if not guildstorage.get_authority(3) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  933. local old_money = guildstorage.get_money()
  934. if old_money < tonumber(cmd[2]) then syschat'Soviel Yang ist nicht im Gildenlager.' return end
  935. local new_money = tonumber(cmd[2])
  936. if new_money+pc.get_money() >= 1999999999 then syschat'Du kannst nicht mehr wie 2.000.000.000 Yang bei dir haben.' return end
  937. guildstorage.change_money(-new_money)
  938. pc.change_money(new_money)
  939. guildstorage.add_log(pc.get_name(),'Yang','abheben',new_money)
  940. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money-new_money))
  941. elseif cmd[1] == 'GIVE_MONEY' then
  942. if not guildstorage.get_authority(2) then syschat'Du besitzt keine Berechtigung hierfuer.' return end
  943. local old_money = guildstorage.get_money()
  944. local new_money = tonumber(cmd[2])
  945. if new_money > pc.get_money() then syschat'Soviel Yang besitzt du nicht' return end
  946. pc.change_money(-new_money)
  947. guildstorage.change_money(new_money)
  948. guildstorage.add_log(pc.get_name(),'Yang','einzahlen',new_money)
  949. cmdchat('GUILDSTORAGE REFRESH_MONEY/'..(old_money+new_money))
  950. elseif cmd[1] == 'GETGUILDSTORAGEMONEY' then
  951. cmdchat('GUILDSTORAGE REFRESH_GUILDWINDOW_MONEY/'..guildstorage.get_money())
  952. -- [MEMBER]
  953. elseif cmd[1] == 'ADD_MEMBER' then
  954. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  955. local members = guildstorage.get_members()
  956. if table.getn(members) >= 12 then syschat'Du kannst maximal nur 12 Member eintragen.' return end
  957. guildstorage.add_member(cmd[2])
  958. cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
  959. elseif cmd[1] == 'DELETE_MEMBER' then
  960. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  961. guildstorage.delete_member(cmd[2])
  962. cmdchat('GUILDSTORAGE MEMBER_COMPLETE')
  963. elseif cmd[1] == 'AUTHORITY' then
  964. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  965. guildstorage.set_authority(cmd[2],tonumber(cmd[3]),cmd[4])
  966. elseif cmd[1] == 'GETMEMBERLIST' then
  967. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  968. local members = guildstorage.get_members()
  969. for i = 1, table.getn(members) do
  970. -- id, membername, authority 1-4
  971. cmdchat('GUILDSTORAGE_ADDMEMBER '..(i-1)..' '..members[i][1]..' '..members[i][2]..' '..members[i][3]..' '..members[i][4]..' '..members[i][5])
  972. end
  973. cmdchat('GUILDSTORAGE REFRESH_MEMBERS')
  974. elseif cmd[1] == 'UPDATE' then
  975. guildstorage.refresh_tempslots()
  976. elseif cmd[1] == 'LOAD_LOGS' then
  977. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  978. local logs = guildstorage.load_logs()
  979. local logsLen = table.getn(logs)
  980. for i = 0, logsLen-1 do
  981. local var = (logsLen-i)
  982. cmdchat('GUILDSTORAGE_ADDLOG '..(var-1)..' '..logs[var][1]..' '..logs[var][2]..' '..logs[var][3]..' '..logs[var][4]..' '..logs[var][5])
  983. end
  984. elseif cmd[1] == 'DELETE_LOGS' then
  985. if not pc.is_guild_master() then syschat'Cheese. ;p' return end
  986. guildstorage.clear_logs()
  987.  
  988. elseif cmd[1] == 'BUTTON' then
  989. if cmd[2] == "0" then
  990. setskin(NOWINDOW)
  991. game.open_mall()
  992. elseif cmd[2] == "1" then
  993. setskin(NOWINDOW)
  994. game.open_safebox()
  995. elseif cmd[2] == "2" then
  996. if not pc.has_guild() then syschat'Du benoetigst eine Gilde um das Gildenlager benutzen zu koennen.' setskin(NOWINDOW) return end
  997. if not guildstorage.has_guildstorage() then guildstorage.create_guildstorage() end
  998.  
  999. if pc.is_guild_master() then
  1000. cmdchat('GUILDSTORAGE OPEN/1')
  1001. else
  1002. cmdchat('GUILDSTORAGE OPEN/0')
  1003. end
  1004.  
  1005. guildstorage.refresh()
  1006. pc.setqf("GUILDSTORAGE",1)
  1007. setskin(NOWINDOW)
  1008. end
  1009. end
  1010. cmdchat("Finish banane")--pack
  1011. end
  1012.  
  1013.  
  1014.  
  1015. end
  1016. end
RAW Paste Data