Advertisement
namekuzi

shop sk

Dec 7th, 2018
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.19 KB | None | 0 0
  1.  
  2.  
  3. #-----------------------------------------------------------------------------------------------#
  4. # RIGHT CLICKING TO OPEN SHOP/STORE MENU » HOLOGRAPHIC DISPLAYS #
  5. #-----------------------------------------------------------------------------------------------#
  6.  
  7.  
  8. on left click:
  9. #message "TARGETED = (%targeted entity%)" to player
  10. "%targeted entity of player%" is "armor stand"
  11. distance between targeted entity of player and player < 4
  12. set {_loc} to location of targeted entity of player
  13. add 2.45 to y-coordinate of {_loc}
  14. #set y-coordinate of {_loc} to y-coordinate of {_loc} rounded to the nearest 1 decimal place
  15. set {_types::*} to "Shop" and "Store"
  16. loop {_types::*}:
  17. loop {FSShop::ListOf%loop-value%s::*}:
  18. "%{_loc}%" is "%{FSShop::%loop-value-1%Settings::Location::%loop-value-2%}%"
  19. set {_id} to "%loop-value-2%"
  20. set {_type} to "%loop-value-1%"
  21. stop loop
  22. {_id} is set
  23. stop loop
  24. {_id} is set
  25. cancel event
  26. if {_type} is set:
  27. if {FSShop::%{_type}%Settings::ShopOpened::%{_id}%} is "OPEN":
  28. set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
  29. set {_p} to player
  30. set {_page} to 1
  31. if {_type} is "Shop":
  32. if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.shops.all" or "fshop.use.shops.%{_id}%":
  33. skellett open "CHEST" with 3 rows named "&8&lID: %{_id}% » Shop Menu" to player
  34. wait 2 ticks
  35. FunnyServerShop_RefreshShop({_p} , {_id})
  36. else:
  37. message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Shop!" to player
  38. else if {_type} is "Store":
  39. if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.stores.all" or "fshop.use.stores.%{_id}%":
  40. skellett open "CHEST" with 6 rows named "&8&lID: %{_id}% » Store Menu" to player
  41. wait 2 ticks
  42. FunnyServerShop_RefreshStore({_p} , {_id}, {_page})
  43. else:
  44. message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Store!" to player
  45. else:
  46. message "%{FSShop::ChatPrefix}%&cERROR! &7Couldn't detect type." to player
  47. else:
  48. message "%{FSShop::ChatPrefix}%&cSorry, this Shop is currently unavailable!" to player
  49. else:
  50. message "%{FSShop::ChatPrefix}%&cERROR! &7Couldn't find type." to player
  51.  
  52.  
  53. #-------------------------------------------------------------------------------------#
  54. # RIGHT CLICKING TO OPEN SHOP/STORE MENU » CITIZENS (NPC'S) #
  55. #-------------------------------------------------------------------------------------#
  56.  
  57. on right click on entity:
  58. loop {FSShop::ListOfShops::*}:
  59. "%location of targeted entity%" is "%{FSShop::ShopSettings::Location::%loop-value%}%"
  60. set {_id} to "%loop-value%"
  61. if {_id} is set:
  62. cancel event
  63. if {FSShop::ShopSettings::ShopOpened::%{_id}%} is "OPEN":
  64. if event-player has permission "fshop.*" or "fshop.use.all" or "fshop.use.shops.all" or "fshop.use.shops.%{_id}%":
  65. skellett open "CHEST" with 3 rows named "&8&lID: %{_id}% » Shop Menu" to event-player
  66. set {FSShop::PlayerStats::MenuType::%uuid of event-player%} to "Buy"
  67. wait 2 ticks
  68. set {_p} to event-player
  69. FunnyServerShop_RefreshShop({_p} , {_id})
  70. else:
  71. message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Shop!" to event-player
  72. else:
  73. message "%{FSShop::ChatPrefix}%&cSorry, this Shop is currently unavailable!" to event-player
  74. else:
  75. loop {FSShop::ListOfStores::*}:
  76. "%location of targeted entity%" is "%{FSShop::StoreSettings::Location::%loop-value%}%"
  77. set {_id2} to "%loop-value%"
  78. if {_id2} is set:
  79. cancel event
  80. if {FSShop::StoreSettings::ShopOpened::%{_id2}%} is "OPEN":
  81. if event-player has permission "fshop.*" or "fshop.use.all" or "fshop.use.stores.all" or "fshop.use.stores.%{_id2}%":
  82. skellett open "CHEST" with 6 rows named "&8&lID: %{_id2}% » Store Menu" to event-player
  83. wait 2 ticks
  84. set {_p} to event-player
  85. set {_page} to 1
  86. FunnyServerShop_RefreshStore({_p}, {_id2}, {_page})
  87. else:
  88. message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Store!" to event-player
  89. else:
  90. message "%{FSShop::ChatPrefix}%&cSorry, this Store is currently unavailable!" to event-player
  91.  
  92.  
  93. #--------------------------------------------------------------------------------#
  94. # RIGHT CLICKING TO OPEN SHOP/STORE MENU » SIGN SYSTEM #
  95. #--------------------------------------------------------------------------------#
  96.  
  97. on right click on sign:
  98. if line 1 of targeted block contains "&4&l&nShop ":
  99. set {_type} to "Shop"
  100. else if line 2 of targeted block contains "&4&l&nStore ":
  101. set {_type} to "Store"
  102. {_type} is set
  103. if player's gamemode is creative:
  104. message "%{FSShop::ChatPrefix}%&cYou only can open Shops when in Creative!" to player
  105. stop
  106. #message "TYPE = (%{_type}%)" to player
  107. loop {FSShop::ListOf%{_type}%s::*}:
  108. #message "LOC = (%location of event-block%) en (%{FSShop::%{_type}%Settings::Location::%loop-value%}%)"
  109. location of event-block is {FSShop::%{_type}%Settings::Location::%loop-value%}
  110. set {_found} to "%loop-value%"
  111. #message "FOUND = (%{_found}%)" to player
  112. {_found} is set
  113. if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.%{_type}%s.all" or "fshop.use.%{_type}%s.%{_found}%":
  114. #skellett open "CHEST" with 3 rows named "&8&lID: %{_found}% » Shop Menu" to player
  115. wait 2 ticks
  116. set {_p} to player
  117. if {_type} is "Shop":
  118. set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
  119. skellett open "CHEST" with 3 rows named "&8&lID: %{_found}% » Shop Menu" to player
  120. FunnyServerShop_RefreshShop({_p} , {_found})
  121. else:
  122. set {_page} to 1
  123. skellett open "CHEST" with 6 rows named "&8&lID: %{_found}% » Store Menu" to player
  124. FunnyServerShop_RefreshStore({_p} , {_found}, {_page})
  125. else:
  126. message "%{FSShop::ChatPrefix}%&cYou haven't got the permission to open this Shop!" to player
  127.  
  128.  
  129.  
  130.  
  131. #-------------------------------------------------#
  132. # INVENTORY CLICK EVENT, SHOP MENU #
  133. #-------------------------------------------------#
  134.  
  135. on inventory click:
  136. clicked item is not air
  137. clicked inventory is not player's inventory
  138. if uncoloured inventory name of player's current inventory contains " » Shop Menu":
  139. cancel event
  140. set {_id1} to uncoloured inventory name of player's current inventory
  141. set {_id2} to first (length of {_id1} - 12) characters of {_id1}
  142. set {_id} to the last (length of {_id2} - 4) characters of {_id2}
  143. set {_type1} to uncoloured name of slot 16 of player's current inventory
  144. if the first 3 characters of {_type1} is "Buy":
  145. set {_type} to "Buy"
  146. else if the first 4 characters of {_type1} is "Sell":
  147. set {_type} to "Sell"
  148. if clicked slot is 10 or 11 or 12 or 13 or 14:
  149. set {_am1} to uncoloured name of clicked item
  150. if {_type} is "Buy":
  151. set {_am2} to the last (length of {_am1} - 4) characters of {_am1}
  152. else if {_type} is "Sell":
  153. set {_am2} to the last (length of {_am1} - 5) characters of {_am1}
  154. else:
  155. message "%{FSShop::ChatPrefix}%&cError! No Type could be found!"
  156. set {_amount} to the first (length of {_am2} - 6) characters of {_am2} parsed as integer
  157. set {_price1} to uncoloured line 3 of targeted block
  158. set {_price2} to {FSShop::ShopSettings::%{_type}%ingPrice::%{_id}%}
  159. set {_price} to "%{_price2}%" parsed as number
  160. if uncoloured lore of clicked item contains "Balance":
  161. set {_method} to "Balance"
  162. if uncoloured lore of clicked item contains "Points":
  163. set {_method} to "Points"
  164. if {_method} is set:
  165. if clicked slot is 14:
  166. message "%{FSShop::ChatPrefix}%&3Type the amount you want to %{_type}%." to player
  167. set {FSShop::PlayerStats::TypingCustomType::%uuid of player%} to "%{_type}%"
  168. set {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} to {_price}
  169. set {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} to {FSShop::ShopSettings::SoldItem::%{_id}%}
  170. set {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%} to "%{_method}%"
  171. wait 2 ticks
  172. close player's inventory
  173. else:
  174. set {_p} to player
  175. set {_item} to {FSShop::ShopSettings::SoldItem::%{_id}%}
  176. FunnyServerShop_SellBuyItem({_p} , {_type} , {_price} , {_amount} , {_item} , {_method})
  177. else:
  178. message "%{FSShop::ChatPrefix}%&cCouldn't find the Method you specified! Try to reopen the menu!"
  179.  
  180. else if clicked slot is 16:
  181. if {_type} is "Buy":
  182. set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Sell"
  183. else if {_type} is "Sell":
  184. set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
  185. else:
  186. message "%{FSShop::ChatPrefix}%&cError! Couldn't find Type to switch!"
  187. set {_p} to player
  188. FunnyServerShop_RefreshShop({_p} , {_id})
  189.  
  190.  
  191. #-----------------------------------------------------------------#
  192. # INVENTORY CLICK EVENT, STORE MENU MECHANICS #
  193. #-----------------------------------------------------------------#
  194.  
  195.  
  196. else if uncoloured inventory name of player's current inventory contains " » Store Menu":
  197. cancel event
  198. clicked item is not air
  199. set {_id1} to uncoloured inventory name of player's current inventory
  200. set {_id2} to first (length of {_id1} - 13) characters of {_id1}
  201. set {_id} to the last (length of {_id2} - 4) characters of {_id2}
  202. set {_z::*} to 47, 48, 49, 50 and 51
  203. set {_amounts::*} to 1, 8, 32 and 64
  204. if clicked slot is 53:
  205. message "%{FSShop::ChatPrefix}%&cThis Feature is coming in an update soon!"
  206. else if name of clicked item is set:
  207. if clicked slot is not 47 or 48 or 49 or 50 or 51:
  208. if name of clicked item contains "&7&l&nGo to Page ":
  209. set {_page1} to the last (length of uncoloured name of clicked item - 11) characters of uncoloured name of clicked item
  210. set {_page} to "%{_page1}%" parsed as integer
  211. set {_p} to player
  212. skellett open "CHEST" with 6 rows named "&8&lID: %{_id}% » Store Menu" to event-player
  213. wait 2 ticks
  214. FunnyServerShop_RefreshStore({_p}, {_id}, {_page})
  215. else if name of clicked item is not "&c&l&nNo Items found!" or "&a&l&nMore Information":
  216. if "%click type%" is "left mouse button":
  217. set {_type} to "Buy"
  218. set {_color} to "&a&l"
  219. else if "%click type%" is "right mouse button":
  220. set {_type} to "Sell"
  221. set {_color} to "&c&l"
  222. {_type} is set
  223. if {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} is clicked item:
  224. delete {FSShop::PlayerStats::StoreItemSelected::%uuid of player%}
  225. loop {_z::*}:
  226. set slot loop-value of player's current inventory to black glass pane named "&7&l&nNo Item Selected." with lore " || &fSelect an Item by clicking on || &fan slot as shown above. || "
  227. else:
  228. set {_item1} to 1 of clicked item
  229. set name of {_item1} to ""
  230. set {_item} to "%{_item1}%" parsed as text
  231. {FSShop::StoreSettings::%{_item}%::%{_type}%able::%{_id}%} is not "Disabled"
  232. set {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} to clicked item
  233. set {_price} to {FSShop::StoreSettings::%{_item}%::%{_type}%ingPrice::%{_id}%}
  234. set {_slot} to 47
  235. loop {_amounts::*}:
  236. set {_totalPrice} to (loop-value * {_price})
  237. set slot {_slot} of player's current inventory to loop-value of {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} named "%{_color}%&n%{_type}% %loop-value%x %{_item}%" with lore " || &eTotal Price: &f$%{_totalPrice}% || "
  238. add 1 to {_slot}
  239. set slot {_slot} of player's current inventory to emerald named "&6&l&n%{_type}% Custom Amount" with lore " || &bMethod: &fBalance || ||&9Click to %{_type}%!"
  240.  
  241. else if clicked slot is 47 or 48 or 49 or 50 or 51:
  242. name of clicked slot is set
  243. name of clicked slot is not "&7&l&nNo Item Selected."
  244. set {_type} to the first 4 characters of uncoloured name of clicked item
  245. replace all " " with "" in {_type}
  246. set {_item} to 1 of {FSShop::PlayerStats::StoreItemSelected::%uuid of player%}
  247. set name of {_item} to ""
  248. set {_item1} to "%{_item}%" parsed as text
  249. set {_price} to {FSShop::StoreSettings::%{_item1}%::%{_type}%ingPrice::%{_id}%}
  250. set {_method} to "Balance"
  251.  
  252. if clicked slot is 51:
  253. name of clicked item contains " Custom Amount"
  254. message "%{FSShop::ChatPrefix}%&3Type the amount you want to %{_type}%." to player
  255. set {FSShop::PlayerStats::TypingCustomType::%uuid of player%} to "%{_type}%"
  256. set {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} to {_price}
  257. set {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} to {_item}
  258. set {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%} to "%{_method}%"
  259. wait 2 ticks
  260. close player's inventory
  261.  
  262. else:
  263. set {_p} to player
  264. set {_amount} to "%size of item clicked item%" parsed as integer
  265. FunnyServerShop_SellBuyItem({_p} , {_type} , {_price} , {_amount} , {_item} , {_method})
  266.  
  267.  
  268. #-------------------------#
  269. # END OF TRIGGERS #
  270. #-------------------------#
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284. #----------------------------------------------------------------#
  285. # THE FUNCTION OF OPENING THE MENU OF A SHOP #
  286. #----------------------------------------------------------------#
  287.  
  288.  
  289. function FunnyServerShop_RefreshShop(p: player , id: text):
  290. set {_uuid} to uuid of {_p}
  291. set {_item} to {FSShop::ShopSettings::SoldItem::%{_id}%}
  292. set {_pl} to 0
  293. if {FSShop::PlayerStats::MenuType::%{_uuid}%} is not set:
  294. set {FSShop::PlayerStats::MenuType::%{_uuid}%} to "Buy"
  295. #set {_price} to {FSShop::ShopSettings::%{FSShop::PlayerStats::MenuType::%{_uuid}%}%ingPrice::%{_id}%}
  296. set {_verVault} to version of "Vault"
  297. set {_verPP} to version of "PlayerPoints"
  298. if {_verVault} is not "<none>":
  299. set {_vaultPL} to true
  300. set {_type} to "Balance"
  301. add 1 to {_pl}
  302. else if {_verPP} is not "<none>":
  303. set {_pointsPL} to true
  304. set {_type} to "PlayerPoints"
  305. add 1 to {_pl}
  306. set {_menu} to {FSShop::PlayerStats::MenuType::%{_uuid}%}
  307. set {_price} to {FSShop::ShopSettings::%{_menu}%ingPrice::%{_id}%}
  308. set {_x} to 10
  309. set {_y::*} to 1, 8, 32 and 64
  310. loop {_y::*}:
  311. set {_loopPrice} to (loop-value * {_price})
  312. #if {_type} is "Vault":
  313. if {_menu} is "Buy":
  314. set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&a&l&n%{_menu}% %loop-value% times" with lore " || &eTotal Price: &f$%{_loopPrice}% || || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
  315. else if {_menu} is "Sell":
  316. set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&c&l&n%{_menu}% %loop-value% times" with lore " || &eTotal Price: &f$%{_loopPrice}% || || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
  317. #else if {_type} is "PlayerPoints":
  318. # set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&cSoon!"
  319. add 1 to {_x}
  320. if {_amount} is not set:
  321. set {_amount} to 1
  322. set {_customPrice} to ({_amount} * {_price})
  323. if {_item} is "emerald_item":
  324. set {_item1} to emerald block
  325. else:
  326. set {_item1} to emerald item
  327. set slot 14 of {_p}'s current inventory to 1 of {_item1} named "&6&l&n%{_menu}% Custom Amount" with lore " || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
  328. if {_menu} is "Buy":
  329. set slot 16 of {_p}'s current inventory to light green wool block named "&2&l&nBuying Mode" with lore " || &7Click to switch! || "
  330. else if {_menu} is "Sell":
  331. set slot 16 of {_p}'s current inventory to red wool block named "&c&l&nSelling Mode" with lore " || &7Click to switch! || "
  332. #loop 5 times:
  333. # set slot loop-value of {_p}'s current inventory to red glass pane
  334. # add 1 to {_x}
  335. if {_pl} > 1:
  336. set slot 26 of {_p}'s current inventory to book named "&a&lPayment Method" with lore " || &7» &cSell with Balance || &7» &eBuy with Points || &7» "
  337. if slot 0 of {_p}'s current inventory is not gray glass pane:
  338. set {_y::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25 and 26
  339. loop {_y::*}:
  340. uncoloured inventory name of {_p}'s current inventory contains "» Shop Menu"
  341. if {FSShop::ShopSettings::GlassColor::%{_id}%} is not set:
  342. set {FSShop::ShopSettings::GlassColor::%{_id}%} to gray glass pane
  343. set slot loop-value of {_p}'s current inventory to {FSShop::ShopSettings::GlassColor::%{_id}%}
  344.  
  345.  
  346.  
  347.  
  348. #-----------------------------------------------------------------#
  349. # THE FUNCTION OF OPENING THE MENU OF A STORE #
  350. #-----------------------------------------------------------------#
  351.  
  352.  
  353. function FunnyServerShop_RefreshStore(p: player , id: text , page: integer):
  354. set {_uuid} to uuid of {_p}
  355. set {_x} to 10
  356. if size of {FSShop::StoreSettings::SoldItems::%{_id}%::*} > 0:
  357. set {_c} to 0
  358. set {_prev} to ({_page} - 1)
  359. set {_next} to ({_page} + 1)
  360. set slot 34 of {_p}'s current inventory to shiny arrow named "&7&l&nGo to Page %{_next}%"
  361. if {_page} > 1:
  362. set slot 28 of {_p}'s current inventory to shiny arrow named "&7&l&nGo to Page %{_prev}%"
  363. loop {FSShop::StoreSettings::SoldItems::%{_id}%::*}:
  364. if {_page} = 1:
  365. if ({_page} * 19) >= {_c}:
  366. add loop-value to {_items::*}
  367. else:
  368. stop loop
  369. add 1 to {_c}
  370. else:
  371. if ({_page} * 19) >= {_c}:
  372. {_c} >= ({_prev} * 19) + 1
  373. add loop-value to {_items::*}
  374. else:
  375. stop loop
  376. add 1 to {_c}
  377. # else:
  378. # if ({_page} * 19) >= {_c}:
  379. # {_c} >= ({_prev} * 20)
  380. # add loop-value to {_items::*}
  381. # else:
  382. # stop loop
  383. # add 1 to {_c}
  384. wait 1 tick
  385. set {_x} to 10
  386. loop {_items::*}:
  387. set {_itemF} to "%loop-value%" parsed as text
  388. set {_itemI} to "%loop-value%" parsed as item
  389. set {_item1} to "%loop-value%" parsed as item
  390. disenchant {_item1}
  391. set {_item} to "%{_item1}%" converted to all uppercase
  392. if {FSShop::StoreSettings::%{_itemF}%::Buyable::%{_id}%} is "Disabled":
  393. set {_buyText} to "&6&oNot Buyable"
  394. else:
  395. set {_buyText} to "&a$%{FSShop::StoreSettings::%{_itemF}%::BuyingPrice::%{_id}%}%"
  396. if {FSShop::StoreSettings::%{_itemF}%::Sellable::%{_id}%} is "Disabled":
  397. set {_sellText} to "&6&oNot Sellable"
  398. else:
  399. set {_sellText} to "&c$%{FSShop::StoreSettings::%{_itemF}%::SellingPrice::%{_id}%}%"
  400. if {_x} is 28:
  401. {_page} > 1
  402. add 1 to {_x}
  403. set slot {_x} of {_p}'s current inventory to 1 of {_itemI} named "&e&l&n%{_item}%" with lore " || &7Buy Price: %{_buyText}% || || &7Sell Price: %{_sellText}%|| || ||&a&oLeft Click to buy.||&c&oRight Click to sell."
  404. if {_x} is 16 or 25:
  405. add 3 to {_x}
  406. else:
  407. add 1 to {_x}
  408. else:
  409. set slot 22 of {_p}'s current inventory to redstone block named "&c&l&nNo Items found!"
  410. set slot 45 of {_p}'s current inventory to book named "&a&l&nMore Information" with lore " || &fLeft Click &7on the Item you want to buy or sell. || &7It will popup a new menu where you can select the amount. || &7You can also use the &fdrop button &7to directly buy items, || &7by typing in the chat what amount you want to buy. || "
  411. set slot 53 of {_p}'s current inventory to name tag named "&b&l&nFilter Items" with lore " || &f» All Items || &8» Available || &8» On Sale || &8» Buyable || &8» Out of Stock || ||&9Click to switch."
  412. wait 1 tick
  413. if slot 0 of {_p}'s current inventory is not gray glass pane or red glass pane:
  414. set {_y::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46 and 52
  415. loop {_y::*}:
  416. uncoloured inventory name of {_p}'s current inventory contains "» Store Menu"
  417. if size of {_items::*} > 0:
  418. set slot loop-value of {_p}'s current inventory to {FSShop::StoreSettings::GlassColor::%{_id}%}
  419. else:
  420. set slot loop-value of {_p}'s current inventory to red glass pane
  421. if {FSShop::PlayerStats::StoreItemSelected::%{_uuid}%} is not set:
  422. set {_z::*} to 47, 48, 49, 50 and 51
  423. loop {_z::*}:
  424. set slot loop-value of {_p}'s current inventory to black glass pane named "&7&l&nNo Item Selected." with lore " || &fSelect an Item by clicking on || &fan slot as shown above. || "
  425. delete {_items::*}
  426.  
  427.  
  428. #-------------------------------------------------------------------------#
  429. # THE SYSTEM OF SELLING AND BUYING ITEMS IN THE MENU #
  430. #-------------------------------------------------------------------------#
  431.  
  432.  
  433. function FunnyServerShop_SellBuyItem(p: player , type: text , price: number , amount: integer , item: item , method: text):
  434. set {_uuid} to uuid of {_p}
  435. set {_totalPrice} to ({_price} * {_amount})
  436.  
  437. if "%all of the enchantments of {_item}%" is not "<none>":
  438. set {_enchants::*} to all of the enchantments of {_item}
  439.  
  440. set {_item2} to "%{_item}%" parsed as item
  441. loop {_enchants::*}:
  442. enchant {_item2} with loop-value
  443.  
  444. if "%{_amount}%" is "<none>":
  445. message "%{FSShop::ChatPrefix}%&cError! The amount hasn't been saved, maybe the Server lagged?" to {_p}
  446. stop
  447. if "%{_price}%" is "<none>":
  448. message "%{FSShop::ChatPrefix}%&cError! The Price hasn't been been saved, maybe the Server lagged?" to {_p}
  449. stop
  450.  
  451. if {_type} is set:
  452. if {_type} is "Buy":
  453. #message "AMOUNT = (%{_amount}%) en ITEM = (%{_item}%)" to {_p}
  454. if {_p} has enough space for {_amount} of {_item2}:
  455. if {_method} is "Balance":
  456. if balance of {_p} >= {_totalPrice}:
  457. remove {_totalPrice} from balance of {_p}
  458. give {_amount} of {_item2} to {_p}
  459. if {_amount} is "8 " or "32" or "64":
  460. message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_item}% &afor &f$%{_totalPrice}%" to {_p}
  461. message "[FunnyShop] &7%{_p}% bought %{_item}% for $%{_totalPrice}%" to console
  462. else:
  463. message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_amount}%x %{_item}% &afor &f$%{_totalPrice}%" to {_p}
  464. message "[FunnyShop] &7%{_p}% bought %{_amount}%x %{_item}% for $%{_totalPrice}%" to console
  465. else:
  466. message "%{FSShop::ChatPrefix}%&cYou don't have enough money for this!" to {_p}
  467. else:
  468. message "%{FSShop::ChatPrefix}%&cNo PlayerPoints support yet!" to {_p}
  469. #if player points of {_p} >= {_totalPrice}:
  470. # remove {_totalPrice} from the player points of {_p}
  471. # give {_amount} of {_item} to {_p}
  472. # if "%{_item}%" contains "8" or "32" or "64":
  473. # message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_item}% &afor &f$%{_totalPrice}%" to {_p}
  474. # else:
  475. # message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_amount}% %{_item}% &afor &f$%{_totalPrice}%" to {_p}
  476. #else:
  477. # message "%{FSShop::ChatPrefix}%&cYou haven't got enough points for this!"
  478. else:
  479. message "%{FSShop::ChatPrefix}%&cYou don't have enough inventory space left!" to {_p}
  480. else if {_type} is "Sell":
  481. if {_method} is "Balance":
  482. if amount of {_item2} in {_p}'s inventory >= {_amount}:
  483. add {_totalPrice} to balance of {_p}
  484. remove {_amount} of {_item2} from {_p}'s inventory
  485. message "%{FSShop::ChatPrefix}%&eYou've successfully sold &f%{_amount}%x %{_item2}% &efor &f$%{_totalPrice}%" to {_p}
  486. message "[FunnyShop] &7%{_p}% sold %{_amount}%x %{_item2}% for $%{_totalPrice}%" to console
  487. else:
  488. message "%{FSShop::ChatPrefix}%&cYou don't have enough items to do this!" to {_p}
  489. else:
  490. message "%{FSShop::ChatPrefix}%&cNo PlayerPoints support yet!" to {_p}
  491. else:
  492. message "%{FSShop::ChatPrefix}%&cCouldn't find if you wanted to sell or buy!" to {_p}
  493. else:
  494. message "%{FSShop::ChatPrefix}%&cCouldn't select if you wanted to sell or buy!" to {_p}
  495.  
  496.  
  497.  
  498. on chat:
  499. if {FSShop::PlayerStats::TypingCustomType::%uuid of player%} is set:
  500. cancel event
  501. if message is "all":
  502. if {FSShop::PlayerStats::TypingCustomType::%uuid of player%} is "Sell":
  503. set {_amount1} to the number of "%{FSShop::PlayerStats::TypingCustomItem::%uuid of player%}%" parsed as item in player's inventory
  504. set {_amount} to "%{_amount1}%" parsed as integer
  505. set {_p} to player
  506. if {_amount} > 0:
  507. FunnyServerShop_SellBuyItem({_p} , {FSShop::PlayerStats::TypingCustomType::%uuid of player%} , {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} , {_amount} , {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} , {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%})
  508. else:
  509. message "%{FSShop::ChatPrefix}%&cYou can't sell items you don't have in your inventory!"
  510. else:
  511. message "%{FSShop::ChatPrefix}%&cYou can't buy all items! You can only sell all items!"
  512. else:
  513. set {_m1} to message parsed as integer
  514. if "%{_m1}%" is not "<none>":
  515. set {_m2} to "%{_m1}%" parsed as integer
  516. if {_m2} is "<none>":
  517. message "%{FSShop::ChatPrefix}%&cYou need to enter an number with 0 decimals!"
  518. else:
  519. if {_m1} > 0:
  520. set {_p} to player
  521. FunnyServerShop_SellBuyItem({_p} , {FSShop::PlayerStats::TypingCustomType::%uuid of player%} , {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} , {_m2} , {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} , {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%})
  522. else:
  523. message "%{FSShop::ChatPrefix}%&cYou can't %{FSShop::PlayerStats::TypingCustomType::%uuid of player%}% 0 Items!"
  524. else:
  525. message "%{FSShop::ChatPrefix}%&cFailed to find exact number. Do only type numbers!"
  526. wait 5 ticks
  527. delete {FSShop::PlayerStats::TypingCustomType::%uuid of player%}
  528. delete {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%}
  529. delete {FSShop::PlayerStats::TypingCustomAmount::%uuid of player%}
  530. delete {FSShop::PlayerStats::TypingCustomItem::%uuid of player%}
  531. delete {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%}
  532.  
  533.  
  534. else if {FSShop::PlayerStats::TypingShopName::%uuid of player%} is set:
  535. set {_id} to {FSShop::PlayerStats::TypingShopName::%uuid of player%}
  536. set {_type} to {FSShop::PlayerStats::TypingShopType::%uuid of player%}
  537. set {_trigger} to {FSShop::PlayerStats::TypingShopTrigger::%uuid of player%}
  538. replace all " " with "" in {_id}
  539. cancel event
  540. #message "TRIGGER = (%{_trigger}%)"
  541. if {_trigger} is "NPC":
  542. loop all citizens:
  543. id of loop-citizen is {FSShop::%{_type}%Settings::NPCID::%{_id}%}
  544. set npc name of loop-citizen to coloured message
  545. set {_done} to true
  546. stop loop
  547. else if {_trigger} is "HOLOGRAM":
  548. set text in hologram {FSShop::%{_type}%Settings::Hologram::%{_id}%} to coloured message in line 0
  549. set {_done} to true
  550. else:
  551. set {_done} to true
  552. if {_done} is set:
  553. set {FSShop::%{_type}%Settings::NickName::%{_id}%} to coloured message
  554. message "%{FSShop::ChatPrefix}%&aYou've successfully changed the name to &f'%coloured message%&f'"
  555. else:
  556. message "%{FSShop::ChatPrefix}%&cCouldn't find the NPC you were looking for!"
  557. delete {FSShop::PlayerStats::TypingShopName::%uuid of player%}
  558. delete {FSShop::PlayerStats::TypingShopCType::%uuid of player%}
  559. delete {FSShop::PlayerStats::TypingShopTrigger::%uuid of player%}
  560. #set name of loop-entity to "%coloured message%"
  561.  
  562.  
  563. else if {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%} is set:
  564. set {_id} to {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%}
  565. set {_type} to {FSShop::PlayerStats::TypingItemPriceType::%uuid of player%}
  566. set {_method} to {FSShop::PlayerStats::TypingItemPriceMethod::%uuid of player%}
  567. set {_item} to {FSShop::PlayerStats::TypingItemPriceItem::%uuid of player%}
  568. cancel event
  569. set {_m2} to message
  570. replace all "," with "." in {_m2}
  571. set {_m1} to "%{_m2}%" parsed as number
  572. if "%{_m1}%" is not "<none>":
  573. if {_m1} > 0:
  574. if {_method} is "Store":
  575. set {FSShop::%{_method}%Settings::%{_item}%::%{_type}%ingPrice::%{_id}%} to {_m1}
  576. message "%{FSShop::ChatPrefix}%&aSuccessfully changed the &f%{_type}% Price &ato &f$%{_m1}%" to player
  577. else:
  578. message "%{FSShop::ChatPrefix}%&cNot Supported yet."
  579. else:
  580. message "%{FSShop::ChatPrefix}%&cYou can't buy 0 Items!"
  581. else:
  582. message "%{FSShop::ChatPrefix}%&cFailed to find exact number. Do only type numbers!"
  583. delete {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%}
  584. delete {FSShop::PlayerStats::TypingItemPriceType::%uuid of player%}
  585. delete {FSShop::PlayerStats::TypingItemPriceMethod::%uuid of player%}
  586. delete {FSShop::PlayerStats::TypingItemPriceItem::%uuid of player%}
  587.  
  588. else if {FSShop::PlayerStats::TypingCustomPluginPrefix::%uuid of player%} is set:
  589. cancel event
  590. set {FSShop::ChatPrefix} to "%coloured message% "
  591. message "%{FSShop::ChatPrefix}%&aYou've successfully changed the prefix to: &f'&r%{FSShop::ChatPrefix}%&f'."
  592. delete {FSShop::PlayerStats::TypingCustomPluginPrefix::%uuid of player%}
  593.  
  594. #----------------------------------#
  595. # END OF FUNCTIONS CODE #
  596. #----------------------------------#
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615. #---------------------------------------------------------------#
  616. # THE FUNCTION OF DESTROYING A SHOP OR STORE #
  617. #---------------------------------------------------------------#
  618.  
  619.  
  620. function FunnyServerShop_DestroyShop(p: player , method: text , type: text , id: text , trigger: text):
  621. set {_uuid} to uuid of {_p}
  622. if {_method} is "ITEM_FRAME":
  623. message "%{FSShop::ChatPrefix}%&eYou need to destroy the Item Frame yourself. Sorry!" to {_p}
  624. else if {_method} is "HOLOGRAM":
  625. unregister hologram {FSShop::%{_type}%Settings::Hologram::%{_id}%}
  626. delete {FSShop::%{_type}%Settings::Hologram::%{_id}%}
  627. else if {_method} is "NPC":
  628. loop all created citizens:
  629. set {_NPCID} to id of loop-citizen
  630. "%{_NPCID}%" is "%{FSShop::%{_type}%Settings::NPCID::%{_id}%}%"
  631. set {_npc} to loop-citizen
  632. stop loop
  633. if {_npc} is set:
  634. destroy {_npc}
  635. delete {FSShop::%{_type}%Settings::NPCID::%{_id}%}
  636. else:
  637. message "%{FSShop::ChatPrefix}%&cCouldn't find the NPC! Remove it manually please." to {_p}
  638. else if {_method} is "SIGN":
  639. if block at {FSShop::%{_type}%Settings::Location::%{_id}%} is sign:
  640. set block at {FSShop::%{_type}%Settings::Location::%{_id}%} to air
  641. else:
  642. message "%{FSShop::ChatPrefix}%&cRemove the Sign manually please." to {_p}
  643.  
  644. wait 2 ticks
  645. delete {FSShop::%{_type}%Settings::Location::%{_id}%}
  646. delete {FSShop::%{_type}%Settings::Entity::%{_id}%}
  647. delete {FSShop::%{_type}%Settings::ShopType::%{_id}%}
  648. if {_type} is "Store":
  649. loop {FSShop::StoreSettings::SoldItems::%{_id}%::*}:
  650. delete {FSShop::StoreSettings::%loop-value%::BuyingPrice::%{_id}%}
  651. delete {FSShop::StoreSettings::%loop-value%::SellingPrice::%{_id}%}
  652. delete {FSShop::StoreSettings::%loop-value%::Buyable::%{_id}%}
  653. delete {FSShop::StoreSettings::%loop-value%::Sellable::%{_id}%}
  654. delete {FSShop::StoreSettings::%loop-value%::MaxBuyAmount::%{_id}%}
  655. delete {FSShop::StoreSettings::%loop-value%::MaxSellAmount::%{_id}%}
  656. wait 1 tick
  657. delete {FSShop::StoreSettings::SoldItems::%{_id}%::*}
  658. else:
  659. delete {FSShop::ShopSettings::SoldItem::%{_id}%}
  660. delete {FSShop::ShopSettings::BuyingPrice::%{_id}%}
  661. delete {FSShop::ShopSettings::SellingPrice::%{_id}%}
  662. delete {FSShop::%{_type}%Settings::ShopOpened::%{_id}%}
  663. delete {FSShop::%{_type}%Settings::GlassColor::%{_id}%}
  664. remove "%{_id}%" from {FSShop::ListOf%{_type}%s::*}
  665. close {_p}'s inventory
  666. #if {_type} is "SIGN" or "ITEM_FRAME":
  667. if {_trigger} is "invClick":
  668. message "%{FSShop::ChatPrefix}%&dYou've successfully removed a %{_type}%. &7(ID: %{_id}%)" to {_p}
  669. else if {_trigger} is "destroy":
  670. message "%{FSShop::ChatPrefix}%&dYou've destroyed a %{_type}%. &7(ID: %{_id}%)" to {_p}
  671.  
  672. #----------------------------------------------------------------------------#
  673. # THE REFRESHING SYSTEM OF AN HOLOGRAM SHOP OR STORE #
  674. #----------------------------------------------------------------------------#
  675.  
  676.  
  677.  
  678.  
  679.  
  680. function FunnyServerShop_RefreshHolo(p: player , id: text):
  681. set {_uuid} to uuid of {_p}
  682. unregister hologram {FSShop::ShopSettings::Hologram::%{_id}%}
  683. delete {FSShop::ShopSettings::Hologram::%{_id}%}
  684. wait 1 tick
  685. set {_loc} to {FSShop::ShopSettings::Location::%{_id}%}
  686. set {FSShop::ShopSettings::Hologram::%{_id}%} to new hologram at {_loc}
  687. set location of hologram {FSShop::ShopSettings::Hologram::%{_id}%} to {_loc}
  688. wait 3 ticks
  689. add text "&a&l$%{FSShop::ShopSettings::BuyingPrice::%{_id}%}% &8| &c&l$%{FSShop::ShopSettings::SellingPrice::%{_id}%}%" to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
  690. wait 2 ticks
  691. add item {FSShop::ShopSettings::SoldItem::%{_id}%} to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
  692. wait 2 ticks
  693. add text "&6&nSneak to open" to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700. #every second:
  701. # size of {FSShop::ListOfStores::*} > 0
  702. # loop {FSShop::ListOfStores::*}:
  703. # set {_id} to "%loop-value%"
  704. # {FSShop::StoreSettings::ShopType::%{_id}%} is "Hologram"
  705. # set {_item1} to a random text out of {FSShop::StoreSettings::SoldItems::%{_id}%::*}
  706. # set {_item} to "%{_item1}%" parsed as text
  707. # message "ITEM = (%{_item}%) en ITEM1 = (%{_item1}%)" to all ops
  708. # {_item} is set
  709. # message "Hey!" to all ops
  710. # unregister hologram {FSShop::StoreSettings::Hologram::%{_id}%}
  711. # delete {FSShop::StoreSettings::Hologram::%{_id}%}
  712. # set {_loc} to {FSShop::StoreSettings::Location::%{_id}%}
  713. # set location of hologram {FSShop::StoreSettings::Hologram::%{_id}%} to {_loc}
  714. # wait 1 ticks
  715. # add text "&6&l&nStore %{_id}%" to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
  716. # wait 1 ticks
  717. # add item {_item} to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
  718. # wait 1 ticks
  719. # add text "&7&l&nLeft Click to open." to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
  720.  
  721.  
  722. #! THIS DOESN'T WORK VERY WELL; ADD IT IN FEATURE UPDATE » Refreshing Store Hologram by Shuffling between Sold Items.
  723.  
  724.  
  725.  
  726. #set item in hologram {FSShop::StoreSettings::Hologram::%{_id}%} to {_item} at line 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement