survival.txt 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. event.load("entity_click");
  2. event.load("inv_click");
  3. event.load("player_pre_respawn");
  4. event.load("player_post_respawn");
  5. event.load("player_login");
  6. event.load("player_move");
  7. event.load("block_break");
  8. event.load("block_click");
  9. event.load("living_death");
  10. event.load("living_pre_hurt");
  11. event.load("player_toss");
  12. event.load("pre_explosion");
  13. event.load("mob_griefing");
  14. event.load("item_air_click");
  15. setScriptVar("skills", list.new());
  16. skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
  17. skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
  18. skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 1000, true, false, false);
  19. skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 500, true, false, false);
  20. skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false);
  21. skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
  22. skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
  23. skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
  24. skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
  25. skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
  26. skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
  27. skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
  28. skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
  29. clan.loadData();
  30. items_list = list.new(); //Array-List: Alle Items mit Rezepten
  31. recipe_site_map = map.new();
  32. tp_list = list.new();
  33. tp_map = map.new();
  34. afk_loop_map = map.new();
  35. death_loc_map = map.new();
  36. survival_respawn = set.new();
  37. overworld = world.getOverWorld();
  38. moveid_storyspawn = event.addMoveData(loc.new(overworld, 167, 70, 241), loc.new(overworld, 169, 72, 243), 5, -1);
  39. moveid_gamesspawn = event.addMoveData(loc.new(overworld, 219, 66, 253), loc.new(overworld, 223, 69, 258), 5, -1);
  40. move_id_afk_loop = event.addMoveData(loc.new(overworld, 208, 69, 226), loc.new(overworld, 209, 69.5, 227), 5, -1);
  41. config = getScriptVar("server_config");
  42. survival_spawn = read.location(config.getString(config, "surv_spawn", "games:0:0:0"));
  43. adventure_chest_loc = loc.new(overworld, 177, 74, 237);
  44. adventure_aim_loc = loc.new(overworld, 180, 70, 241);
  45. lottery_loc_1 = loc.new(overworld, 186, 69, 227);
  46. lottery_loc_2 = loc.new(overworld, 186, 69, 223);
  47. gambler_loc = loc.new(overworld, 185, 68, 225);
  48. prefix_money = "§2Money";
  49. prefix_skill = "§2Skill";
  50. max_ench_lvl = map.new();
  51. map.add(max_ench_lvl, enchantment.get("efficiency"), 10);
  52. map.add(max_ench_lvl, enchantment.get("smite"), 7);
  53. map.add(max_ench_lvl, enchantment.get("bane_of_arthropods"), 7);
  54. map.add(max_ench_lvl, enchantment.get("loyalty"), 5);
  55. map.add(max_ench_lvl, enchantment.get("piercing"), 5);
  56. map.add(max_ench_lvl, enchantment.get("lure"), 5);
  57. map.add(max_ench_lvl, enchantment.get("luck_of_the_sea"), 5);
  58. map.add(max_ench_lvl, enchantment.get("riptide"), 5);
  59. map.add(max_ench_lvl, enchantment.get("unbreaking"), 5);
  60. map.add(max_ench_lvl, enchantment.get("quick_charge"), 5);
  61. map.add(max_ench_lvl, enchantment.get("protection"), 4);
  62. map.add(max_ench_lvl, enchantment.get("fire_protection"), 4);
  63. map.add(max_ench_lvl, enchantment.get("blast_protection"), 4);
  64. map.add(max_ench_lvl, enchantment.get("projectile_protection"), 4);
  65. map.add(max_ench_lvl, enchantment.get("feather_falling"), 4);
  66. map.add(max_ench_lvl, enchantment.get("respiration"), 3);
  67. map.add(max_ench_lvl, enchantment.get("thorns"), 3);
  68. map.add(max_ench_lvl, enchantment.get("depth_strider"), 4);
  69. map.add(max_ench_lvl, enchantment.get("frost_walker"), 2);
  70. map.add(max_ench_lvl, enchantment.get("soul_speed"), 3);
  71. map.add(max_ench_lvl, enchantment.get("sharpness"), 5);
  72. map.add(max_ench_lvl, enchantment.get("knockback"), 2);
  73. map.add(max_ench_lvl, enchantment.get("fire_aspect"), 2);
  74. map.add(max_ench_lvl, enchantment.get("looting"), 3);
  75. map.add(max_ench_lvl, enchantment.get("sweeping_edge"), 3);
  76. map.add(max_ench_lvl, enchantment.get("power"), 5);
  77. map.add(max_ench_lvl, enchantment.get("punch"), 2);
  78. map.add(max_ench_lvl, enchantment.get("impaling"), 5);
  79. map.add(max_ench_lvl, enchantment.get("fortune"), 3);
  80. air = "minecraft:air";
  81. air_item = read.item(air);
  82. leather = "minecraft:leather";
  83. string = "minecraft:string";
  84. iron_ingot = "minecraft:iron_ingot";
  85. bronze_ingot = "km:bronze_ingot";
  86. copper_ingot = "km:copper_ingot";
  87. tin_ingot = "km:tin_ingot";
  88. silver_ingot = "km:silver_ingot";
  89. stick = "minecraft:stick";
  90. planks = "minecraft:oak_planks";
  91. cobblestone = "minecraft:cobblestone";
  92. iron_ingot = "minecraft:iron_ingot";
  93. gold_ingot = "minecraft:gold_ingot";
  94. diamond = "minecraft:diamond";
  95. book = "minecraft:book";
  96. birch_planks = "minecraft:birch_planks";
  97. dark_oak_planks = "minecraft:dark_oak_planks";
  98. jungle_planks = "minecraft:jungle_planks";
  99. spruce_planks = "minecraft:spruce_planks";
  100. acacia_planks = "minecraft:acacia_planks";
  101. coarse_dirt = "minecraft:coarse_dirt";
  102. gravel = "minecraft:gravel";
  103. wheat = "minecraft:wheat";
  104. grass = "minecraft:grass";
  105. iron_nugget = "minecraft:iron_nugget";
  106. hay_bundle = "km:hay_bundle";
  107. real_hay_block = "km:real_hay_block";
  108. recipe.add(1, "minecraft:saddle", leather, leather, leather, leather, string, leather, air, iron_ingot, air);
  109. recipe.add(1, "km:bronze_helmet", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  110. recipe.add(1, "km:bronze_chestplate", bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  111. recipe.add(1, "km:bronze_leggings", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot);
  112. recipe.add(1, "km:bronze_boots", bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  113. recipe.add(1, "km:copper_helmet", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  114. recipe.add(1, "km:copper_chestplate", copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  115. recipe.add(1, "km:copper_leggings", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot);
  116. recipe.add(1, "km:copper_boots", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  117. recipe.add(1, "km:bookshelf_acacia", acacia_planks, acacia_planks, acacia_planks, book, book, book, acacia_planks, acacia_planks, acacia_planks);
  118. recipe.add(1, "km:bookshelf_birch", birch_planks, birch_planks, birch_planks, book, book, book, birch_planks, birch_planks, birch_planks);
  119. recipe.add(1, "km:bookshelf_dark_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, book, book, book, dark_oak_planks, dark_oak_planks, dark_oak_planks);
  120. recipe.add(1, "km:bookshelf_jungle", jungle_planks, jungle_planks, jungle_planks, book, book, book, jungle_planks, jungle_planks, jungle_planks);
  121. recipe.add(1, "km:bookshelf_spruce", spruce_planks, spruce_planks, spruce_planks, book, book, book, spruce_planks, spruce_planks, spruce_planks);
  122. recipe.add(1, "km:copper_block", copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  123. recipe.add(1, "km:bronze_block", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  124. recipe.add(1, "km:tin_block", tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot);
  125. recipe.add(1, "km:silver_block", silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot);
  126. recipe.add(1, "km:cooking_pot_copper", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  127. recipe.add(1, bronze_ingot, tin_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  128. recipe.add(1, copper_ingot, air, air, air, air, "km:copper_ore", air, air, air, air);
  129. recipe.add(1, tin_ingot, air, air, air, air, "km:tin_ore", air, air, air, air);
  130. recipe.add(1, silver_ingot, air, air, air, air, "km:silver_ore", air, air, air, air);
  131. recipe.add(1, "km:spikes_bronze", air, bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, air, air, air);
  132. recipe.add(1, "km:spikes_copper", air, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, air, air, air);
  133. recipe.add(1, "km:spikes_gold", air, gold_ingot, air, gold_ingot, gold_ingot, gold_ingot, air, air, air);
  134. recipe.add(1, "km:spikes_iron", air, iron_ingot, air, iron_ingot, iron_ingot, iron_ingot, air, air, air);
  135. recipe.add(1, "km:wooden_battleaxe", air, planks, planks, air, stick, planks, stick, air, air);
  136. recipe.add(1, "km:stone_battleaxe", air, cobblestone, cobblestone, air, stick, cobblestone, stick, air, air);
  137. recipe.add(1, "km:iron_battleaxe", air, iron_ingot, iron_ingot, air, stick, iron_ingot, stick, air, air);
  138. recipe.add(1, "km:golden_battleaxe", air, gold_ingot, gold_ingot, air, stick, gold_ingot, stick, air, air);
  139. recipe.add(1, "km:diamond_battleaxe", air, diamond, diamond, air, stick, diamond, stick, air, air);
  140. recipe.add(1, "km:copper_battleaxe", air, copper_ingot, copper_ingot, air, stick, copper_ingot, stick, air, air);
  141. recipe.add(1, "km:bronze_battleaxe", air, bronze_ingot, bronze_ingot, air, stick, bronze_ingot, stick, air, air);
  142. recipe.add(1, "km:copper_axe", air, copper_ingot, copper_ingot, air, copper_ingot, stick, air, air, stick);
  143. recipe.add(1, "km:bronze_axe", air, bronze_ingot, bronze_ingot, air, bronze_ingot, stick, air, air, stick);
  144. recipe.add(1, "km:wooden_dagger", air, air, planks, air, stick, air, air, air, air);
  145. recipe.add(1, "km:stone_dagger", air, air, cobblestone, air, stick, air, air, air, air);
  146. recipe.add(1, "km:iron_dagger", air, air, iron_ingot, air, stick, air, air, air, air);
  147. recipe.add(1, "km:golden_dagger", air, air, gold_ingot, air, stick, air, air, air, air);
  148. recipe.add(1, "km:diamond_dagger", air, air, diamond, air, stick, air, air, air, air);
  149. recipe.add(1, "km:copper_dagger", air, air, copper_ingot, air, stick, air, air, air, air);
  150. recipe.add(1, "km:bronze_dagger", air, air, bronze_ingot, air, stick, air, air, air, air);
  151. recipe.add(1, "km:copper_hoe", air, copper_ingot, copper_ingot, air, air, stick, air, air, stick);
  152. recipe.add(1, "km:bronze_hoe", air, bronze_ingot, bronze_ingot, air, air, stick, air, air, stick);
  153. recipe.add(1, "km:wooden_hammer", planks, planks, planks, planks, stick, planks, air, stick, air);
  154. recipe.add(1, "km:stone_hammer", cobblestone, cobblestone, cobblestone, cobblestone, stick, cobblestone, air, stick, air);
  155. recipe.add(1, "km:iron_hammer", iron_ingot, iron_ingot, iron_ingot, iron_ingot, stick, iron_ingot, air, stick, air);
  156. recipe.add(1, "km:golden_hammer", gold_ingot, gold_ingot, gold_ingot, gold_ingot, stick, gold_ingot, air, stick, air);
  157. recipe.add(1, "km:diamond_hammer", diamond, diamond, diamond, diamond, stick, diamond, air, stick, air);
  158. recipe.add(1, "km:copper_hammer", copper_ingot, copper_ingot, copper_ingot, copper_ingot, stick, copper_ingot, air, stick, air);
  159. recipe.add(1, "km:bronze_hammer", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, stick, bronze_ingot, air, stick, air);
  160. recipe.add(1, "km:copper_shovel", air, copper_ingot, air, air, stick, air, air, stick, air);
  161. recipe.add(1, "km:bronze_shovel", air, bronze_ingot, air, air, stick, air, air, stick, air);
  162. recipe.add(1, "km:wooden_scepter", air, stick, planks, air, stick, stick, stick, air, air);
  163. recipe.add(1, "km:stone_scepter", air, stick, cobblestone, air, stick, stick, stick, air, air);
  164. recipe.add(1, "km:iron_scepter", air, stick, iron_ingot, air, stick, stick, stick, air, air);
  165. recipe.add(1, "km:golden_scepter", air, stick, gold_ingot, air, stick, stick, stick, air, air);
  166. recipe.add(1, "km:diamond_scepter", air, stick, diamond, air, stick, stick, stick, air, air);
  167. recipe.add(1, "km:copper_scepter", air, stick, copper_ingot, air, stick, stick, stick, air, air);
  168. recipe.add(1, "km:bronze_scepter", air, stick, bronze_ingot, air, stick, stick, stick, air, air);
  169. recipe.add(1, "km:copper_pickaxe", copper_ingot, copper_ingot, copper_ingot, air, stick, air, air, stick, air);
  170. recipe.add(1, "km:bronze_pickaxe", bronze_ingot, bronze_ingot, bronze_ingot, air, stick, air, air, stick, air);
  171. recipe.add(1, "km:wooden_stick", air, air, planks, air, stick, air, planks, air, air);
  172. recipe.add(1, "km:stone_stick", air, air, cobblestone, air, stick, air, cobblestone, air, air);
  173. recipe.add(1, "km:iron_stick", air, air, iron_ingot, air, stick, air, iron_ingot, air, air);
  174. recipe.add(1, "km:golden_stick", air, air, gold_ingot, air, stick, air, gold_ingot, air, air);
  175. recipe.add(1, "km:diamond_stick", air, air, diamond, air, stick, air, diamond, air, air);
  176. recipe.add(1, "km:copper_stick", air, air, copper_ingot, air, stick, air, copper_ingot, air, air);
  177. recipe.add(1, "km:bronze_stick", air, air, bronze_ingot, air, stick, air, bronze_ingot, air, air);
  178. recipe.add(1, "km:copper_sword", air, copper_ingot, air, air, copper_ingot, air, air, stick, air);
  179. recipe.add(1, "km:bronze_sword", air, bronze_ingot, air, air, bronze_ingot, air, air, stick, air);
  180. recipe.add(1, "km:mushroom_stick_raw", air, "minecraft:brown_mushroom", "minecraft:brown_mushroom", air, stick, "minecraft:red_mushroom", air, air, air);
  181. recipe.add(1, "km:mushroom_stick_cooked", air, air, air, air, "km:mushroom_stick_raw", air, air, air, air);
  182. recipe.add(1, "km:fried_egg", air, air, air, air, "minecraft:egg", air, air, air, air);
  183. recipe.add(1, "km:crate_acacia", acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks);
  184. recipe.add(1, "km:crate_birch", birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks);
  185. recipe.add(1, "km:crate_big_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks);
  186. recipe.add(1, "km:crate_oak", planks, planks, planks, planks, planks, planks, planks, planks, planks);
  187. recipe.add(1, "km:crate_jungle", jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks);
  188. recipe.add(1, "km:crate_spruce", spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks);
  189. recipe.add(1, "km:coarse_dirt_slab", air, air, air, coarse_dirt, coarse_dirt, coarse_dirt, air, air, air);
  190. recipe.add(1, "km:gravel_slab", air, air, air, gravel, gravel, gravel, air, air, air);
  191. recipe.add(1, "km:straw_hat", air, wheat, air, wheat, wheat, wheat, air, air, air);
  192. recipe.add(1, hay_bundle, grass, grass, grass, grass, grass, grass, grass, grass, grass);
  193. recipe.add(1, real_hay_block, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle);
  194. recipe.add(1, "km:real_hay_bed", air, air, air, real_hay_block, real_hay_block, real_hay_block, air, air, air);
  195. recipe.add(1, "km:lantern", iron_nugget, iron_nugget, iron_nugget, "minecraft:glass_pane", "minecraft:torch", "minecraft:glass_pane", iron_nugget, iron_nugget, iron_nugget);
  196. recipe.add(1, "km:sling", stick, string, stick, stick, air, stick, air, stick, air);
  197. recipe.add(4, "minecraft:string", air, air, air, air, "minecraft:white_wool", air, air, air, air);
  198. par = particle.get("minecraft:witch");
  199. piston_sound = sound.get("block.piston.extend");
  200. adv_tp_sound = sound.get("block.portal.travel");
  201. sound_category_ambient = sound.getCategory("ambient");
  202. gambler_inv = inv.new("020202020");
  203. gambler_inv_id = inv.getId(gambler_inv);
  204. inv.setItem(gambler_inv, 0, read.item("km:coin_copper", 1, "§f1 snuvi"));
  205. inv.setItem(gambler_inv, 1, read.item("km:coin_silver", 1, "§f64 snuvis"));
  206. inv.setItem(gambler_inv, 2, read.item("km:coin_gold", 1, "§f4096 snuvis"));
  207. inv.setItem(gambler_inv, 3, read.item("minecraft:netherite_block", 1, "§fAll in"));
  208. bankmenu = inv.new("233302332233302332");
  209. bankinvid = inv.getId(bankmenu);
  210. coin_gold = read.item("km:coin_gold", 1, "§f4096 snuvis");
  211. coin_silver = read.item("km:coin_silver", 1, "§f64 snuvis");
  212. coin_copper = read.item("km:coin_copper", 1, "§f1 snuvi");
  213. coin_silver64 = read.item("km:coin_silver", 64, "§f4096 snuvis");
  214. coin_copper64 = read.item("km:coin_copper", 64, "§f64 snuvis");
  215. arrow_left = read.item("km:arrow_left", 1, "§fchange to");
  216. arrow_right = read.item("km:arrow_right", 1, "§fchange to");
  217. inv.setItem(bankmenu, 0, read.item("km:plus_green", 1, "§fDeposit..."));
  218. inv.setItem(bankmenu, 1, coin_copper);
  219. inv.setItem(bankmenu, 2, coin_silver);
  220. inv.setItem(bankmenu, 3, coin_gold);
  221. inv.setItem(bankmenu, 4, coin_copper64);
  222. inv.setItem(bankmenu, 5, arrow_left);
  223. inv.setItem(bankmenu, 6, arrow_right);
  224. inv.setItem(bankmenu, 7, coin_silver);
  225. inv.setItem(bankmenu, 8, read.item("km:minus_red", 1, "§fWithdraw..."));
  226. inv.setItem(bankmenu, 9, coin_copper);
  227. inv.setItem(bankmenu, 10, coin_silver);
  228. inv.setItem(bankmenu, 11, coin_gold);
  229. inv.setItem(bankmenu, 12, coin_silver64);
  230. inv.setItem(bankmenu, 13, arrow_left);
  231. inv.setItem(bankmenu, 14, arrow_right);
  232. inv.setItem(bankmenu, 15, coin_gold);
  233. msg("dev", "§bSurvival §rloaded.");
  234. @wait
  235. wait();
  236. if(event == "player_move") {
  237. if(id == moveid_storyspawn) {
  238. player.setBackPosLoc(player, world.getServerSpawn());
  239. player.teleport(player, world.getStorySpawn(), false);
  240. goto("wait");
  241. }
  242. if(id == moveid_gamesspawn) {
  243. player.setBackPosLoc(player, world.getServerSpawn());
  244. player.teleport(player, world.getGamesSpawn(), false);
  245. goto("wait");
  246. }
  247. if(id == move_id_afk_loop) {
  248. player_uuid = player.getUuid(player);
  249. now_time = time.getMillis();
  250. time = map.getOrDefault(afk_loop_map, player_uuid, 0);
  251. if(now_time - time > 9000) { //9 Sekunden
  252. map.add(afk_loop_map, player_uuid, now_time);
  253. addMoney(player, 1);
  254. }
  255. goto("wait");
  256. }
  257. goto("wait");
  258. }
  259. //Wenn Event aus Survival-Welten, dann wird er verarbeitet
  260. if(event == "living_death" || event == "living_pre_hurt") {
  261. loc = entity.getLocation(living_entity);
  262. } elseif(event == "pre_explosion") {
  263. loc = location;
  264. } elseif(event == "mob_griefing") {
  265. loc = entity.getLocation(entity);
  266. } else {
  267. loc = entity.getLocation(player);
  268. }
  269. world_name = world.getName(loc.getWorld(loc));
  270. if(isSurvWorldName(world_name)) {
  271. ignoreGoto(event);
  272. }
  273. goto("wait");
  274. @item_air_click
  275. player_loc = entity.getLocation(player);
  276. world = loc.getWorld(player_loc);
  277. if(world.getName(world) != "overworld") {
  278. goto("wait");
  279. }
  280. item = entity.getEquip(player, "hand");
  281. if(item.getType(item) != "minecraft:clock") {
  282. goto("wait");
  283. }
  284. time = world.getTime(world);
  285. time_h = math.roundDown(time/1000) + 6;
  286. while(time_h >= 24) {
  287. time_h -= 24;
  288. }
  289. //m min = t ticks * 60m / 1000 ticks
  290. time_m = time%1000;
  291. time_m = math.roundDown(time_m * 60 / 1000);
  292. if(time_m < 10) {
  293. time_m = concat("0", text.number(time_m));
  294. } else {
  295. time_m = text.number(time_m);
  296. }
  297. msg.prefix(player, "§eClock", concat(text.number(time_h), ":", time_m));
  298. goto("wait");
  299. @mob_griefing
  300. if(entity.getType(entity) == "enderman") {
  301. cancel = true;
  302. }
  303. goto("wait");
  304. @pre_explosion
  305. plot_list = plot.get(location);
  306. for(i = 0; i < list.getSize(plot_list); i++) {
  307. plot = list.getIndex(plot_list, i);
  308. if(plot.isExplosive(plot)) {
  309. cancel = false;
  310. }
  311. }
  312. //Kein Grundstück existiert
  313. if(i == 0) {
  314. cancel = false;
  315. }
  316. goto("wait");
  317. @player_toss
  318. target_loc = player.getTarget(player, 5);
  319. block_type = block.getType(target_loc);
  320. if(block_type == "minecraft:lectern") {
  321. cancel = true;
  322. item.entity.spawn(item.entity.new(loc.mod(target_loc, 0.5, 1.5, 0.5), item));
  323. }
  324. goto("wait");
  325. @living_pre_hurt
  326. if(!isPlayer(living_entity)) {
  327. damager = player.getFromDamageSource(damage_source);
  328. if(!isPlayer(damager)) {
  329. goto("wait");
  330. }
  331. pet_type = entity.getType(living_entity);
  332. if(pet_type == "wolf" || pet_type == "cat") {
  333. if(pet.isTamed(living_entity)) {
  334. owner = pet.getOwner(living_entity);
  335. if(owner == damager) {
  336. if(player.getNoPetDamage(player)) {
  337. cancel = true;
  338. }
  339. }
  340. }
  341. }
  342. goto("wait");
  343. }
  344. player = living_entity;
  345. damager = player.getFromDamageSource(damage_source);
  346. if(!isPlayer(damager)) {
  347. player_loc = entity.getLocation(player);
  348. if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
  349. cancel = true;
  350. }
  351. goto("wait");
  352. }
  353. if(player == damager) {
  354. goto("wait");
  355. }
  356. if(!hasPvpOn(damager)) {
  357. cancel = true;
  358. msg.prefix(damager, "§5PvP", "You have PvP disabled.");
  359. goto("wait");
  360. }
  361. if(!hasPvpOn(player)) {
  362. cancel = true;
  363. msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
  364. goto("wait");
  365. }
  366. goto("wait");
  367. @entity_click
  368. if(hand == "OFF_HAND") {
  369. goto("wait");
  370. }
  371. if(entity.getType(entity) == "human") {
  372. entity_name = entity.getName(entity);
  373. if(entity_name == "Info-Point") {
  374. msg(player, getSpacer());
  375. msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
  376. msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
  377. msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
  378. msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
  379. msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
  380. msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
  381. msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
  382. msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
  383. msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
  384. msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
  385. msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
  386. goto("wait");
  387. }
  388. if(entity_name == "Recipes") {
  389. recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
  390. recipe.setPage(player, recipe_menu, 1);
  391. inv.open(recipe_menu, player, "Recipes");
  392. goto("wait");
  393. }
  394. if(entity_name == "Banker") {
  395. inv.open(bankmenu, player, "Banker");
  396. goto("wait");
  397. }
  398. if(entity_name == "Adventure") {
  399. if(!player.isOnAdventure(player)) {
  400. msg.prefix(player, "§5Adventure", "§rYou aren't on an adventure. Click the chest in the teleporter to start an adventure.");
  401. goto("wait");
  402. }
  403. player.setAdventure(player, false);
  404. adventures = player.getAdventureAmounts(player);
  405. if(adventures == null) {
  406. adventures = 0;
  407. }
  408. player.setAdventureAmounts(player, ++adventures);
  409. msg.prefix(player, "§5Adventure", "§rCongratulations, you finished your adventure, here ist your reward!");
  410. if(adventures == 10) {
  411. offerRank(player, "rank.pioneer");
  412. } elseif(adventures == 5) {
  413. offerRank(player, "rank.explorer");
  414. } elseif(adventures == 1) {
  415. offerRank(player, "rank.adventurer");
  416. }
  417. removeAdventureDisplay(player);
  418. safeGiveItemPlayer(player, coin_silver);
  419. goto("wait");
  420. }
  421. }
  422. goto("wait");
  423. @player_login
  424. if(player.isOnAdventure(player)) {
  425. addAdventureDisplay(player, adventure_aim_loc);
  426. }
  427. goto("wait");
  428. @inv_click
  429. cancel = true;
  430. if(inv_id == bankinvid) { //Bankmenü
  431. gold_inv = player.getItemAmount(player, false, coin_gold);
  432. silver_inv = player.getItemAmount(player, false, coin_silver);
  433. copper_inv = player.getItemAmount(player, false, coin_copper);
  434. //Wechseln
  435. if(inv_slot == 5 || inv_slot == 6 || inv_slot == 13 || inv_slot == 14) {
  436. if(inv_slot == 5) {
  437. //1 Silbermünze --> 64 Kupfermünzen
  438. amount1 = 1;
  439. item1 = coin_silver;
  440. amount2 = 64;
  441. item2 = coin_copper64;
  442. message = "No silvercoin in inventory.";
  443. item_type = "km:coin_copper";
  444. coin_inv = silver_inv;
  445. }
  446. elseif(inv_slot == 6) {
  447. //64 Kupfermünzen --> 1 Silbermünze
  448. amount1 = 64;
  449. item1 = coin_copper64;
  450. amount2 = 1;
  451. item2 = coin_silver;
  452. message = "Not enough coppercoins in inventory.";
  453. item_type = "km:coin_silver";
  454. coin_inv = copper_inv;
  455. }
  456. elseif(inv_slot == 13) {
  457. //1 Goldmünze --> 64 Silbermünzen
  458. amount1 = 1;
  459. item1 = coin_gold;
  460. amount2 = 64;
  461. item2 = coin_silver64;
  462. message = "No goldcoin in inventory.";
  463. item_type = "km:coin_silver";
  464. coin_inv = gold_inv;
  465. }
  466. elseif(inv_slot == 14) {
  467. //64 Silbermünzen --> 1 Goldmünze
  468. amount1 = 64;
  469. item1 = coin_silver64;
  470. amount2 = 1;
  471. item2 = coin_gold;
  472. message = "Not enough silvercoins in inventory.";
  473. item_type = "km:coin_gold";
  474. coin_inv = silver_inv;
  475. }
  476. if(coin_inv < amount1) {
  477. msg.prefix(player, prefix_money, message);
  478. goto("wait");
  479. }
  480. player.removeItem2(player, item1);
  481. notgiven = player.giveItem(player, item2);
  482. if(item.getType(notgiven) != "minecraft:air") {
  483. amount = item.getAmount(notgiven);
  484. player.removeItem2(player, read.item(item_type, amount2 - amount));
  485. player.giveItem(player, item1);
  486. msg.prefix(player, prefix_money, "Not enough space in inventory.");
  487. goto("wait");
  488. }
  489. inv.update(player);
  490. msg.prefix(player, prefix_money, "Exchange succesfull.");
  491. goto("wait");
  492. }
  493. //Kontobewegungen
  494. if(inv_slot == 1 || inv_slot == 9) {
  495. betrag = 1;
  496. coin_inv = copper_inv;
  497. }
  498. elseif(inv_slot == 2 || inv_slot == 10) {
  499. betrag = 64;
  500. coin_inv = silver_inv;
  501. }
  502. elseif(inv_slot == 3 || inv_slot == 11) {
  503. betrag = 4096;
  504. coin_inv = gold_inv;
  505. }
  506. //Einzahlen
  507. if(inv_slot > 0 && inv_slot < 4) {
  508. player_id = player.getId(player);
  509. if(coin_inv < 1) {
  510. msg.prefix(player, prefix_money, "§rCoin not in inventory.");
  511. } else {
  512. addMoney(player, betrag);
  513. player.removeItem2(player, inv.getItem(bankmenu, inv_slot));
  514. inv.update(player);
  515. }
  516. goto("wait");
  517. }
  518. //Auszahlen
  519. if(inv_slot > 8 && inv_slot < 12) {
  520. player_id = player.getId(player);
  521. if(!hasEnoughMoney(player_id, betrag)) {
  522. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  523. } else {
  524. subMoney(player, betrag);
  525. player.giveItem(player, inv.getItem(bankmenu, inv_slot));
  526. inv.update(player);
  527. }
  528. goto("wait");
  529. }
  530. goto("wait");
  531. }
  532. if(inv_id == gambler_inv_id) {
  533. if(inv_slot == 0) {
  534. amount = 1;
  535. } elseif(inv_slot == 1) {
  536. amount = 64;
  537. } elseif(inv_slot == 2) {
  538. amount = 4096;
  539. } elseif(inv_slot == 3) {
  540. amount = getMoney(player);
  541. if(amount == 0) {
  542. msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
  543. goto("wait");
  544. }
  545. }
  546. if(!hasEnoughMoney(player, amount)) {
  547. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  548. goto("wait");
  549. }
  550. win = math.random(1, 2);
  551. if(win == 1) {
  552. addMoney(player, amount);
  553. temp = " won ";
  554. } else {
  555. subMoney(player, amount);
  556. temp = " lost ";
  557. }
  558. if(amount == 1) {
  559. message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
  560. } else {
  561. message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
  562. }
  563. msg.radius("§2Gambler", message, entity.getLocation(player), 50);
  564. goto("wait");
  565. }
  566. if(inv_name == "Recipes") {
  567. item_type = item.getType(item);
  568. if(item_type == "minecraft:air") {
  569. goto("wait");
  570. }
  571. if(item_type == "km:return_red") {
  572. page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
  573. recipe.setPage(player, inv, page);
  574. goto("wait");
  575. }
  576. if(item_type == "minecraft:paper") {
  577. name = item.getName(item);
  578. if(text.contains(name, "<<") || text.contains(name, ">>")) {
  579. page = removeFormat(name);
  580. page = text.replace(page, "<<", "");
  581. page = text.replace(page, ">>", "");
  582. page = read.number(page);
  583. if(inv_slot == 46) {
  584. recipe.setPage(player, inv, page);
  585. }
  586. if(inv_slot == 47) {
  587. recipe.setPage(player, inv, page);
  588. }
  589. goto("wait");
  590. }
  591. }
  592. index = recipe.getIndexFromItemType(item_type);
  593. if(index == null) {
  594. goto("wait");
  595. }
  596. recipe.showRecipe(player, inv, index);
  597. }
  598. goto("wait");
  599. @block_break
  600. duration = data.getTimer(player, "block_down");
  601. if(duration > 0) {
  602. do = true;
  603. loc = loc.mod(block_loc, 0, -1, 0);
  604. b_type = block.getType(loc);
  605. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  606. do = false;
  607. }
  608. if(!plot.check(loc, player, 2, true)) {
  609. do = false;
  610. }
  611. if(do) {
  612. item = block.toStack(loc);
  613. item.drop(loc, item);
  614. block.set(loc, "minecraft:air");
  615. }
  616. }
  617. duration = data.getTimer(player, "block_up");
  618. if(duration > 0) {
  619. do = true;
  620. loc = loc.mod(block_loc, 0, 1, 0);
  621. b_type = block.getType(loc);
  622. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  623. do = false;
  624. }
  625. if(!plot.check(loc, player, 2, true)) {
  626. do = false;
  627. }
  628. if(do) {
  629. item = block.toStack(loc);
  630. item.drop(loc, item);
  631. block.set(loc, "minecraft:air");
  632. }
  633. }
  634. goto("wait");
  635. @block_click
  636. if(hand == "OFF_HAND") {
  637. goto("wait");
  638. }
  639. if(block_type == "minecraft:lectern") {
  640. if(action == "right") {
  641. itementity = entity.get(loc.mod(block_loc, 0.5, 0.9, 0.5), 0.2, "net.minecraft.entity.item.ItemEntity");
  642. if(itementity == null) {
  643. goto("wait");
  644. }
  645. list = entity.near(itementity, 0.2);
  646. list.add(list, itementity);
  647. if(list.getSize(list) < 2) {
  648. //Zu wenig Items am Lesepult
  649. goto("wait");
  650. }
  651. a = array.new(2, 6); //0 = item, 1 = itementity, 2 = enchantments, 3 = enchanted, 4 = enchanted_book, 5 = book
  652. size = 0;
  653. for(i = 0; i < list.getSize(list); i++) {
  654. entity = list.getIndex(list, i);
  655. item = item.entity.get(entity);
  656. size += item.getAmount(item);
  657. if(size > 2) {
  658. //Zu viele Items am Lesepult
  659. goto("wait");
  660. }
  661. map = enchantment.readFromItem(item);
  662. a[i, 0] = item;
  663. a[i, 1] = entity;
  664. a[i, 2] = map;
  665. a[i, 4] = false;
  666. a[i, 5] = false;
  667. if(map.getSize(map) > 0) {
  668. //Verzauberte Items
  669. a[i, 3] = true;
  670. if(item.getType(item) == "minecraft:enchanted_book") {
  671. a[i, 4] = true;
  672. }
  673. } else {
  674. //Nicht verzauberte Items
  675. a[i, 3] = false;
  676. if(item.getType(item) == "minecraft:book") {
  677. a[i, 5] = true;
  678. }
  679. }
  680. }
  681. lectern_action = null;
  682. if(a[0, 4] == true && a[1, 4] == true) {
  683. //Beide Items sind verzauberte Bücher
  684. lectern_action = 0;
  685. }
  686. elseif(a[0, 5] == true || a[1, 5] == true) {
  687. //Eines der beiden Items ist ein normales Buch
  688. if(a[0, 4] == true || a[1, 4] == true) {
  689. //Eines der beiden Items ist ein verzaubertes Buch
  690. lectern_action = 1;
  691. } elseif(a[0, 3] == true || a[1, 3] == true) {
  692. //Eines der beiden Items ist ein verzaubertes Item
  693. lectern_action = 2;
  694. }
  695. }
  696. elseif(a[0, 4] == true || a[1, 4] == true) {
  697. lectern_action = 3;
  698. }
  699. if(lectern_action == null) {
  700. goto("wait");
  701. }
  702. if(lectern_action == 0) {
  703. //Verzauberungsbücher mergen
  704. item1 = a[0, 0];
  705. item_entity1 = a[0, 1];
  706. item_entity2 = a[1, 1];
  707. map1 = a[0, 2];
  708. map2 = a[1, 2];
  709. map_size1 = map.getSize(map1);
  710. map_size2 = map.getSize(map2);
  711. iter = map.iterator(map2);
  712. betrag = 0;
  713. extra = 0;
  714. while(hasNext(iter)) {
  715. element = next(iter);
  716. key = map.getKey(element);
  717. level1 = map.getValue(element);
  718. level2 = map.getOrDefault(map1, key, 0);
  719. if(level1 == level2) {
  720. max_lvl = map.get(max_ench_lvl, key);
  721. //max_lvl = map.getOrDefault(max_ench_lvl, key, enchantment.getMaxLevel(key));
  722. if(max_lvl != null) {
  723. if(level1 < max_lvl) {
  724. extra += 40;
  725. level1++;
  726. }
  727. }
  728. }
  729. if(level2 > level1) {
  730. level1 = level2;
  731. }
  732. map.add(map1, key, level1);
  733. }
  734. if(map_size1 > map_size2) {
  735. map = map1;
  736. } else {
  737. map = map2;
  738. }
  739. iter = map.iterator(map);
  740. while(hasNext(iter)) {
  741. element = next(iter);
  742. level = map.getValue(element);
  743. betrag += level * 20 + extra;
  744. }
  745. if(!hasEnoughMoney(player.getId(player), betrag)) {
  746. msg.prefix(player, prefix_money, concat("Not enough coins in inventory. This action costs ", text.number(betrag), " snuvis."));
  747. goto("wait");
  748. }
  749. subMoney(player, betrag);
  750. enchantment.writeToItem(map1, item1);
  751. item.entity.set(item_entity1, item.clone(item1));
  752. entity.remove(item_entity2);
  753. } elseif(lectern_action == 1) {
  754. //Verzauberungsbuch kopieren
  755. if(a[0, 5]) {
  756. book_index = 0;
  757. other_index = 1;
  758. } else {
  759. book_index = 1;
  760. other_index = 0;
  761. }
  762. item1 = a[book_index, 0];
  763. item_entity1 = a[book_index, 1];
  764. item2 = a[other_index, 0];
  765. item_entity2 = a[other_index, 1];
  766. map2 = a[other_index, 2];
  767. map_size = map.getSize(map2);
  768. betrag = 20 * map_size;
  769. if(!hasEnoughMoney(player.getId(player), betrag)) {
  770. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  771. goto("wait");
  772. }
  773. subMoney(player, betrag);
  774. item1 = read.item("minecraft:enchanted_book");
  775. enchantment.writeToItem(map2, item1);
  776. item.entity.set(item_entity1, item1);
  777. item.entity.set(item_entity2, item.clone(item2));
  778. } elseif(lectern_action == 2) {
  779. //Einzelne Verzauberung herunterziehen
  780. if(a[0, 5]) {
  781. book_index = 0;
  782. other_index = 1;
  783. } else {
  784. book_index = 1;
  785. other_index = 0;
  786. }
  787. item_entity1 = a[book_index, 1];
  788. map1 = map.new();
  789. item2 = a[other_index, 0];
  790. item_entity2 = a[other_index, 1];
  791. map2 = a[other_index, 2];
  792. item1 = read.item("minecraft:enchanted_book");
  793. element = next(map.iterator(map2));
  794. key = map.getKey(element);
  795. value = map.getValue(element);
  796. map.add(map1, key, value);
  797. map.remove(map2, key);
  798. betrag = 20 * value;
  799. if(!hasEnoughMoney(player.getId(player), betrag)) {
  800. msg.prefix(player, prefix_money, concat("Not enough snuvis in your ccount. This action costs ", text.number(betrag), " snuvis."));
  801. goto("wait");
  802. }
  803. subMoney(player, betrag);
  804. enchantment.writeToItem(map1, item1);
  805. enchantment.writeToItem(map2, item2);
  806. item.entity.set(item_entity1, item1);
  807. item.entity.set(item_entity2, item.clone(item2));
  808. } elseif(lectern_action == 3) {
  809. //Alle Verzauberungen vom Buch auf das Item übertragen
  810. betrag = 0;
  811. if(a[0, 4]) {
  812. ench_book_index = 0;
  813. other_index = 1;
  814. } else {
  815. ench_book_index = 1;
  816. other_index = 0;
  817. }
  818. item1 = a[ench_book_index, 0];
  819. item_entity1 = a[ench_book_index, 1];
  820. map1 = a[ench_book_index, 2];
  821. item2 = a[other_index, 0];
  822. item_entity2 = a[other_index, 1];
  823. map2 = a[other_index, 2];
  824. map_size1 = map.getSize(map1);
  825. map_size2 = map.getSize(map2);
  826. iter = map.iterator(map1);
  827. while(hasNext(iter)) {
  828. element = next(iter);
  829. key = map.getKey(element);
  830. value = map.getValue(element);
  831. value2 = map.getOrDefault(map2, key, 0);
  832. if(value2 > value) {
  833. value = value2;
  834. }
  835. map.add(map2, key, value);
  836. }
  837. if(map_size1 > map_size2) {
  838. map = map1;
  839. } else {
  840. map = map2;
  841. }
  842. iter = map.iterator(map);
  843. while(hasNext(iter)) {
  844. element = next(iter);
  845. level = map.getValue(element);
  846. betrag += level * 20;
  847. }
  848. if(!hasEnoughMoney(player.getId(player), betrag)) {
  849. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  850. goto("wait");
  851. }
  852. subMoney(player, betrag);
  853. enchantment.writeToItem(map2, item2);
  854. item.entity.set(item_entity2, item.clone(item2));
  855. entity.remove(item_entity1);
  856. }
  857. entity.throw(item_entity1, 0, 0.3, 0);
  858. entity.throw(item_entity2, 0, 0.3, 0);
  859. particle.spawn(loc.mod(block_loc, 0.5, 1.4, 0.5), par, 20, 0, 0.25, 0.25, 0.25);
  860. msg.prefix(player, prefix_money, concat("This cost " , text.number(betrag), " snuvis."));
  861. }
  862. goto("wait");
  863. }
  864. if(block_type == "minecraft:chest") {
  865. if(isATpReceiver(block_loc)) {
  866. tp_item = read.item("km:gear", 1, "§rTeleport");
  867. list = list.new();
  868. list.add(list, world.getName(loc.getWorld(block_loc)));
  869. list.add(list, text.number(loc.getX(block_loc)));
  870. list.add(list, text.number(loc.getY(block_loc)));
  871. list.add(list, text.number(loc.getZ(block_loc)));
  872. item.setLore(tp_item, list);
  873. player.giveItem(player, tp_item);
  874. goto("wait");
  875. }
  876. if(isATpTransmitter(block_loc)) {
  877. player_uuid = player.getUuid(player);
  878. clicked = map.getOrDefault(tp_map, player_uuid, 0);
  879. now_time = time.getMillis();
  880. if(now_time - clicked < 5000) {
  881. msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
  882. goto("wait");
  883. }
  884. map.add(tp_map, player_uuid, now_time);
  885. //Abenteuer-Teleport
  886. if(block_loc == adventure_chest_loc) {
  887. if(!player.isOnAdventure(player)) {
  888. if(!player.hasClearInventory(player)) {
  889. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  890. goto("wait");
  891. }
  892. alpha = math.random(0, 360);
  893. alpha *= math.pi() / 180;
  894. x = math.round(math.sin(alpha) * 10000) + 0.5;
  895. z = math.round(math.cos(alpha) * 10000) + 0.5;
  896. y = 255;
  897. tp_loc = loc.new(world.getOverWorld(), x, y, z);
  898. while(block.isAir(tp_loc)) {
  899. loc.setY(tp_loc, y);
  900. y--;
  901. }
  902. tp_loc = loc.mod(tp_loc, 0, 1, 0);
  903. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  904. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  905. array = array.new(4);
  906. array[0] = player.getUuid(player);
  907. array[1] = block_loc;
  908. array[2] = tp_loc;
  909. array[3] = true;
  910. list.add(tp_list, array);
  911. sgoto(30, "tp_ticker");
  912. }
  913. goto("wait");
  914. }
  915. //Normaler Teleport
  916. temp = false;
  917. inv = block.getInv(block_loc);
  918. inv_size = inv.getSize(inv);
  919. for(i = 0; i < inv_size; i++) {
  920. item = inv.getItem(inv, i);
  921. if(item.getType(item) == "km:gear") {
  922. if(item.getName(item) == "§rTeleport") {
  923. temp = true;
  924. break;
  925. }
  926. }
  927. }
  928. if(!temp) {
  929. msg.prefix(player, "§5Adventure", "No receiver found!");
  930. goto("wait");
  931. }
  932. lore_list = item.getLore(item);
  933. if(list.getSize(lore_list) != 4) {
  934. msg.prefix(player, "§5Adventure", "No receiver found!");
  935. goto("wait");
  936. }
  937. world = world.get(list.getIndex(lore_list, 0));
  938. x = read.number(list.getIndex(lore_list, 1));
  939. y = read.number(list.getIndex(lore_list, 2));
  940. z = read.number(list.getIndex(lore_list, 3));
  941. tp_loc = loc.new(world, x, y, z);
  942. if(!isATpReceiver(tp_loc)) {
  943. msg.prefix(player, "§5Adventure", "No receiver found!");
  944. goto("wait");
  945. }
  946. loc.add(tp_loc, 0.5, -3, 0.5);
  947. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  948. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  949. array = array.new(4);
  950. array[0] = player.getUuid(player);
  951. array[1] = block_loc;
  952. array[2] = tp_loc;
  953. array[3] = false;
  954. list.add(tp_list, array);
  955. sgoto(30, "tp_ticker");
  956. }
  957. goto("wait");
  958. }
  959. if(block_loc == gambler_loc) {
  960. cancel = true;
  961. inv.open(gambler_inv, player, "Choose your amount to bet with");
  962. goto("wait");
  963. }
  964. if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
  965. if(!hasEnoughMoney(player, 1)) {
  966. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  967. goto("wait");
  968. }
  969. subMoney(player, 1);
  970. amount = lottery.add(block_loc, 1);
  971. if(block_loc == lottery_loc_1) {
  972. winrate = 1000;
  973. } else {
  974. winrate = 10000;
  975. }
  976. win = math.random(1, winrate);
  977. if(win == 1) {
  978. addMoney(player, amount);
  979. lottery.set(block_loc, 0);
  980. message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
  981. msg.radius(prefix_money, message, block_loc, 50);
  982. }
  983. goto("wait");
  984. }
  985. goto("wait");
  986. @living_death
  987. if(isPlayer(living_entity)) {
  988. player = living_entity;
  989. setDeathLoc(player);
  990. loc = entity.getLocation(player);
  991. amount = skill.getAmount(player, "skill.subcu_inv");
  992. if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
  993. new_amount = amount - 1;
  994. skill.setAmount(player, "skill.subcu_inv", new_amount);
  995. msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
  996. } else {
  997. player.dropInventory(player, loc);
  998. }
  999. killer = player.getFromDamageSource(damage_source);
  1000. if(isPlayer(killer)) {
  1001. amount = skill.getAmount(player, "skill.head_human");
  1002. if(amount >= 1) {
  1003. if(perm.has(player, "isTeam")) {
  1004. temp = math.random(1, 20);
  1005. } else {
  1006. temp = math.random(1, 5);
  1007. }
  1008. if(temp == 1) {
  1009. item.drop(loc, player.getHead(player.getUuid(player), player_name));
  1010. }
  1011. }
  1012. }
  1013. goto("wait");
  1014. }
  1015. killer = player.getFromDamageSource(damage_source);
  1016. if(isPlayer(killer)) {
  1017. r = math.random(1, 20);
  1018. if(r == 1) {
  1019. amount = skill.getAmount(killer, "skill.head_monster");
  1020. if(amount >= 1) {
  1021. entity_type = entity.getType(living_entity);
  1022. if(entity_type == "creeper") {
  1023. item.drop(loc, read.item("minecraft:creeper_head"));
  1024. goto("wait");
  1025. }
  1026. if(entity_type == "zombie") {
  1027. item.drop(loc, read.item("minecraft:zombie_head"));
  1028. goto("wait");
  1029. }
  1030. if(entity_type == "skeleton") {
  1031. item.drop(loc, read.item("minecraft:skeleton_skull"));
  1032. goto("wait");
  1033. }
  1034. }
  1035. }
  1036. }
  1037. goto("wait");
  1038. @player_pre_respawn
  1039. if(loc.isInSurvWorld(entity.getLocation(player))) {
  1040. set.add(survival_respawn, player.getUuid(player));
  1041. }
  1042. goto("wait");
  1043. @player_post_respawn
  1044. player_uuid = player.getUuid(player);
  1045. if(set.contains(survival_respawn, player_uuid)) {
  1046. set.remove(survival_respawn, player_uuid);
  1047. if(player.isOnAdventure(player)) {
  1048. tp_loc = player.getAdventureStart(player);
  1049. entity.teleport(player, tp_loc);
  1050. goto("wait");
  1051. }
  1052. amount = skill.getAmount(player, "skill.comeback");
  1053. if(skill.isActivated(player, "skill.comeback") && amount > 0) {
  1054. new_amount = amount - 1;
  1055. skill.setAmount(player, "skill.comeback", new_amount);
  1056. msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
  1057. entity.teleport(player, getDeathLoc(player));
  1058. goto("wait");
  1059. }
  1060. entity.teleport(player, world.getServerSpawn());
  1061. }
  1062. goto("wait");
  1063. @tp_ticker
  1064. array = list.getIndex(tp_list, 0);
  1065. list.removeIndex(tp_list, 0);
  1066. block_loc = array[1];
  1067. list.add(tp_list, array);
  1068. setTpWallFull(block_loc, "minecraft:lime_stained_glass");
  1069. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1070. sgoto(30, "tp_final");
  1071. goto("wait");
  1072. @tp_final
  1073. array = list.getIndex(tp_list, 0);
  1074. list.removeIndex(tp_list, 0);
  1075. player_uuid = array[0];
  1076. block_loc = array[1];
  1077. tp_loc = array[2];
  1078. adventure = array[3];
  1079. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1080. setTpWallFull(block_loc, "minecraft:air");
  1081. player = player.get(player_uuid);
  1082. if(player == null) {
  1083. goto("wait");
  1084. }
  1085. sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
  1086. if(adventure) {
  1087. //Party
  1088. if(player.isInParty(player) && player.isPartyLeader(player)) {
  1089. party_id = player.getPartyId(player);
  1090. party_list = party.getList(party_id);
  1091. iter = list.iterator(party_list);
  1092. while(hasNext(iter)) {
  1093. p = player.get(next(iter));
  1094. p_name = player.getName(p);
  1095. p_loc = entity.getLocation(p);
  1096. if(!loc.isSameWorld(adventure_chest_loc, p_loc)) {
  1097. msg.prefix(player, "§5Party", concat(p_name, "§c is in another world."));
  1098. msg.prefix(p, "§5Party", "§cYou are in another world.");
  1099. continue;
  1100. }
  1101. if(loc.distance(adventure_chest_loc, p_loc) > 5) {
  1102. msg.prefix(player, "§5Party", concat(p_name, "§c is too far away."));
  1103. msg.prefix(p, "§5Party", "§cYou are too far away.");
  1104. continue;
  1105. }
  1106. if(player.hasMinigame(p)) {
  1107. msg.prefix(player, "§5Party", concat(p_name, "§c is in a game."));
  1108. msg.prefix(p, "§5Party", "§cYou are in a game.");
  1109. continue;
  1110. }
  1111. if(player.hasQuest2(p)) {
  1112. msg.prefix(player, "§5Party", concat(p_name, "§c is doing a quest."));
  1113. msg.prefix(p, "§5Party", "§cYou are doing a quest.");
  1114. continue;
  1115. }
  1116. if(player.isOnAdventure(p)) {
  1117. msg.prefix(player, "§5Party", concat(p_name, "§c is already on an adventure."));
  1118. msg.prefix(p, "§5Party", "§cYou are already on an adventure.");
  1119. continue;
  1120. }
  1121. if(player.isAfk(p)) {
  1122. msg.prefix(player, "§5Party", concat(p_name, "§c is afk."));
  1123. msg.prefix(p, "§5Party", "§cYou are afk.");
  1124. continue;
  1125. }
  1126. if(!player.hasClearInventory(p)) {
  1127. msg.prefix(player, "§5Party", concat(p_name, "§c has no clear inventory."));
  1128. msg.prefix(p, "§5Party", "§cYou have no clear inventory.");
  1129. continue;
  1130. }
  1131. player.teleport(p, tp_loc, false);
  1132. player.setAdventure(p, true);
  1133. player.setAdventureStart(p, tp_loc);
  1134. addAdventureDisplay(p, adventure_aim_loc);
  1135. title.reset(p);
  1136. title.setSub(p, "Have fun!");
  1137. title.send(p, "§cAdventure");
  1138. msg.prefix(p, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1139. }
  1140. goto("wait");
  1141. }
  1142. if(!player.hasClearInventory(player)) {
  1143. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  1144. goto("wait");
  1145. }
  1146. player.teleport(player, tp_loc, false);
  1147. player.setAdventure(player, true);
  1148. player.setAdventureStart(player, tp_loc);
  1149. addAdventureDisplay(player, adventure_aim_loc);
  1150. title.reset(player);
  1151. title.setSub(player, "Have fun!");
  1152. title.send(player, "§cAdventure");
  1153. msg.prefix(player, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1154. goto("wait");
  1155. }
  1156. player.teleport(player, tp_loc, false);
  1157. goto("wait");
  1158. function lottery.set(location, amount) {
  1159. location = loc.mod(location, 0.5, 0, 0.5);
  1160. list = living.near(location, 0.1);
  1161. text_entity = list.getIndex(list, 0);
  1162. name = entity.getName(text_entity);
  1163. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1164. msg("dev", "Lottery error");
  1165. goto("wait");
  1166. }
  1167. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1168. }
  1169. function lottery.add(location, amount) {
  1170. location = loc.mod(location, 0.5, 0, 0.5);
  1171. list = living.near(location, 0.1);
  1172. text_entity = list.getIndex(list, 0);
  1173. name = entity.getName(text_entity);
  1174. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1175. msg("dev", "Lottery error");
  1176. goto("wait");
  1177. }
  1178. amount = text.convert(text.subString(name, 8, text.length(name))) + 1;
  1179. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1180. return amount;
  1181. }
  1182. function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
  1183. array = array.new(11);
  1184. array[0] = result_amount;
  1185. array[1] = result_item;
  1186. array[2] = item1;
  1187. array[3] = item2;
  1188. array[4] = item3;
  1189. array[5] = item4;
  1190. array[6] = item5;
  1191. array[7] = item6;
  1192. array[8] = item7;
  1193. array[9] = item8;
  1194. array[10] = item9;
  1195. list.add($items_list, array);
  1196. }
  1197. function recipe.getIndexFromItemType(item_type) {
  1198. for(i = 0; i < list.getSize($items_list); i++) {
  1199. array = list.getIndex($items_list, i);
  1200. if(array[1] == item_type) {
  1201. return i;
  1202. }
  1203. }
  1204. return null;
  1205. }
  1206. function recipe.showRecipe(player, menu, index) {
  1207. for(i = 0; i < 48; i++) {
  1208. inv.setItem(menu, i, $air_item);
  1209. }
  1210. array = list.getIndex($items_list, index);
  1211. inv.setItem(menu, 23, read.item("km:arrow_right"));
  1212. inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
  1213. inv.setItem(menu, 10, read.item(array[2]));
  1214. inv.setItem(menu, 11, read.item(array[3]));
  1215. inv.setItem(menu, 12, read.item(array[4]));
  1216. inv.setItem(menu, 19, read.item(array[5]));
  1217. inv.setItem(menu, 20, read.item(array[6]));
  1218. inv.setItem(menu, 21, read.item(array[7]));
  1219. inv.setItem(menu, 28, read.item(array[8]));
  1220. inv.setItem(menu, 29, read.item(array[9]));
  1221. inv.setItem(menu, 30, read.item(array[10]));
  1222. inv.setItem(menu, 25, read.item(array[1], array[0]));
  1223. inv.update(player);
  1224. }
  1225. function recipe.setPage(player, menu, page) {
  1226. map.add($recipe_site_map, player.getUuid(player), page);
  1227. size = list.getSize($items_list);
  1228. max_page = math.roundUp(size / 45);
  1229. if(page > max_page) {
  1230. return;
  1231. }
  1232. inv.setItem(menu, 45, $air_item);
  1233. if(page > 1) {
  1234. inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
  1235. } else {
  1236. inv.setItem(menu, 46, $air_item);
  1237. }
  1238. if(page < max_page) {
  1239. inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
  1240. } else {
  1241. inv.setItem(menu, 47, $air_item);
  1242. }
  1243. max_index = size - 1;
  1244. for(i = 0; i < 45; i++) {
  1245. list_index = i + 45 * (page - 1);
  1246. if(list_index > max_index) {
  1247. inv.setItem(menu, i, $air_item);
  1248. } else {
  1249. array = list.getIndex($items_list, list_index);
  1250. inv.setItem(menu, i, read.item(array[1]));
  1251. }
  1252. }
  1253. inv.update(player);
  1254. }
  1255. function setDeathLoc(player) {
  1256. map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
  1257. }
  1258. function getDeathLoc(player) {
  1259. return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
  1260. }