xmas.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. event.load("block_click");
  2. event.load("player_logout");
  3. event.load("entity_death");
  4. event.load("entity_click");
  5. event.load("inv_click");
  6. silvercoin = read.item("km:coin_silver");
  7. icespawn = loc.new(world.get("iceworld"), 1071, 65, 2046, -90, 0);
  8. icespawntpsign = loc.new(world.get("games"), -412, 88, 110);
  9. map.new(progress);
  10. map.new(mobtype);
  11. map.new(allmobs);
  12. map.add(allmobs, "EntityZombie", "Zombies");
  13. map.add(allmobs, "EntitySpider", "Spinnen");
  14. map.add(allmobs, "EntityCreeper", "Creeper");
  15. map.add(allmobs, "EntitySkeleton", "Skelette");
  16. inv.newDynamic(xmasinv1, "222200022", "XMAS");
  17. inv.setItem(xmasinv1, 0, read.item("minecraft:rotten_flesh", 1, 0, "§r5 Zombies töten"));
  18. inv.setItem(xmasinv1, 1, read.item("minecraft:string", 1, 0, "§r5 Spinnen töten"));
  19. inv.setItem(xmasinv1, 2, read.item("minecraft:gunpowder", 1, 0, "§r5 Creeper töten"));
  20. inv.setItem(xmasinv1, 3, read.item("minecraft:bow", 1, 0, "§r5 Skelette töten"));
  21. inv.setItem(xmasinv1, 4, read.item("km:check_green", 1, 0, "§rQuest abgeben"));
  22. inv.setItem(xmasinv1, 5, read.item("minecraft:iron_bars", 1, 0, "§rQuest aufgeben"));
  23. inv.newDynamic(xmasinv2, "222200022", "XMAS");
  24. inv.setItem(xmasinv2, 0, read.item("minecraft:rotten_flesh", 1, 0, "§r5 Zombies töten"));
  25. inv.setItem(xmasinv2, 1, read.item("minecraft:string", 1, 0, "§r5 Spinnen töten"));
  26. inv.setItem(xmasinv2, 2, read.item("minecraft:gunpowder", 1, 0, "§r5 Creeper töten"));
  27. inv.setItem(xmasinv2, 3, read.item("minecraft:bow", 1, 0, "§r5 Skelette töten"));
  28. inv.setItem(xmasinv2, 4, read.item("km:cross_red", 1, 0, "§rQuest abgeben"));
  29. inv.setItem(xmasinv2, 5, read.item("minecraft:iron_bars", 1, 0, "§rQuest aufgeben"));
  30. msg("dev", "§bxmas §rwurde geladen");
  31. @wait
  32. wait();
  33. if(event == "block_click") {
  34. if(block_loc == icespawntpsign) {
  35. entity.teleport(player, icespawn);
  36. player.giveItem(player, read.item("km:iron_battleaxe"));
  37. player.giveItem(player, read.item("minecraft:bow"));
  38. player.giveItem(player, read.item("minecraft:arrow", 64));
  39. player.giveItem(player, read.item("km:bronze_helmet"));
  40. player.giveItem(player, read.item("km:bronze_chestplate"));
  41. player.giveItem(player, read.item("km:bronze_leggings"));
  42. player.giveItem(player, read.item("km:bronze_boots"));
  43. player.giveItem(player, read.item("km:mushroom_stick_cooked", 64));
  44. player.giveItem(player, read.item("km:camp_fire"));
  45. player.giveItem(player, read.item("km:bronze_pickaxe"));
  46. player.giveItem(player, read.item("km:bronze_axe"));
  47. player.giveItem(player, read.item("km:bronze_shovel"));
  48. player.giveItem(player, read.item("km:lantern", 5));
  49. }
  50. goto("wait");
  51. }
  52. if(event == "player_logout") {
  53. map.remove(progress, player_name);
  54. map.remove(mobtype, player_name);
  55. goto("wait");
  56. }
  57. if(event == "inv_click") {
  58. if(inv_slot < 4) {
  59. if(map.contains(progress, player_name)) {
  60. player.speak($player, "§dXMAS", "Du hast bereits eine Quest.");
  61. goto("wait");
  62. }
  63. }
  64. if(inv_slot == 0) {
  65. mob = "EntityZombie";
  66. } elseif(inv_slot == 1) {
  67. mob = "EntitySpider";
  68. } elseif(inv_slot == 2) {
  69. mob = "EntityCreeper";
  70. } elseif(inv_slot == 3) {
  71. mob = "EntitySkeleton";
  72. } elseif(inv_slot == 4) {
  73. if(!map.contains(progress, player_name)) {
  74. player.speak(player, "§dXMAS", "Du hast keine Quest.");
  75. goto("wait");
  76. }
  77. points = map.get(progress, player_name);
  78. if(points >= 5) {
  79. player.giveItem(player, silvercoin);
  80. map.remove(progress, player_name);
  81. map.remove(mobtype, player_name);
  82. player.speak(player, "§dXMAS", "Quest geschafft.");
  83. display.remove(player, 0);
  84. inv.open(xmasinv2, player);
  85. goto("wait");
  86. }
  87. player.speak(player, "§dXMAS", "Quest noch nicht geschafft.");
  88. goto("wait");
  89. } elseif(inv_slot == 5) {
  90. if(!map.contains(progress, player_name)) {
  91. player.speak(player, "§dXMAS", "Du hast keine Quest.");
  92. goto("wait");
  93. }
  94. map.remove(progress, player_name);
  95. map.remove(mobtype, player_name);
  96. player.speak(player, "§dXMAS", "Quest wurde aufgegeben.");
  97. display.remove(player, 0);
  98. goto("wait");
  99. }
  100. mobname = map.get(allmobs, mob);
  101. player.speak(player, "§dXMAS", concat("Töte 5 ", mobname));
  102. display.add(player, 0, concat("§6", mobname, " §r", 0, "/5"));
  103. map.add(progress, player_name, 0);
  104. map.add(mobtype, player_name, mob);
  105. inv.close(player);
  106. goto("wait");
  107. }
  108. if(event == "entity_click") {
  109. if(entity.getName(entity) == "Questgeber") {
  110. if(map.contains(progress, player_name)) {
  111. if(map.get(progress, player_name) >= 5) {
  112. inv.open(xmasinv1, player);
  113. goto("wait");
  114. }
  115. }
  116. inv.open(xmasinv2, player);
  117. }
  118. goto("wait");
  119. }
  120. if(event == "entity_death") {
  121. if(player_involved) {
  122. if(map.contains(allmobs, text.class(entity))) {
  123. if(map.contains(progress, player_name)) {
  124. pointsnew = map.get(progress, player_name) + 1;
  125. if(pointsnew < 6) {
  126. map.add(progress, player_name, pointsnew);
  127. display.add(player, 0, concat("§6", mobname, " §r", text.number(pointsnew), "/5"));
  128. }
  129. }
  130. }
  131. }
  132. goto("wait");
  133. }
  134. goto("wait");