felsmagier.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. event.load("entity_click");
  2. event.load("block_click");
  3. event.load("custom_command");
  4. event.load("quest_start");
  5. event.load("quest_term");
  6. event.load("living_death");
  7. event.load("bucket_use");
  8. event.load("block_break");
  9. warts_harvested = 0;
  10. mob_killed = false;
  11. stage = 0;
  12. all_stages = 24;
  13. quest_name = "Der Felsmagier...";
  14. open_prop = block.getproperty("open");
  15. half_prop = block.getproperty("double_block_half");
  16. key = read.item("km:golden_key", 1, "Turmschlüssel", "Felsmagier");
  17. world = world.get("story");
  18. zombie_loc = loc.new(world, -1625.5, 87, 57.5);
  19. skeleton_loc = loc.new(world, -1622.5, 90.5, 62.5);
  20. blaze_loc = loc.new(world, -1621, 93, 69);
  21. spider_loc = loc.new(world, -1627, 98, 65);
  22. witch_loc = loc.new(world, -1623.5, 102, 63.5);
  23. cauldron_loc = loc.new(world, -1624, 115, 57);
  24. cave_spider_loc = loc.new(world, -1622.5, 123, 64.5);
  25. giveup_loc = loc.new(world, -1621.5, 85, 73.5);
  26. doors_to_close = list.new();
  27. visited_doors = list.new();
  28. iron_doors = list.new();
  29. list.add(iron_doors, loc.new(world, -1622, 85, 67));
  30. list.add(iron_doors, loc.new(world, -1623, 87, 60));
  31. list.add(iron_doors, loc.new(world, -1627, 88, 64));
  32. list.add(iron_doors, loc.new(world, -1619, 89, 66));
  33. list.add(iron_doors, loc.new(world, -1627, 93, 65));
  34. list.add(iron_doors, loc.new(world, -1623, 98, 61));
  35. list.add(iron_doors, loc.new(world, -1621, 102, 66));
  36. list.add(iron_doors, loc.new(world, -1621, 104, 63));
  37. @wait
  38. wait();
  39. if(event == "living_death") {
  40. player = player.getFromDamageSource(damage_source);
  41. if(player == null) {
  42. goto("wait");
  43. }
  44. }
  45. if(!player.isQuester(player, script)) {
  46. goto("wait");
  47. }
  48. if(event == "quest_term") {
  49. player.removeItem(player, key);
  50. entity.teleport(player, giveup_loc);
  51. wait(); //Script wird von außen terminiert
  52. }
  53. if(event == "block_click" && hand == "MAIN_HAND" && block.getType(block_loc) == "minecraft:iron_door") {
  54. item = living.getEquip(player, "hand");
  55. if(item.getType(item) == "km:golden_key" && item.getName(item) == "Turmschlüssel") {
  56. state_open = block.property.getValue(block_loc, open_prop);
  57. state_half = block.property.getValue(block_loc, half_prop);
  58. if(state_half == "upper") {
  59. door_loc = loc.mod(block_loc, 0, -1, 0);
  60. } else {
  61. door_loc = block_loc;
  62. }
  63. if(list.contains(visited_doors, door_loc)) {
  64. if(!state_open) {
  65. opendoor(door_loc);
  66. sgoto(60, "closedoor");
  67. }
  68. goto("wait");
  69. }
  70. if(list.contains(iron_doors, door_loc)) {
  71. if(stage == 1) {
  72. stage.increase(player);
  73. } elseif(stage == 2) {
  74. stage.increase(player);
  75. entity.spawn("zombie", zombie_loc);
  76. } elseif(stage == 4 && mob_killed) {
  77. stage.increase(player);
  78. } elseif(stage == 5) {
  79. stage.increase(player);
  80. entity.spawn("skeleton", skeleton_loc);
  81. } elseif(stage == 7 && mob_killed) {
  82. stage.increase(player);
  83. entity.spawn("blaze", blaze_loc);
  84. } elseif(stage == 9 && mob_killed) {
  85. stage.increase(player);
  86. entity.spawn("spider", spider_loc);
  87. } elseif(stage == 11 && mob_killed) {
  88. stage.increase(player);
  89. entity.spawn("witch", witch_loc);
  90. } elseif(stage == 13 && mob_killed) {
  91. stage.increase(player);
  92. } else {
  93. goto("wait");
  94. }
  95. if(!state_open) {
  96. mob_killed = false;
  97. opendoor(door_loc);
  98. sgoto(60, "closedoor");
  99. }
  100. }
  101. goto("wait");
  102. }
  103. }
  104. if(event == "quest_start") {
  105. quest.display(player, quest_name, stage, all_stages);
  106. msg.prefix(player, "§dZauberlehrling", "Der Schlüssel zum Magier? Du kannst ihn haben, wenn du mir Brot gibst.");
  107. goto("wait");
  108. }
  109. label = concat("stage", text.number(stage));
  110. ignoreGoto(label);
  111. goto("wait");
  112. @stage0
  113. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  114. entity_name = entity.getName(entity);
  115. if(entity_name == "Zauberlehrling") {
  116. item = living.getEquip(player, "hand");
  117. if(item.getType(item) != "minecraft:bread") {
  118. msg.prefix(player, "§dZauberlehrling", "Das kann ich nicht gebrauchen.");
  119. goto("wait");
  120. }
  121. player.removeItem(player, read.item("minecraft:bread"));
  122. player.giveSingleItem(player, key, true);
  123. player.giveSingleItem(player, read.item("minecraft:stone_sword"), false);
  124. player.giveSingleItem(player, read.item("minecraft:shield"), false);
  125. msg.prefix(player, "§dZauberlehrling", "Rechtsklicke Türen damit, um sie zu öffnen.");
  126. scheduler.msgPrefix(30, player, "§dZauberlehrling", "Auf deinem Weg zum Magier musst du durch mehrere Räume.");
  127. scheduler.msgPrefix(60, player, "§dZauberlehrling", "Pass auf dich auf!");
  128. stage.increase(player);
  129. }
  130. }
  131. goto("wait");
  132. @stage3
  133. if(event == "living_death") {
  134. entity_type = entity.getType(living_entity);
  135. if(entity_type == "zombie") {
  136. mob_killed = true;
  137. stage.increase(player);
  138. }
  139. }
  140. goto("wait");
  141. @stage6
  142. if(event == "living_death") {
  143. entity_type = entity.getType(living_entity);
  144. if(entity_type == "skeleton") {
  145. mob_killed = true;
  146. stage.increase(player);
  147. }
  148. }
  149. goto("wait");
  150. @stage8
  151. if(event == "living_death") {
  152. entity_type = entity.getType(living_entity);
  153. if(entity_type == "blaze") {
  154. mob_killed = true;
  155. stage.increase(player);
  156. }
  157. }
  158. goto("wait");
  159. @stage10
  160. if(event == "living_death") {
  161. entity_type = entity.getType(living_entity);
  162. if(entity_type == "spider") {
  163. mob_killed = true;
  164. stage.increase(player);
  165. }
  166. }
  167. goto("wait");
  168. @stage12
  169. if(event == "living_death") {
  170. entity_type = entity.getType(living_entity);
  171. if(entity_type == "witch") {
  172. mob_killed = true;
  173. stage.increase(player);
  174. }
  175. }
  176. goto("wait");
  177. @stage14
  178. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  179. entity_name = entity.getName(entity);
  180. if(entity_name == "Felsmagier") {
  181. item = living.getEquip(player, "hand");
  182. if(item.getType(item) != "km:golden_key" && item.getName(item) != "Turmschlüssel") {
  183. msg.prefix(player, "§dFelsmagier", "Gib mir bitte den Turmschlüssel.");
  184. goto("wait");
  185. }
  186. player.removeItem(player, key);
  187. stage.increase(player);
  188. msg.prefix(player, "§dFelsmagier", "Bevor ich dir Skills anbiete, musst du zuerst ein paar Aufgaben für mich erledigen.");
  189. scheduler.msgPrefix(30, player, "§dFelsmagier", "Eine Spinne hat sich in meinem Dachboden eingenistet. Bitte gehe nach oben und töte sie.");
  190. entity.spawn("cave_spider", cave_spider_loc);
  191. }
  192. }
  193. goto("wait");
  194. @stage15
  195. if(event == "living_death") {
  196. entity_type = entity.getType(living_entity);
  197. if(entity_type == "cave_spider") {
  198. msg.prefix(player, "§dFelsmagier", "Gute Arbeit. Komm zurück zu mir.");
  199. stage.increase(player);
  200. }
  201. }
  202. goto("wait");
  203. @stage16
  204. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  205. entity_name = entity.getName(entity);
  206. if(entity_name == "Felsmagier") {
  207. msg.prefix(player, "§dFelsmagier", "Nimm diesen Eimer, fülle ihn mit Wasser und leere in dann in den Kessel.");
  208. player.safeGiveItem(player, read.item("minecraft:bucket"));
  209. block.set(cauldron_loc, "minecraft:cauldron[level=0]");
  210. stage.increase(player);
  211. }
  212. }
  213. goto("wait");
  214. @stage17
  215. if(event == "bucket_use" && has_block) {
  216. cancel = false;
  217. if(block.gotWater(block, block_type, block_loc)) {
  218. stage.increase(player);
  219. }
  220. }
  221. goto("wait");
  222. @stage18
  223. if(event == "block_click" && hand == "MAIN_HAND") {
  224. item = living.getEquip(player, "hand");
  225. if(block.getType(block_loc) == "minecraft:cauldron" && item.getType(item) == "minecraft:water_bucket") {
  226. msg.prefix(player, "§dFelsmagier", "Gut gemacht. Komm zurück zu mir.");
  227. stage.increase(player);
  228. player.removeItem(player, read.item("minecraft:water_bucket"));
  229. block.set(cauldron_loc, "minecraft:cauldron[level=3]");
  230. }
  231. }
  232. goto("wait");
  233. @stage19
  234. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  235. entity_name = entity.getName(entity);
  236. if(entity_name == "Felsmagier") {
  237. msg.prefix(player, "§dFelsmagier", "Gehe nach oben in den Dachboden, sammle ein paar Netherwarzen und gib mir alle, die du gesammelt hast!");
  238. stage.increase(player);
  239. }
  240. }
  241. goto("wait");
  242. @stage20
  243. if(event == "block_break") {
  244. cancel = true;
  245. if(block.getType(block_loc) == "minecraft:nether_wart" && warts_harvested < 4) {
  246. cancel = true;
  247. amount = math.random(1, 3);
  248. item.drop(block_loc, read.item("minecraft:nether_wart", amount));
  249. warts_harvested += amount;
  250. if(warts_harvested >= 4) {
  251. stage.increase(player);
  252. }
  253. }
  254. }
  255. goto("wait");
  256. @stage21
  257. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  258. entity_name = entity.getName(entity);
  259. if(entity_name == "Felsmagier") {
  260. rest_amount = human.giveItem(entity_name, player, "minecraft:nether_wart", warts_harvested);
  261. if(rest_amount == 0) {
  262. stage.increase(player);
  263. msg.prefix(player, "§dFelsmagier", "Danke dir.");
  264. scheduler.msgPrefix(30, player, "§dFelsmagier", "Bitte gehe nach unten und koche das für mich.");
  265. player.safeGiveItem(player, read.item("minecraft:coal"));
  266. player.safeGiveItem(player, read.item("km:mushroom_stick_raw"));
  267. } else {
  268. warts_harvested = rest_amount;
  269. }
  270. }
  271. }
  272. goto("wait");
  273. @stage22
  274. if(event == "block_click" && hand == "MAIN_HAND") {
  275. if(block.getType(block_loc) == "minecraft:furnace") {
  276. stage.increase(player);
  277. }
  278. }
  279. goto("wait");
  280. @stage23
  281. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  282. entity_name = entity.getName(entity);
  283. if(entity_name == "Felsmagier") {
  284. item = living.getEquip(player, "hand");
  285. if(item.getType(item) == "km:mushroom_stick_cooked") {
  286. msg.prefix(player, "§dFelsmagier", "Danke dir.");
  287. player.removeItem(player, read.item("km:mushroom_stick_cooked"));
  288. admont_script = script.get("QuestsAdmont");
  289. map = script.getVar(admont_script, "timestamp");
  290. map.add(map, player.getUuid(player), time.getMillis());
  291. msg(player, "§dQuest abgeschlossen. Belohnung: 45 Snuvis!");
  292. msg(player, text.click("§r [§cclick§r] §f[§bTeleport§f] zum Story-Spawn.", "/story"));
  293. money.addBoost(player, 45);
  294. quest.finish(script, player);
  295. }
  296. }
  297. }
  298. goto("wait");
  299. function opendoor(loc) {
  300. block.setDoorStatus(loc, true);
  301. list.add($doors_to_close, loc);
  302. if(!list.contains($visited_doors, loc)) {
  303. list.add($visited_doors, loc);
  304. }
  305. }
  306. @closedoor
  307. doorloc = list.getIndex(doors_to_close, 0);
  308. list.removeIndex(doors_to_close, 0);
  309. if(block.getType(doorloc) == "minecraft:iron_door") {
  310. if(block.getDoorStatus(doorloc)) {
  311. block.setDoorStatus(doorloc, false);
  312. }
  313. }
  314. goto("wait");