survival.txt 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  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", 40, false, false, true);
  17. skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 40, 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)", 400, 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)", 200, true, false, false);
  20. skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 300, false, true, false);
  21. skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 32, false, true, false);
  22. skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 32, false, true, false);
  23. skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 32, false, true, false);
  24. skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 32, false, true, false);
  25. skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 32, false, true, false);
  26. skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 32, false, true, false);
  27. skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 32, 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. cancel = true;
  337. }
  338. }
  339. }
  340. goto("wait");
  341. }
  342. player = living_entity;
  343. damager = player.getFromDamageSource(damage_source);
  344. if(!isPlayer(damager)) {
  345. player_loc = entity.getLocation(player);
  346. if(loc.hasPlotId(player_loc, 128) && damage.getType(damage_source) == "fall") {
  347. cancel = true;
  348. }
  349. goto("wait");
  350. }
  351. if(player == damager) {
  352. goto("wait");
  353. }
  354. if(!hasPvpOn(damager)) {
  355. cancel = true;
  356. msg.prefix(damager, "§5PvP", "You have PvP disabled.");
  357. goto("wait");
  358. }
  359. if(!hasPvpOn(player)) {
  360. cancel = true;
  361. msg.prefix(damager, "§5PvP", concat(player.getName(player), " has PvP disabled."));
  362. goto("wait");
  363. }
  364. goto("wait");
  365. @entity_click
  366. if(hand == "OFF_HAND") {
  367. goto("wait");
  368. }
  369. if(entity.getType(entity) == "human") {
  370. entity_name = entity.getName(entity);
  371. if(entity_name == "Info-Point") {
  372. msg(player, getSpacer());
  373. msg(player, text.click("§r [§cclick§r] [§eSurvival§r]", "/infopoint1"));
  374. msg(player, text.click("§r [§cclick§r] [§eAdventure§r]", "/infopoint2"));
  375. msg(player, text.click("§r [§cclick§r] [§ePlots§r]", "/infopoint3"));
  376. msg(player, text.click("§r [§cclick§r] [§eClans§r]", "/infopoint4"));
  377. msg(player, text.click("§r [§cclick§r] [§eCities§r]", "/infopoint5"));
  378. msg(player, text.click("§r [§cclick§r] [§eShops§r]", "/infopoint6"));
  379. msg(player, text.click("§r [§cclick§r] [§eMinigames§r]", "/infopoint7"), " ", text.click("§f[§bTeleport§f]", "/games"));
  380. msg(player, text.click("§r [§cclick§r] [§eQuests§r]", "/infopoint8"), " ", text.click("§f[§bTeleport§f]", "/story"));
  381. msg(player, text.click("§r [§cclick§r] [§eRanking§r]", "/infopoint9"), " ", text.link("§f[§bRanks§f]", "https://minecraft.hammerle.me/?site=ranks"));
  382. msg(player, text.click("§r [§cclick§r] [§eRules§r]", "/infopoint10"), " ", text.link("§f[§bFake Rules§f]", "https://minecraft.hammerle.me/?site=rules"));
  383. msg(player, text.click("§r [§cclick§r] [§eNote§r]", "/infopoint11"));
  384. goto("wait");
  385. }
  386. if(entity_name == "Recipes") {
  387. recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
  388. recipe.setPage(player, recipe_menu, 1);
  389. inv.open(recipe_menu, player, "Recipes");
  390. goto("wait");
  391. }
  392. if(entity_name == "Banker") {
  393. inv.open(bankmenu, player, "Banker");
  394. goto("wait");
  395. }
  396. if(entity_name == "Adventure") {
  397. if(!player.isOnAdventure(player)) {
  398. msg.prefix(player, "§5Adventure", "§rYou aren't on an adventure. Click the chest in the teleporter to start an adventure.");
  399. goto("wait");
  400. }
  401. player.setAdventure(player, false);
  402. adventures = player.getAdventureAmounts(player);
  403. if(adventures == null) {
  404. adventures = 0;
  405. }
  406. player.setAdventureAmounts(player, ++adventures);
  407. msg.prefix(player, "§5Adventure", "§rCongratulations, you finished your adventure, here ist your reward!");
  408. if(adventures == 10) {
  409. offerRank(player, "rank.pioneer");
  410. } elseif(adventures == 5) {
  411. offerRank(player, "rank.explorer");
  412. } elseif(adventures == 1) {
  413. offerRank(player, "rank.adventurer");
  414. }
  415. removeAdventureDisplay(player);
  416. safeGiveItemPlayer(player, coin_silver);
  417. goto("wait");
  418. }
  419. }
  420. goto("wait");
  421. @player_login
  422. if(player.isOnAdventure(player)) {
  423. addAdventureDisplay(player, adventure_aim_loc);
  424. }
  425. goto("wait");
  426. @inv_click
  427. cancel = true;
  428. if(inv_id == bankinvid) { //Bankmenü
  429. gold_inv = player.getItemAmount(player, false, coin_gold);
  430. silver_inv = player.getItemAmount(player, false, coin_silver);
  431. copper_inv = player.getItemAmount(player, false, coin_copper);
  432. //Wechseln
  433. if(inv_slot == 5 || inv_slot == 6 || inv_slot == 13 || inv_slot == 14) {
  434. if(inv_slot == 5) {
  435. //1 Silbermünze --> 64 Kupfermünzen
  436. amount1 = 1;
  437. item1 = coin_silver;
  438. amount2 = 64;
  439. item2 = coin_copper64;
  440. message = "No silvercoin in inventory.";
  441. item_type = "km:coin_copper";
  442. coin_inv = silver_inv;
  443. }
  444. elseif(inv_slot == 6) {
  445. //64 Kupfermünzen --> 1 Silbermünze
  446. amount1 = 64;
  447. item1 = coin_copper64;
  448. amount2 = 1;
  449. item2 = coin_silver;
  450. message = "Not enough coppercoins in inventory.";
  451. item_type = "km:coin_silver";
  452. coin_inv = copper_inv;
  453. }
  454. elseif(inv_slot == 13) {
  455. //1 Goldmünze --> 64 Silbermünzen
  456. amount1 = 1;
  457. item1 = coin_gold;
  458. amount2 = 64;
  459. item2 = coin_silver64;
  460. message = "No goldcoin in inventory.";
  461. item_type = "km:coin_silver";
  462. coin_inv = gold_inv;
  463. }
  464. elseif(inv_slot == 14) {
  465. //64 Silbermünzen --> 1 Goldmünze
  466. amount1 = 64;
  467. item1 = coin_silver64;
  468. amount2 = 1;
  469. item2 = coin_gold;
  470. message = "Not enough silvercoins in inventory.";
  471. item_type = "km:coin_gold";
  472. coin_inv = silver_inv;
  473. }
  474. if(coin_inv < amount1) {
  475. msg.prefix(player, prefix_money, message);
  476. goto("wait");
  477. }
  478. player.removeItem2(player, item1);
  479. notgiven = player.giveItem(player, item2);
  480. if(item.getType(notgiven) != "minecraft:air") {
  481. amount = item.getAmount(notgiven);
  482. player.removeItem2(player, read.item(item_type, amount2 - amount));
  483. player.giveItem(player, item1);
  484. msg.prefix(player, prefix_money, "Not enough space in inventory.");
  485. goto("wait");
  486. }
  487. inv.update(player);
  488. msg.prefix(player, prefix_money, "Exchange succesfull.");
  489. goto("wait");
  490. }
  491. //Kontobewegungen
  492. if(inv_slot == 1 || inv_slot == 9) {
  493. betrag = 1;
  494. coin_inv = copper_inv;
  495. }
  496. elseif(inv_slot == 2 || inv_slot == 10) {
  497. betrag = 64;
  498. coin_inv = silver_inv;
  499. }
  500. elseif(inv_slot == 3 || inv_slot == 11) {
  501. betrag = 4096;
  502. coin_inv = gold_inv;
  503. }
  504. //Einzahlen
  505. if(inv_slot > 0 && inv_slot < 4) {
  506. player_id = player.getId(player);
  507. if(coin_inv < 1) {
  508. msg.prefix(player, prefix_money, "§rCoin not in inventory.");
  509. } else {
  510. addMoney(player, betrag);
  511. player.removeItem2(player, inv.getItem(bankmenu, inv_slot));
  512. inv.update(player);
  513. }
  514. goto("wait");
  515. }
  516. //Auszahlen
  517. if(inv_slot > 8 && inv_slot < 12) {
  518. player_id = player.getId(player);
  519. if(!hasEnoughMoney(player_id, betrag)) {
  520. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  521. } else {
  522. subMoney(player, betrag);
  523. player.giveItem(player, inv.getItem(bankmenu, inv_slot));
  524. inv.update(player);
  525. }
  526. goto("wait");
  527. }
  528. goto("wait");
  529. }
  530. if(inv_id == gambler_inv_id) {
  531. if(inv_slot == 0) {
  532. amount = 1;
  533. } elseif(inv_slot == 1) {
  534. amount = 64;
  535. } elseif(inv_slot == 2) {
  536. amount = 4096;
  537. } elseif(inv_slot == 3) {
  538. amount = getMoney(player);
  539. if(amount == 0) {
  540. msg.prefix(player, prefix_money, "You need at least 1 snuvi on your account.");
  541. goto("wait");
  542. }
  543. }
  544. if(!hasEnoughMoney(player, amount)) {
  545. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  546. goto("wait");
  547. }
  548. win = math.random(1, 2);
  549. if(win == 1) {
  550. addMoney(player, amount);
  551. temp = " won ";
  552. } else {
  553. subMoney(player, amount);
  554. temp = " lost ";
  555. }
  556. if(amount == 1) {
  557. message = concat(player.getName(player), temp, text.number(amount), " snuvi.");
  558. } else {
  559. message = concat(player.getName(player), temp, text.number(amount), " snuvis.");
  560. }
  561. msg.radius("§2Gambler", message, entity.getLocation(player), 50);
  562. goto("wait");
  563. }
  564. if(inv_name == "Recipes") {
  565. item_type = item.getType(item);
  566. if(item_type == "minecraft:air") {
  567. goto("wait");
  568. }
  569. if(item_type == "km:return_red") {
  570. page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
  571. recipe.setPage(player, inv, page);
  572. goto("wait");
  573. }
  574. if(item_type == "minecraft:paper") {
  575. name = item.getName(item);
  576. if(text.contains(name, "<<") || text.contains(name, ">>")) {
  577. page = removeFormat(name);
  578. page = text.replace(page, "<<", "");
  579. page = text.replace(page, ">>", "");
  580. page = read.number(page);
  581. if(inv_slot == 46) {
  582. recipe.setPage(player, inv, page);
  583. }
  584. if(inv_slot == 47) {
  585. recipe.setPage(player, inv, page);
  586. }
  587. goto("wait");
  588. }
  589. }
  590. index = recipe.getIndexFromItemType(item_type);
  591. if(index == null) {
  592. goto("wait");
  593. }
  594. recipe.showRecipe(player, inv, index);
  595. }
  596. goto("wait");
  597. @block_break
  598. duration = data.getTimer(player, "block_down");
  599. if(duration > 0) {
  600. do = true;
  601. loc = loc.mod(block_loc, 0, -1, 0);
  602. b_type = block.getType(loc);
  603. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  604. do = false;
  605. }
  606. if(!plot.check(loc, player, 2, true)) {
  607. do = false;
  608. }
  609. if(do) {
  610. item = block.toStack(loc);
  611. item.drop(loc, item);
  612. block.set(loc, "minecraft:air");
  613. }
  614. }
  615. duration = data.getTimer(player, "block_up");
  616. if(duration > 0) {
  617. do = true;
  618. loc = loc.mod(block_loc, 0, 1, 0);
  619. b_type = block.getType(loc);
  620. if(b_type == "minecraft:bedrock" || b_type == "minecraft:end_portal_frame") {
  621. do = false;
  622. }
  623. if(!plot.check(loc, player, 2, true)) {
  624. do = false;
  625. }
  626. if(do) {
  627. item = block.toStack(loc);
  628. item.drop(loc, item);
  629. block.set(loc, "minecraft:air");
  630. }
  631. }
  632. goto("wait");
  633. @block_click
  634. if(hand == "OFF_HAND") {
  635. goto("wait");
  636. }
  637. if(block_type == "minecraft:lectern") {
  638. if(action == "right") {
  639. itementity = entity.get(loc.mod(block_loc, 0.5, 0.9, 0.5), 0.2, "net.minecraft.entity.item.ItemEntity");
  640. if(itementity == null) {
  641. goto("wait");
  642. }
  643. list = entity.near(itementity, 0.2);
  644. list.add(list, itementity);
  645. if(list.getSize(list) < 2) {
  646. //Zu wenig Items am Lesepult
  647. goto("wait");
  648. }
  649. a = array.new(2, 6); //0 = item, 1 = itementity, 2 = enchantments, 3 = enchanted, 4 = enchanted_book, 5 = book
  650. size = 0;
  651. for(i = 0; i < list.getSize(list); i++) {
  652. entity = list.getIndex(list, i);
  653. item = item.entity.get(entity);
  654. size += item.getAmount(item);
  655. if(size > 2) {
  656. //Zu viele Items am Lesepult
  657. goto("wait");
  658. }
  659. map = enchantment.readFromItem(item);
  660. a[i, 0] = item;
  661. a[i, 1] = entity;
  662. a[i, 2] = map;
  663. a[i, 4] = false;
  664. a[i, 5] = false;
  665. if(map.getSize(map) > 0) {
  666. //Verzauberte Items
  667. a[i, 3] = true;
  668. if(item.getType(item) == "minecraft:enchanted_book") {
  669. a[i, 4] = true;
  670. }
  671. } else {
  672. //Nicht verzauberte Items
  673. a[i, 3] = false;
  674. if(item.getType(item) == "minecraft:book") {
  675. a[i, 5] = true;
  676. }
  677. }
  678. }
  679. lectern_action = null;
  680. if(a[0, 4] == true && a[1, 4] == true) {
  681. //Beide Items sind verzauberte Bücher
  682. lectern_action = 0;
  683. }
  684. elseif(a[0, 5] == true || a[1, 5] == true) {
  685. //Eines der beiden Items ist ein normales Buch
  686. if(a[0, 4] == true || a[1, 4] == true) {
  687. //Eines der beiden Items ist ein verzaubertes Buch
  688. lectern_action = 1;
  689. } elseif(a[0, 3] == true || a[1, 3] == true) {
  690. //Eines der beiden Items ist ein verzaubertes Item
  691. lectern_action = 2;
  692. }
  693. }
  694. elseif(a[0, 4] == true || a[1, 4] == true) {
  695. lectern_action = 3;
  696. }
  697. if(lectern_action == null) {
  698. goto("wait");
  699. }
  700. if(lectern_action == 0) {
  701. //Verzauberungsbücher mergen
  702. item1 = a[0, 0];
  703. item_entity1 = a[0, 1];
  704. item_entity2 = a[1, 1];
  705. map1 = a[0, 2];
  706. map2 = a[1, 2];
  707. map_size1 = map.getSize(map1);
  708. map_size2 = map.getSize(map2);
  709. iter = map.iterator(map2);
  710. betrag = 0;
  711. extra = 0;
  712. while(hasNext(iter)) {
  713. element = next(iter);
  714. key = map.getKey(element);
  715. level1 = map.getValue(element);
  716. level2 = map.getOrDefault(map1, key, 0);
  717. if(level1 == level2) {
  718. max_lvl = map.get(max_ench_lvl, key);
  719. //max_lvl = map.getOrDefault(max_ench_lvl, key, enchantment.getMaxLevel(key));
  720. if(max_lvl != null) {
  721. if(level1 < max_lvl) {
  722. extra += 40;
  723. level1++;
  724. }
  725. }
  726. }
  727. if(level2 > level1) {
  728. level1 = level2;
  729. }
  730. map.add(map1, key, level1);
  731. }
  732. if(map_size1 > map_size2) {
  733. map = map1;
  734. } else {
  735. map = map2;
  736. }
  737. iter = map.iterator(map);
  738. while(hasNext(iter)) {
  739. element = next(iter);
  740. level = map.getValue(element);
  741. betrag += level * 20 + extra;
  742. }
  743. if(!hasEnoughMoney(player.getId(player), betrag)) {
  744. msg.prefix(player, prefix_money, concat("Not enough coins in inventory. This action costs ", text.number(betrag), " snuvis."));
  745. goto("wait");
  746. }
  747. subMoney(player, betrag);
  748. enchantment.writeToItem(map1, item1);
  749. item.entity.set(item_entity1, item.clone(item1));
  750. entity.remove(item_entity2);
  751. } elseif(lectern_action == 1) {
  752. //Verzauberungsbuch kopieren
  753. if(a[0, 5]) {
  754. book_index = 0;
  755. other_index = 1;
  756. } else {
  757. book_index = 1;
  758. other_index = 0;
  759. }
  760. item1 = a[book_index, 0];
  761. item_entity1 = a[book_index, 1];
  762. item2 = a[other_index, 0];
  763. item_entity2 = a[other_index, 1];
  764. map2 = a[other_index, 2];
  765. map_size = map.getSize(map2);
  766. betrag = 20 * map_size;
  767. if(!hasEnoughMoney(player.getId(player), betrag)) {
  768. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  769. goto("wait");
  770. }
  771. subMoney(player, betrag);
  772. item1 = read.item("minecraft:enchanted_book");
  773. enchantment.writeToItem(map2, item1);
  774. item.entity.set(item_entity1, item1);
  775. item.entity.set(item_entity2, item.clone(item2));
  776. } elseif(lectern_action == 2) {
  777. //Einzelne Verzauberung herunterziehen
  778. if(a[0, 5]) {
  779. book_index = 0;
  780. other_index = 1;
  781. } else {
  782. book_index = 1;
  783. other_index = 0;
  784. }
  785. item_entity1 = a[book_index, 1];
  786. map1 = map.new();
  787. item2 = a[other_index, 0];
  788. item_entity2 = a[other_index, 1];
  789. map2 = a[other_index, 2];
  790. item1 = read.item("minecraft:enchanted_book");
  791. element = next(map.iterator(map2));
  792. key = map.getKey(element);
  793. value = map.getValue(element);
  794. map.add(map1, key, value);
  795. map.remove(map2, key);
  796. betrag = 20 * value;
  797. if(!hasEnoughMoney(player.getId(player), betrag)) {
  798. msg.prefix(player, prefix_money, concat("Not enough snuvis in your ccount. This action costs ", text.number(betrag), " snuvis."));
  799. goto("wait");
  800. }
  801. subMoney(player, betrag);
  802. enchantment.writeToItem(map1, item1);
  803. enchantment.writeToItem(map2, item2);
  804. item.entity.set(item_entity1, item1);
  805. item.entity.set(item_entity2, item.clone(item2));
  806. } elseif(lectern_action == 3) {
  807. //Alle Verzauberungen vom Buch auf das Item übertragen
  808. betrag = 0;
  809. if(a[0, 4]) {
  810. ench_book_index = 0;
  811. other_index = 1;
  812. } else {
  813. ench_book_index = 1;
  814. other_index = 0;
  815. }
  816. item1 = a[ench_book_index, 0];
  817. item_entity1 = a[ench_book_index, 1];
  818. map1 = a[ench_book_index, 2];
  819. item2 = a[other_index, 0];
  820. item_entity2 = a[other_index, 1];
  821. map2 = a[other_index, 2];
  822. map_size1 = map.getSize(map1);
  823. map_size2 = map.getSize(map2);
  824. iter = map.iterator(map1);
  825. while(hasNext(iter)) {
  826. element = next(iter);
  827. key = map.getKey(element);
  828. value = map.getValue(element);
  829. value2 = map.getOrDefault(map2, key, 0);
  830. if(value2 > value) {
  831. value = value2;
  832. }
  833. map.add(map2, key, value);
  834. }
  835. if(map_size1 > map_size2) {
  836. map = map1;
  837. } else {
  838. map = map2;
  839. }
  840. iter = map.iterator(map);
  841. while(hasNext(iter)) {
  842. element = next(iter);
  843. level = map.getValue(element);
  844. betrag += level * 20;
  845. }
  846. if(!hasEnoughMoney(player.getId(player), betrag)) {
  847. msg.prefix(player, prefix_money, concat("Not enough snuvis on your account. This action costs ", text.number(betrag), " snuvis."));
  848. goto("wait");
  849. }
  850. subMoney(player, betrag);
  851. enchantment.writeToItem(map2, item2);
  852. item.entity.set(item_entity2, item.clone(item2));
  853. entity.remove(item_entity1);
  854. }
  855. entity.throw(item_entity1, 0, 0.3, 0);
  856. entity.throw(item_entity2, 0, 0.3, 0);
  857. particle.spawn(loc.mod(block_loc, 0.5, 1.4, 0.5), par, 20, 0, 0.25, 0.25, 0.25);
  858. msg.prefix(player, prefix_money, concat("This cost " , text.number(betrag), " snuvis."));
  859. }
  860. goto("wait");
  861. }
  862. if(block_type == "minecraft:chest") {
  863. if(isATpReceiver(block_loc)) {
  864. tp_item = read.item("km:gear", 1, "§rTeleport");
  865. list = list.new();
  866. list.add(list, world.getName(loc.getWorld(block_loc)));
  867. list.add(list, text.number(loc.getX(block_loc)));
  868. list.add(list, text.number(loc.getY(block_loc)));
  869. list.add(list, text.number(loc.getZ(block_loc)));
  870. item.setLore(tp_item, list);
  871. player.giveItem(player, tp_item);
  872. goto("wait");
  873. }
  874. if(isATpTransmitter(block_loc)) {
  875. player_uuid = player.getUuid(player);
  876. clicked = map.getOrDefault(tp_map, player_uuid, 0);
  877. now_time = time.getMillis();
  878. if(now_time - clicked < 5000) {
  879. msg.prefix(player, "§5Adventure", "Wait 5 seconds!");
  880. goto("wait");
  881. }
  882. map.add(tp_map, player_uuid, now_time);
  883. //Abenteuer-Teleport
  884. if(block_loc == adventure_chest_loc) {
  885. if(!player.isOnAdventure(player)) {
  886. if(!player.hasClearInventory(player)) {
  887. msg.prefix(player, "§5Adventure", "Your inventory needs to be empty!");
  888. goto("wait");
  889. }
  890. alpha = math.random(0, 360);
  891. alpha *= math.pi() / 180;
  892. x = math.round(math.sin(alpha) * 10000) + 0.5;
  893. z = math.round(math.cos(alpha) * 10000) + 0.5;
  894. y = 255;
  895. tp_loc = loc.new(world.getOverWorld(), x, y, z);
  896. while(block.isAir(tp_loc)) {
  897. loc.setY(tp_loc, y);
  898. y--;
  899. }
  900. tp_loc = loc.mod(tp_loc, 0, 1, 0);
  901. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  902. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  903. array = array.new(4);
  904. array[0] = player.getUuid(player);
  905. array[1] = block_loc;
  906. array[2] = tp_loc;
  907. array[3] = true;
  908. list.add(tp_list, array);
  909. sgoto(30, "tp_ticker");
  910. }
  911. goto("wait");
  912. }
  913. //Normaler Teleport
  914. temp = false;
  915. inv = block.getInv(block_loc);
  916. inv_size = inv.getSize(inv);
  917. for(i = 0; i < inv_size; i++) {
  918. item = inv.getItem(inv, i);
  919. if(item.getType(item) == "km:gear") {
  920. if(item.getName(item) == "§rTeleport") {
  921. temp = true;
  922. break;
  923. }
  924. }
  925. }
  926. if(!temp) {
  927. msg.prefix(player, "§5Adventure", "No receiver found!");
  928. goto("wait");
  929. }
  930. lore_list = item.getLore(item);
  931. if(list.getSize(lore_list) != 4) {
  932. msg.prefix(player, "§5Adventure", "No receiver found!");
  933. goto("wait");
  934. }
  935. world = world.get(list.getIndex(lore_list, 0));
  936. x = read.number(list.getIndex(lore_list, 1));
  937. y = read.number(list.getIndex(lore_list, 2));
  938. z = read.number(list.getIndex(lore_list, 3));
  939. tp_loc = loc.new(world, x, y, z);
  940. if(!isATpReceiver(tp_loc)) {
  941. msg.prefix(player, "§5Adventure", "No receiver found!");
  942. goto("wait");
  943. }
  944. loc.add(tp_loc, 0.5, -3, 0.5);
  945. setTpWallX(block_loc, "minecraft:lime_stained_glass");
  946. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  947. array = array.new(4);
  948. array[0] = player.getUuid(player);
  949. array[1] = block_loc;
  950. array[2] = tp_loc;
  951. array[3] = false;
  952. list.add(tp_list, array);
  953. sgoto(30, "tp_ticker");
  954. }
  955. goto("wait");
  956. }
  957. if(block_loc == gambler_loc) {
  958. cancel = true;
  959. inv.open(gambler_inv, player, "Choose your amount to bet with");
  960. goto("wait");
  961. }
  962. if(block_loc == lottery_loc_1 || block_loc == lottery_loc_2) {
  963. if(!hasEnoughMoney(player, 1)) {
  964. msg.prefix(player, prefix_money, "Not enough snuvis on your account.");
  965. goto("wait");
  966. }
  967. subMoney(player, 1);
  968. amount = lottery.add(block_loc, 1);
  969. if(block_loc == lottery_loc_1) {
  970. winrate = 1000;
  971. } else {
  972. winrate = 10000;
  973. }
  974. win = math.random(1, winrate);
  975. if(win == 1) {
  976. addMoney(player, amount);
  977. lottery.set(block_loc, 0);
  978. message = concat(player.getName(player), " has won ", text.number(amount), " snuvis.");
  979. msg.radius(prefix_money, message, block_loc, 50);
  980. }
  981. goto("wait");
  982. }
  983. goto("wait");
  984. @living_death
  985. if(isPlayer(living_entity)) {
  986. player = living_entity;
  987. setDeathLoc(player);
  988. loc = entity.getLocation(player);
  989. amount = skill.getAmount(player, "skill.subcu_inv");
  990. if(skill.isActivated(player, "skill.subcu_inv") && amount > 0) {
  991. new_amount = amount - 1;
  992. skill.setAmount(player, "skill.subcu_inv", new_amount);
  993. msg.prefix(player, prefix_skill, concat("Used Subcutaneous Inventory. New amount: ", text.number(new_amount)));
  994. } else {
  995. player.dropInventory(player, loc);
  996. }
  997. killer = player.getFromDamageSource(damage_source);
  998. if(isPlayer(killer)) {
  999. amount = skill.getAmount(player, "skill.head_human");
  1000. if(amount >= 1) {
  1001. if(perm.has(player, "isTeam")) {
  1002. temp = math.random(1, 20);
  1003. } else {
  1004. temp = math.random(1, 5);
  1005. }
  1006. if(temp == 1) {
  1007. item.drop(loc, player.getHead(player.getUuid(player), player_name));
  1008. }
  1009. }
  1010. }
  1011. goto("wait");
  1012. }
  1013. killer = player.getFromDamageSource(damage_source);
  1014. if(isPlayer(killer)) {
  1015. r = math.random(1, 20);
  1016. if(r == 1) {
  1017. amount = skill.getAmount(killer, "skill.head_monster");
  1018. if(amount >= 1) {
  1019. entity_type = entity.getType(living_entity);
  1020. if(entity_type == "creeper") {
  1021. item.drop(loc, read.item("minecraft:creeper_head"));
  1022. goto("wait");
  1023. }
  1024. if(entity_type == "zombie") {
  1025. item.drop(loc, read.item("minecraft:zombie_head"));
  1026. goto("wait");
  1027. }
  1028. if(entity_type == "skeleton") {
  1029. item.drop(loc, read.item("minecraft:skeleton_skull"));
  1030. goto("wait");
  1031. }
  1032. }
  1033. }
  1034. }
  1035. goto("wait");
  1036. @player_pre_respawn
  1037. if(loc.isInSurvWorld(entity.getLocation(player))) {
  1038. set.add(survival_respawn, player.getUuid(player));
  1039. }
  1040. goto("wait");
  1041. @player_post_respawn
  1042. player_uuid = player.getUuid(player);
  1043. if(set.contains(survival_respawn, player_uuid)) {
  1044. set.remove(survival_respawn, player_uuid);
  1045. if(player.isOnAdventure(player)) {
  1046. tp_loc = player.getAdventureStart(player);
  1047. entity.teleport(player, tp_loc);
  1048. goto("wait");
  1049. }
  1050. amount = skill.getAmount(player, "skill.comeback");
  1051. if(skill.isActivated(player, "skill.comeback") && amount > 0) {
  1052. new_amount = amount - 1;
  1053. skill.setAmount(player, "skill.comeback", new_amount);
  1054. msg.prefix(player, prefix_skill, concat("Used Comeback. New amount: ", text.number(new_amount)));
  1055. entity.teleport(player, getDeathLoc(player));
  1056. goto("wait");
  1057. }
  1058. entity.teleport(player, world.getServerSpawn());
  1059. }
  1060. goto("wait");
  1061. @tp_ticker
  1062. array = list.getIndex(tp_list, 0);
  1063. list.removeIndex(tp_list, 0);
  1064. block_loc = array[1];
  1065. list.add(tp_list, array);
  1066. setTpWallFull(block_loc, "minecraft:lime_stained_glass");
  1067. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1068. sgoto(30, "tp_final");
  1069. goto("wait");
  1070. @tp_final
  1071. array = list.getIndex(tp_list, 0);
  1072. list.removeIndex(tp_list, 0);
  1073. player_uuid = array[0];
  1074. block_loc = array[1];
  1075. tp_loc = array[2];
  1076. adventure = array[3];
  1077. sound.spawn(block_loc, piston_sound, sound_category_ambient);
  1078. setTpWallFull(block_loc, "minecraft:air");
  1079. player = player.get(player_uuid);
  1080. if(player == null) {
  1081. goto("wait");
  1082. }
  1083. player.teleport(player, tp_loc, false);
  1084. sound.spawn(tp_loc, adv_tp_sound, sound_category_ambient);
  1085. if(adventure) {
  1086. player.setAdventure(player, true);
  1087. player.setAdventureStart(player, tp_loc);
  1088. addAdventureDisplay(player, adventure_aim_loc);
  1089. title.reset(player);
  1090. title.setSub(player, "Have fun!");
  1091. title.send(player, "§cAdventure");
  1092. msg.prefix(player, "§5Adventure", "§rTo complete your adventure, go to the survival spawn. You cannot teleport. If you die, you start again!");
  1093. }
  1094. goto("wait");
  1095. function lottery.set(location, amount) {
  1096. location = loc.mod(location, 0.5, 0, 0.5);
  1097. list = living.near(location, 0.1);
  1098. text_entity = list.getIndex(list, 0);
  1099. name = entity.getName(text_entity);
  1100. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1101. msg("dev", "Lottery error");
  1102. goto("wait");
  1103. }
  1104. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1105. }
  1106. function lottery.add(location, amount) {
  1107. location = loc.mod(location, 0.5, 0, 0.5);
  1108. list = living.near(location, 0.1);
  1109. text_entity = list.getIndex(list, 0);
  1110. name = entity.getName(text_entity);
  1111. if(!text.startsWith(name, "Snuvis: ", 0)) {
  1112. msg("dev", "Lottery error");
  1113. goto("wait");
  1114. }
  1115. amount = text.convert(text.subString(name, 8, text.length(name))) + 1;
  1116. entity.setName(text_entity, concat("Snuvis: ", text.number(amount)), true);
  1117. return amount;
  1118. }
  1119. function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
  1120. array = array.new(11);
  1121. array[0] = result_amount;
  1122. array[1] = result_item;
  1123. array[2] = item1;
  1124. array[3] = item2;
  1125. array[4] = item3;
  1126. array[5] = item4;
  1127. array[6] = item5;
  1128. array[7] = item6;
  1129. array[8] = item7;
  1130. array[9] = item8;
  1131. array[10] = item9;
  1132. list.add($items_list, array);
  1133. }
  1134. function recipe.getIndexFromItemType(item_type) {
  1135. for(i = 0; i < list.getSize($items_list); i++) {
  1136. array = list.getIndex($items_list, i);
  1137. if(array[1] == item_type) {
  1138. return i;
  1139. }
  1140. }
  1141. return null;
  1142. }
  1143. function recipe.showRecipe(player, menu, index) {
  1144. for(i = 0; i < 48; i++) {
  1145. inv.setItem(menu, i, $air_item);
  1146. }
  1147. array = list.getIndex($items_list, index);
  1148. inv.setItem(menu, 23, read.item("km:arrow_right"));
  1149. inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
  1150. inv.setItem(menu, 10, read.item(array[2]));
  1151. inv.setItem(menu, 11, read.item(array[3]));
  1152. inv.setItem(menu, 12, read.item(array[4]));
  1153. inv.setItem(menu, 19, read.item(array[5]));
  1154. inv.setItem(menu, 20, read.item(array[6]));
  1155. inv.setItem(menu, 21, read.item(array[7]));
  1156. inv.setItem(menu, 28, read.item(array[8]));
  1157. inv.setItem(menu, 29, read.item(array[9]));
  1158. inv.setItem(menu, 30, read.item(array[10]));
  1159. inv.setItem(menu, 25, read.item(array[1], array[0]));
  1160. inv.update(player);
  1161. }
  1162. function recipe.setPage(player, menu, page) {
  1163. map.add($recipe_site_map, player.getUuid(player), page);
  1164. size = list.getSize($items_list);
  1165. max_page = math.roundUp(size / 45);
  1166. if(page > max_page) {
  1167. return;
  1168. }
  1169. inv.setItem(menu, 45, $air_item);
  1170. if(page > 1) {
  1171. inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
  1172. } else {
  1173. inv.setItem(menu, 46, $air_item);
  1174. }
  1175. if(page < max_page) {
  1176. inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
  1177. } else {
  1178. inv.setItem(menu, 47, $air_item);
  1179. }
  1180. max_index = size - 1;
  1181. for(i = 0; i < 45; i++) {
  1182. list_index = i + 45 * (page - 1);
  1183. if(list_index > max_index) {
  1184. inv.setItem(menu, i, $air_item);
  1185. } else {
  1186. array = list.getIndex($items_list, list_index);
  1187. inv.setItem(menu, i, read.item(array[1]));
  1188. }
  1189. }
  1190. inv.update(player);
  1191. }
  1192. function setDeathLoc(player) {
  1193. map.add($death_loc_map, player.getUuid(player), entity.getLocation(player));
  1194. }
  1195. function getDeathLoc(player) {
  1196. return map.getOrDefault($death_loc_map, player.getUuid(player), world.getServerSpawn());
  1197. }