Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. function bankItems(viewer:text,account:text="<none>",page:integer=0,search:text="all"):
  2. set {_viewer} to {_viewer} parsed as player
  3. if {_account} is "<none>":
  4. set {_account} to {_viewer}
  5. else:
  6. set {_account} to {_account} parsed as offline player
  7. set {_loop} to 0
  8. set {_all_pages} to 0
  9. set {_next_page} to {_page} + 1
  10. delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_next_page}%::*}
  11. delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::*}
  12. loop {sql_bank-items::%{uuid::%{_account}%}%::*}:
  13. delete {_lore::*}
  14. delete {_lore}
  15. if {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item} is not set:
  16. delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%}
  17. delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::*}
  18. continue
  19. if {_search} is not "all":
  20. name of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item} does not contain "%{_search}%"
  21. set {_lore::*} to lore of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}
  22. set {_lore} to ""
  23. loop {_lore::*}:
  24. set {_lore} to "%{_lore}% %loop-value-2%"
  25. replace all ", " and " and " with "" in {_lore::*}
  26. {_lore} does not contain "%{_search}%"
  27. "%{sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}%" does not contain "%{_search}%"
  28. set {_enchantments} to "%enchantments of {sql_bank-items::%{uuid::%{_account}%}%::%loop-index%::item}%"
  29. replace all ", " and " and " with " " in {_enchantments}
  30. {_enchantments} does not contain "%{_search}%"
  31. continue
  32. set {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::%{_loop}%} to loop-index
  33. add 1 to {_loop}
  34. if {_loop} is greater than 44:
  35. set {_loop} to 0
  36. add 1 to {_all_pages}
  37. delete {x-bankwithdraw::%{uuid::%{_account}%}%::%{_all_pages}%::*}
  38. if {_search} is "all":
  39. set {_searchtag} to ""
  40. else:
  41. set {_searchtag} to " ""%{_search}%"""
  42. if {_account} is not {_viewer}:
  43. open "CHEST" with 6 rows named "%{_account}%'s Bank (Page: %{_page} +1%/%{_all_pages} +1%)%{_searchtag}%" to {_viewer}
  44. else:
  45. open "CHEST" with 6 rows named "Bank (Page: %{_page} +1%/%{_all_pages} +1%)%{_searchtag}%" to {_viewer}
  46. wait 2 ticks
  47. set {x-inventory::%{uuid::%{_viewer}%}%::interactive_menu} to "Bank>%{_account}%>Withdraw>%{_page}%>Search>%{_search}%"
  48. if {_page} is not 0:
  49. set slot 45 of {_viewer}'s current inventory to paper named "&r&4&r&6<- Previous" with lore "&7Click to go to the previous" and "&7page"
  50. set slot 47 of {_viewer}'s current inventory to chest named "&r&4&r&9&lDeposit" with lore "&7Click to deposit items into" and "&7your bank"
  51. if {_search} is not "all":
  52. set slot 49 of {_viewer}'s current inventory to barrier named "&r&4&r&c&lCancel Search" with lore "&7Click to cancel search"
  53. set slot 51 of {_viewer}'s current inventory to compass named "&r&4&r&9&lSearch" with lore "&7Click to search for items in" and "&7your bank"
  54. if {x-bankwithdraw::%{uuid::%{_account}%}%::%{_next_page}%::*} is set:
  55. set slot 53 of {_viewer}'s current inventory to paper named "&r&4&r&6Next ->" with lore "&7Click to go to the next page"
  56. set {_slot} to 0
  57. loop {x-bankwithdraw::%{uuid::%{_account}%}%::%{_page}%::*}:
  58. delete {_lore::*}
  59. set {_amount} to 0
  60. set {_item::*} to {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%} split at "||"
  61. set {_amount} to {_item::1} parsed as integer
  62. if {_amount} is 0:
  63. delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%}
  64. delete {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}
  65. continue
  66. set {_lore::*} to lore of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}
  67. if max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item} is 1:
  68. add "&r&4&r", "&7&m-&f&m-&7[&b&l Bank Information &7]&f&m-&7&m-", "&9 &lAmount: &2%{_amount}%", "&7 Left click to: &btake &7(&b1&7)&b" and "&7 Right click to: &bstore &7(&b1&7)&b" to {_lore::*}
  69. else:
  70. add "&r&4&r", "&7&m-&f&m-&7[&b&l Bank Information &7]&f&m-&7&m-", "&9 &lAmount: &2%{_amount}%", "&7 Left click to: &btake &7(&b1&7)&b", "&7 Right click to: &bstore &7(&b1&7)&b", "&7 Shift-Left click to: &btake &7(&b%max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}%&7)&b" and "&7 Shift-Right click to: &bstore &7(&b%max stack size of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item}%&7)&b" to {_lore::*}
  71. set slot {_slot} of {_viewer}'s current inventory to 1 of {sql_bank-items::%{uuid::%{_account}%}%::%loop-value%::item} with lore {_lore::*}
  72. delete {_lore::*}
  73. add 1 to {_slot}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement