potions.lua 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. function lottinventory.get_potion_formspec(player, page)
  2. if page=="potions" then
  3. return "size[8,5.5]"
  4. .."background[5,5;1,1;craft_formbg.png;true]"
  5. .."label[0,0;Book of Potions]"
  6. .."button_exit[6,0;2,0.5;quit;Exit]"
  7. .."image_button[7,1;1,1;zcg_next.png;potions2;;false;false;zcg_next_press.png]"
  8. .."image[6,1;1,1;zcg_previous_inactive.png]"
  9. .."label[0,0.5;Base Potions:]"
  10. --First potion
  11. .."label[1,2.2; Mese Base Potion]"
  12. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_water;zcg:vessels:glass_bottle;]"
  13. .."item_image_button[5,2;1,1;default:mese_crystal_fragment;zcg:mese_crystal_fragment;]"
  14. .."image[6,2;1,1;zcg_craft_arrow.png]"
  15. .."item_image_button[7,2;1,1;lottpotion:glass_bottle_mese;zcg:glass_bottle_mese;]"
  16. --Second
  17. .."label[1,3.2; Geodes Base Potion]"
  18. .."item_image_button[4,3;1,1;lottpotion:glass_bottle_water;zcg:glass_bottle;]"
  19. .."item_image_button[5,3;1,1;lottores:geodes_crystal_1;zcg:geodes_crystal_1;]"
  20. .."image[6,3;1,1;zcg_craft_arrow.png]"
  21. .."item_image_button[7,3;1,1;lottpotion:glass_bottle_geodes;zcg:glass_bottle_geodes;]"
  22. --Third
  23. .."label[1,4.2; Seregon Base Potion]"
  24. .."item_image_button[4,4;1,1;lottpotion:glass_bottle_water;zcg:glass_bottle;]"
  25. .."item_image_button[5,4;1,1;lottplants:seregon;zcg:seregon;]"
  26. .."image[6,4;1,1;zcg_craft_arrow.png]"
  27. .."item_image_button[7,4;1,1;lottpotion:glass_bottle_seregon;zcg:glass_bottle_seregon;]"
  28. end
  29. if page=="potions2" then
  30. return "size[8,5.5]"
  31. .."label[0,0;Book of Potions]"
  32. .."button_exit[6,0;2,0.5;quit;Exit]"
  33. .."image_button[7,1;1,1;zcg_next.png;potions3;;false;false;zcg_next_press.png]"
  34. .."image_button[6,1;1,1;zcg_previous.png;potions;;false;false;zcg_previous_press.png]"
  35. .."label[0,0.5;Orc Draught (Hurting Potion)]"
  36. --First potion
  37. .."label[1,2.2; Power Level: 1]"
  38. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_seregon;zcg:glass_bottle_seregon;]"
  39. .."item_image_button[5,2;1,1;lottmobs:meat_raw;zcg:meat_raw;5]"
  40. .."image[6,2;1,1;zcg_craft_arrow.png]"
  41. .."item_image_button[7,2;1,1;lottpotion:orcdraught_power1;zcg:orcdraught_power1;]"
  42. --Second
  43. .."label[1,3.2; Power Level: 2]"
  44. .."item_image_button[4,3;1,1;lottpotion:orcdraught_power1;zcg:orcdraught_power1;]"
  45. .."item_image_button[5,3;1,1;lottmobs:meat_raw;zcg:meat_raw;5]"
  46. .."image[6,3;1,1;zcg_craft_arrow.png]"
  47. .."item_image_button[7,3;1,1;lottpotion:orcdraught_power2;zcg:orcdraught_power2;]"
  48. --Third
  49. .."label[1,4.2; Power Level: 3]"
  50. .."item_image_button[4,4;1,1;lottpotion:orcdraught_power2;zcg:orcdraught_power2;]"
  51. .."item_image_button[5,4;1,1;lottmobs:meat_raw;zcg:meat_raw;5]"
  52. .."image[6,4;1,1;zcg_craft_arrow.png]"
  53. .."item_image_button[7,4;1,1;lottpotion:orcdraught_power3;zcg:orcdraught_power3;]"
  54. .."background[5,5;1,1;craft_formbg.png;true]"
  55. end
  56. if page=="potions3" then
  57. return "size[8,5.5]"
  58. .."label[0,0;Book of Potions]"
  59. .."button_exit[6,0;2,0.5;quit;Exit]"
  60. .."image_button[7,1;1,1;zcg_next.png;potions4;;false;false;zcg_next_press.png]"
  61. .."image_button[6,1;1,1;zcg_previous.png;potions2;;false;false;zcg_previous_press.png]"
  62. .."label[0,0.5;Spider Poison (Speed Weakening Potion)]"
  63. --First potion
  64. .."label[1,2.2; Power Level: 1]"
  65. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_seregon;zcg:glass_bottle_seregon;]"
  66. .."item_image_button[5,2;1,1;lottmobs:spiderpoison;zcg:lottmobs:spiderpoison;2]"
  67. .."image[6,2;1,1;zcg_craft_arrow.png]"
  68. .."item_image_button[7,2;1,1;lottpotion:spiderpoison_power1;zcg:spiderpoison_power1;]"
  69. --Second
  70. .."label[1,3.2; Power Level: 2]"
  71. .."item_image_button[4,3;1,1;lottpotion:spiderpoison_power1;zcg:spiderpoison_power1;]"
  72. .."item_image_button[5,3;1,1;lottmobs:spiderpoison;zcg:lottmobs:spiderpoison;2]"
  73. .."image[6,3;1,1;zcg_craft_arrow.png]"
  74. .."item_image_button[7,3;1,1;lottpotion:spiderpoison_power2;zcg:spiderpoison_power2;]"
  75. --Third
  76. .."label[1,4.2; Power Level: 3]"
  77. .."item_image_button[4,4;1,1;lottpotion:spiderpoison_power2;zcg:spiderpoison_power2;]"
  78. .."item_image_button[5,4;1,1;lottmobs:spiderpoison;zcg:lottmobs:spiderpoison;2]"
  79. .."image[6,4;1,1;zcg_craft_arrow.png]"
  80. .."item_image_button[7,4;1,1;lottpotion:spiderpoison_power2;zcg:spiderpoison_power3;]"
  81. .."background[5,5;1,1;craft_formbg.png;true]"
  82. end
  83. if page=="potions4" then
  84. return "size[8,5.5]"
  85. .."label[0,0;Book of Potions]"
  86. .."button_exit[6,0;2,0.5;quit;Exit]"
  87. .."image_button[7,1;1,1;zcg_next.png;potions5;;false;false;zcg_next_press.png]"
  88. .."image_button[6,1;1,1;zcg_previous.png;potions3;;false;false;zcg_previous_press.png]"
  89. .."label[0,0.5;Limpe (Breathing Underwater Potion)]"
  90. --First potion
  91. .."label[1,2.2; Power Level: 1]"
  92. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_mese;zcg:glass_bottle_mese;]"
  93. .."item_image_button[5,2;1,1;lottplants:yavannamireleaf;zcg:yavannamireleaf;10]"
  94. .."image[6,2;1,1;zcg_craft_arrow.png]"
  95. .."item_image_button[7,2;1,1;lottpotion:limpe_power1;zcg:limpe_power1;]"
  96. --Second
  97. .."label[1,3.2; Power Level: 2]"
  98. .."item_image_button[4,3;1,1;lottpotion:limpe_power1;zcg:limpe_power1;]"
  99. .."item_image_button[5,3;1,1;lottplants:yavannamireleaf;zcg:yavannamireleaf;10]"
  100. .."image[6,3;1,1;zcg_craft_arrow.png]"
  101. .."item_image_button[7,3;1,1;lottpotion:limpe_power2;zcg:limpe_power2;]"
  102. --Third
  103. .."label[1,4.2; Power Level: 3]"
  104. .."item_image_button[4,4;1,1;lottpotion:limpe_power2;zcg:limpe_power2;]"
  105. .."item_image_button[5,4;1,1;lottplants:yavannamireleaf;zcg:yavannamireleaf;10]"
  106. .."image[6,4;1,1;zcg_craft_arrow.png]"
  107. .."item_image_button[7,4;1,1;lottpotion:limpe_power3;zcg:limpe_power3;]"
  108. .."background[5,5;1,1;craft_formbg.png;true]"
  109. end
  110. if page=="potions5" then
  111. return "size[8,5.5]"
  112. .."label[0,0;Book of Potions]"
  113. .."button_exit[6,0;2,0.5;quit;Exit]"
  114. .."image_button[7,1;1,1;zcg_next.png;potions6;;false;false;zcg_next_press.png]"
  115. .."image_button[6,1;1,1;zcg_previous.png;potions4;;false;false;zcg_previous_press.png]"
  116. .."label[0,0.5;Miruvor (Jump Boost Potion)]"
  117. --First potion
  118. .."label[1,2.2; Power Level: 1]"
  119. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_mese;zcg:glass_bottle_mese;]"
  120. .."item_image_button[5,2;1,1;lottplants:yavannamirefruit;zcg:yavannamirefruit;2]"
  121. .."image[6,2;1,1;zcg_craft_arrow.png]"
  122. .."item_image_button[7,2;1,1;lottpotion:miruvor_power1;zcg:miruvor_power1;]"
  123. --Second
  124. .."label[1,3.2; Power Level: 2]"
  125. .."item_image_button[4,3;1,1;lottpotion:miruvor_power1;zcg:miruvor_power1;]"
  126. .."item_image_button[5,3;1,1;lottplants:yavannamirefruit;zcg:yavannamirefruit;2]"
  127. .."image[6,3;1,1;zcg_craft_arrow.png]"
  128. .."item_image_button[7,3;1,1;lottpotion:miruvor_power2;zcg:miruvor_power2;]"
  129. --Third
  130. .."label[1,4.2; Power Level: 3]"
  131. .."item_image_button[4,4;1,1;lottpotion:miruvor_power2;zcg:miruvor_power2;]"
  132. .."item_image_button[5,4;1,1;lottplants:yavannamirefruit;zcg:yavannamirefruit;2]"
  133. .."image[6,4;1,1;zcg_craft_arrow.png]"
  134. .."item_image_button[7,4;1,1;lottpotion:miruvor_power3;zcg:miruvor_power3;]"
  135. .."background[5,5;1,1;craft_formbg.png;true]"
  136. end
  137. if page=="potions6" then
  138. return "size[8,5.5]"
  139. .."label[0,0;Book of Potions]"
  140. .."button_exit[6,0;2,0.5;quit;Exit]"
  141. .."image_button[7,1;1,1;zcg_next.png;potions7;;false;false;zcg_next_press.png]"
  142. .."image_button[6,1;1,1;zcg_previous.png;potions5;;false;false;zcg_previous_press.png]"
  143. .."label[0,0.5;Athelas Brew (Healing Potion)]"
  144. --First potion
  145. .."label[1,2.2; Power Level: 1]"
  146. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_geodes;zcg:glass_bottle_geodes;]"
  147. .."item_image_button[5,2;1,1;lottfarming:athelas;zcg:athelas;3]"
  148. .."image[6,2;1,1;zcg_craft_arrow.png]"
  149. .."item_image_button[7,2;1,1;lottpotion:athelasbrew_power1;zcg:athelasbrew_power1;]"
  150. --Second
  151. .."label[1,3.2; Power Level: 2]"
  152. .."item_image_button[4,3;1,1;lottpotion:athelasbrew_power1;zcg:athelasbrew_power1;]"
  153. .."item_image_button[5,3;1,1;lottfarming:athelas;zcg:athelas;3]"
  154. .."image[6,3;1,1;zcg_craft_arrow.png]"
  155. .."item_image_button[7,3;1,1;lottpotion:athelasbrew_power2;zcg:athelasbrew_power2;]"
  156. --Third
  157. .."label[1,4.2; Power Level: 3]"
  158. .."item_image_button[4,4;1,1;lottpotion:athelasbrew_power2;zcg:athelasbrew_power2;]"
  159. .."item_image_button[5,4;1,1;lottfarming:athelas;zcg:athelas;3]"
  160. .."image[6,4;1,1;zcg_craft_arrow.png]"
  161. .."item_image_button[7,4;1,1;lottpotion:athelasbrew_power3;zcg:athelasbrew_power3;]"
  162. .."background[5,5;1,1;craft_formbg.png;true]"
  163. end
  164. if page=="potions7" then
  165. return "size[8,5.5]"
  166. .."label[0,0;Book of Potions]"
  167. .."button_exit[6,0;2,0.5;quit;Exit]"
  168. .."image[7,1;1,1;zcg_next_inactive.png]"
  169. .."image_button[6,1;1,1;zcg_previous.png;potions6;;false;false;zcg_previous_press.png]"
  170. .."label[0,0.5;Ent Draught (Healing & Jump Weakening Potion)]"
  171. --First potion
  172. .."label[1,2.2; Power Level: 1]"
  173. .."item_image_button[4,2;1,1;lottpotion:glass_bottle_geodes;zcg:glass_bottle_geodes;]"
  174. .."item_image_button[5,2;1,1;default:leaves;zcg:leaves;10]"
  175. .."image[6,2;1,1;zcg_craft_arrow.png]"
  176. .."item_image_button[7,2;1,1;lottpotion:entdraught_power1;zcg:entdraught_power1;]"
  177. --Second
  178. .."label[1,3.2; Power Level: 2]"
  179. .."item_image_button[4,3;1,1;lottpotion:entdraught_power1;zcg:entdraught_power1;]"
  180. .."item_image_button[5,3;1,1;default:leaves;zcg:leaves;10]"
  181. .."image[6,3;1,1;zcg_craft_arrow.png]"
  182. .."item_image_button[7,3;1,1;lottpotion:entdraught_power2;zcg:entdraught_power2;]"
  183. --Third
  184. .."label[1,4.2; Power Level: 3]"
  185. .."item_image_button[4,4;1,1;lottpotion:entdraught_power2;zcg:entdraught_power2;]"
  186. .."item_image_button[5,4;1,1;default:leaves;zcg:leaves;10]"
  187. .."image[6,4;1,1;zcg_craft_arrow.png]"
  188. .."item_image_button[7,4;1,1;lottpotion:entdraught_power3;zcg:entdraught_power3;]"
  189. .."background[5,5;1,1;craft_formbg.png;true]"
  190. end
  191. end
  192. minetest.register_on_player_receive_fields(function(player,formname,fields)
  193. local pn = player:get_player_name()
  194. if fields.potions then
  195. minetest.show_formspec(pn, "potions",
  196. lottinventory.get_potion_formspec(player, "potions"))
  197. end
  198. if fields.potions2 then
  199. minetest.show_formspec(pn, "potions",
  200. lottinventory.get_potion_formspec(player, "potions2"))
  201. end
  202. if fields.potions3 then
  203. minetest.show_formspec(pn, "potions",
  204. lottinventory.get_potion_formspec(player, "potions3"))
  205. end
  206. if fields.potions4 then
  207. minetest.show_formspec(pn, "potions",
  208. lottinventory.get_potion_formspec(player, "potions4"))
  209. end
  210. if fields.potions5 then
  211. minetest.show_formspec(pn, "potions",
  212. lottinventory.get_potion_formspec(player, "potions5"))
  213. end
  214. if fields.potions6 then
  215. minetest.show_formspec(pn, "potions",
  216. lottinventory.get_potion_formspec(player, "potions6"))
  217. end
  218. if fields.potions7 then
  219. minetest.show_formspec(pn, "potions",
  220. lottinventory.get_potion_formspec(player, "potions7"))
  221. end
  222. end)
  223. minetest.register_tool("lottinventory:potions_book",{
  224. description = "Book of Potions",
  225. inventory_image = "lottinventory_potion_book.png",
  226. wield_image = "",
  227. wield_scale = {x=1,y=1,z=1},
  228. stack_max = 1,
  229. groups = {cook_crafts=1, book=1},
  230. tool_capabilities = {
  231. full_punch_interval = 1.0,
  232. max_drop_level=0,
  233. groupcaps={
  234. fleshy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  235. snappy={times={[2]=0.80, [3]=0.40}, maxlevel=1},
  236. choppy={times={[3]=0.90}, maxlevel=0}
  237. }
  238. },
  239. on_place = function(itemstack, player, pointed_thing)
  240. minetest.show_formspec(player:get_player_name(), "potions",
  241. lottinventory.get_potion_formspec(player, "potions"))
  242. end,
  243. on_use = function(itemstack, player, pointed_thing)
  244. minetest.show_formspec(player:get_player_name(), "potions",
  245. lottinventory.get_potion_formspec(player, "potions"))
  246. end,
  247. })