kraeutermeister.txt 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_click");
  4. event.load("block_break");
  5. event.load("entity_click");
  6. event.load("item_air_click");
  7. stage = 0;
  8. all_stages = 9;
  9. quest_name = "Kräutermeister";
  10. age_prop_3 = block.getProperty("age_0_3");
  11. brown_mushroom = 0;
  12. red_mushroom = 0;
  13. nether_wart = 0;
  14. twisting_vines = 0;
  15. warped_fungus = 0;
  16. crimson_fungus = 0;
  17. warped_roots = 0;
  18. crimson_roots = 0;
  19. brown_mushroom_needed = 5;
  20. red_mushroom_needed = 5;
  21. nether_wart_needed = 10;
  22. twisting_vines_needed = 3;
  23. warped_fungus_needed = 1;
  24. crimson_fungus_needed = 1;
  25. warped_roots_needed = 2;
  26. crimson_roots_needed = 2;
  27. @wait
  28. wait();
  29. if(event == "living_death") {
  30. player = player.getFromDamageSource(damage_source);
  31. if(player == null) {
  32. goto("wait");
  33. }
  34. }
  35. if(!player.isQuester(player, script)) {
  36. goto("wait");
  37. }
  38. if(event == "quest_term") {
  39. //Hier Code einfügen...
  40. wait(); //Script wird von außen terminiert
  41. }
  42. if(event == "quest_start") {
  43. quest.display(player, quest_name, stage, all_stages);
  44. msg.prefix(player, "§dKunibert", "Du kommst zum richtigen Zeitpunkt. Ich habe gehört, du suchst Tätigkeiten.");
  45. scheduler.msgPrefix(30, player, "§dKunibert", "Im Sumpf nebenan gibt es einiges zu pflücken.");
  46. scheduler.msgPrefix(60, player, "§dKunibert", "Hier meine Zutatenliste für mein geheimes Heilmittel.");
  47. scheduler.msgPrefix(150, player, "§dKunibert", "Aber pssst, niemand darf von meiner Kunst der Heilkunde erfahren, sonst werde ich verfolgt. Ich vertrau dir.");
  48. player.giveSingleItem(player, read.item("minecraft:shears"), false);
  49. ingredients = read.item("minecraft:paper");
  50. item.setName(ingredients, "Zutaten für Kunibert");
  51. item.addLore(ingredients, 0, "5 braune Pilze");
  52. item.addLore(ingredients, 1, "5 rote Pilze");
  53. item.addLore(ingredients, 2, "10 Netherwarzen");
  54. item.addLore(ingredients, 3, "2 Karmesinwurzeln");
  55. item.addLore(ingredients, 4, "1 Wirrpilz");
  56. item.addLore(ingredients, 5, "2 Wirrwurzeln");
  57. item.addLore(ingredients, 6, "2 Wirbelranken");
  58. item.addLore(ingredients, 7, "1 Karmesinpilz");
  59. player.giveSingleItem(player, ingredients, true);
  60. goto("wait");
  61. }
  62. if(event == "item_air_click") {
  63. if(hand == "OFF_HAND") {
  64. goto("wait");
  65. }
  66. item = living.getEquip(player, "hand");
  67. item_type = item.getType(item);
  68. if(item_type == "minecraft:paper") {
  69. c = 0;
  70. msg(player, "§5Noch zu sammelnde Zutaten für Kunibert:");
  71. diff = brown_mushroom_needed - brown_mushroom;
  72. if(diff > 0) {
  73. c++;
  74. msg(player, "§5 - §r", text.number(diff), " braune Pilze");
  75. }
  76. diff = red_mushroom_needed - red_mushroom;
  77. if(diff > 0) {
  78. c++;
  79. msg(player, "§5 - §r", text.number(diff), " rote Pilze");
  80. }
  81. diff = nether_wart_needed - nether_wart;
  82. if(diff > 0) {
  83. c++;
  84. msg(player, "§5 - §r", text.number(diff), " Netherwarzen");
  85. }
  86. diff = crimson_roots_needed - crimson_roots;
  87. if(diff > 0) {
  88. c++;
  89. msg(player, "§5 - §r", text.number(diff), " Karmesinwurzeln");
  90. }
  91. diff = warped_fungus_needed - warped_fungus;
  92. if(diff > 0) {
  93. c++;
  94. msg(player, "§5 - §r", text.number(diff), " Wirrpilz");
  95. }
  96. diff = warped_roots_needed - warped_roots;
  97. if(diff > 0) {
  98. c++;
  99. msg(player, "§5 - §r", text.number(diff), " Wirrwurzeln");
  100. }
  101. diff = twisting_vines_needed - twisting_vines;
  102. if(diff > 0) {
  103. c++;
  104. msg(player, "§5 - §r", text.number(diff), " Wirbelranken");
  105. }
  106. diff = crimson_fungus_needed - crimson_fungus;
  107. if(diff > 0) {
  108. c++;
  109. msg(player, "§5 - §r", text.number(diff), " Karmesinpilz");
  110. }
  111. if(c == 0) {
  112. msg(player, "§5 - §rAlles gesammelt.");
  113. }
  114. }
  115. goto("wait");
  116. }
  117. if(event == "block_break") {
  118. if(block_type == "minecraft:brown_mushroom") {
  119. cancel = false;
  120. scheduler.setBlock(5, block_loc, block_type, false);
  121. brown_mushroom++;
  122. if(brown_mushroom == brown_mushroom_needed) {
  123. stage.increase(player);
  124. }
  125. }
  126. if(block_type == "minecraft:red_mushroom") {
  127. cancel = false;
  128. scheduler.setBlock(5, block_loc, block_type, false);
  129. red_mushroom++;
  130. if(red_mushroom == red_mushroom_needed) {
  131. stage.increase(player);
  132. }
  133. }
  134. if(block_type == "minecraft:nether_wart") {
  135. cancel = false;
  136. age = block.property.getValue(block_loc, age_prop_3);
  137. scheduler.setBlock(5, block_loc, concat(block_type, "[age=", text.number(age), "]"), false);
  138. nether_wart++;
  139. if(nether_wart == nether_wart_needed) {
  140. stage.increase(player);
  141. }
  142. }
  143. if(block_type == "minecraft:crimson_roots") {
  144. cancel = false;
  145. scheduler.setBlock(5, block_loc, block_type, false);
  146. crimson_roots++;
  147. if(crimson_roots == crimson_roots_needed) {
  148. stage.increase(player);
  149. }
  150. }
  151. if(block_type == "minecraft:crimson_fungus") {
  152. cancel = false;
  153. scheduler.setBlock(5, block_loc, block_type, false);
  154. crimson_fungus++;
  155. if(crimson_fungus == crimson_fungus_needed) {
  156. stage.increase(player);
  157. }
  158. }
  159. if(block_type == "minecraft:warped_roots") {
  160. cancel = false;
  161. scheduler.setBlock(5, block_loc, block_type, false);
  162. warped_roots++;
  163. if(warped_roots == warped_roots_needed) {
  164. stage.increase(player);
  165. }
  166. }
  167. if(block_type == "minecraft:warped_fungus") {
  168. cancel = false;
  169. scheduler.setBlock(5, block_loc, block_type, false);
  170. warped_fungus++;
  171. if(warped_fungus == warped_fungus_needed) {
  172. stage.increase(player);
  173. }
  174. }
  175. if(block_type == "minecraft:twisting_vines") {
  176. item = living.getEquip(player, "hand");
  177. item_type = item.getType(item);
  178. if(item_type == "minecraft:shears") {
  179. cancel = false;
  180. scheduler.setBlock(5, block_loc, block_type, false);
  181. twisting_vines++;
  182. if(twisting_vines == twisting_vines_needed) {
  183. stage.increase(player);
  184. }
  185. } else {
  186. msg.prefix(player, "§dKunibert", "Wirbelranken müssen mit einer Schere abgebaut werden.");
  187. }
  188. }
  189. }
  190. if(stage == 8) {
  191. goto("stage8");
  192. }
  193. goto("wait");
  194. @stage8
  195. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  196. entity_name = entity.getName(entity);
  197. if(entity_name == "Kunibert") {
  198. item = living.getEquip(player, "hand");
  199. item_type = item.getType(item);
  200. if(item_type == "minecraft:brown_mushroom") {
  201. if(brown_mushroom_needed > 0) {
  202. rest_amount = human.giveItem(entity_name, player, item_type, brown_mushroom_needed);
  203. if(rest_amount == 0) {
  204. msg.prefix(player, "§dKunibert", "Danke für die braunen Pilze.");
  205. }
  206. brown_mushroom_needed = rest_amount;
  207. }
  208. }
  209. elseif(item_type == "minecraft:red_mushroom") {
  210. if(red_mushroom_needed > 0) {
  211. rest_amount = human.giveItem(entity_name, player, item_type, red_mushroom_needed);
  212. if(rest_amount == 0) {
  213. msg.prefix(player, "§dKunibert", "Danke für die roten Pilze.");
  214. }
  215. red_mushroom_needed = rest_amount;
  216. }
  217. }
  218. elseif(item_type == "minecraft:nether_wart") {
  219. if(nether_wart_needed > 0) {
  220. rest_amount = human.giveItem(entity_name, player, item_type, nether_wart_needed);
  221. if(rest_amount == 0) {
  222. msg.prefix(player, "§dKunibert", "Danke für die Netherwarzen.");
  223. }
  224. nether_wart_needed = rest_amount;
  225. }
  226. }
  227. elseif(item_type == "minecraft:crimson_roots") {
  228. if(crimson_roots_needed > 0) {
  229. rest_amount = human.giveItem(entity_name, player, item_type, crimson_roots_needed);
  230. if(rest_amount == 0) {
  231. msg.prefix(player, "§dKunibert", "Danke für die Karmesinwurzeln.");
  232. }
  233. crimson_roots_needed = rest_amount;
  234. }
  235. }
  236. elseif(item_type == "minecraft:crimson_fungus") {
  237. if(crimson_fungus_needed > 0) {
  238. rest_amount = human.giveItem(entity_name, player, item_type, crimson_fungus_needed);
  239. if(rest_amount == 0) {
  240. msg.prefix(player, "§dKunibert", "Danke für den Karmesinpilz.");
  241. }
  242. crimson_fungus_needed = rest_amount;
  243. }
  244. }
  245. if(item_type == "minecraft:warped_roots") {
  246. if(warped_roots_needed > 0) {
  247. rest_amount = human.giveItem(entity_name, player, item_type, warped_roots_needed);
  248. if(rest_amount == 0) {
  249. msg.prefix(player, "§dKunibert", "Danke für die Wirrwurzeln.");
  250. }
  251. warped_roots_needed = rest_amount;
  252. }
  253. }
  254. elseif(item_type == "minecraft:warped_fungus") {
  255. if(warped_fungus_needed > 0) {
  256. rest_amount = human.giveItem(entity_name, player, item_type, warped_fungus_needed);
  257. if(rest_amount == 0) {
  258. msg.prefix(player, "§dKunibert", "Danke für den Wirrpilz.");
  259. }
  260. warped_fungus_needed = rest_amount;
  261. }
  262. }
  263. elseif(item_type == "minecraft:twisting_vines") {
  264. if(twisting_vines_needed > 0) {
  265. rest_amount = human.giveItem(entity_name, player, item_type, twisting_vines_needed);
  266. if(rest_amount == 0) {
  267. msg.prefix(player, "§dKunibert", "Danke für die Zwirbelranken.");
  268. }
  269. twisting_vines_needed = rest_amount;
  270. }
  271. }
  272. if(brown_mushroom_needed == 0 && red_mushroom_needed == 0 && nether_wart_needed == 0 && crimson_roots_needed == 0 && crimson_fungus_needed == 0 && warped_roots_needed == 0 && warped_fungus_needed == 0 && twisting_vines_needed == 0) {
  273. msg.prefix(player, "§dKunibert", "Damit kann ich einiges anstellen. Vielen Dank!");
  274. money.addBoost(player, 24);
  275. msg(player, "§dQuest abgeschlossen. Belohnung: 24 Snuvis!");
  276. quest.finish(script, player);
  277. }
  278. }
  279. }
  280. goto("wait");