todesjumpnrun.txt 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. rankingtable = "tjrranks";
  2. game_short = "tjr";
  3. maxplayers = 1;
  4. gamesignloc = minigame.getSignLoc("tjrsign");
  5. sign.started(gamesignloc);
  6. event.load("player_join");
  7. event.load("player_move");
  8. event.load("living_pre_hurt");
  9. event.load("player_post_respawn");
  10. event.load("player_toss");
  11. event.load("player_logout");
  12. event.load("player_giveup");
  13. event.load("entity_click");
  14. event.load("block_break");
  15. event.load("block_place");
  16. event.load("block_click");
  17. event.load("inv_click");
  18. event.load("function_key");
  19. @wait
  20. wait();
  21. if(event == "living_pre_hurt") {
  22. if(!isPlayer(living_entity)) {
  23. goto("wait");
  24. }
  25. player = living_entity;
  26. }
  27. if(player.hasMinigameId(player, script_id)) {
  28. ignoreGoto(event);
  29. }
  30. goto("wait");
  31. @player_join
  32. single_uuid = player.getUuid(player);
  33. lavacounter = 0;
  34. angel = read.item("minecraft:fishing_rod");
  35. arrow = read.item("minecraft:arrow");
  36. bow = read.item("minecraft:bow");
  37. ench = enchantment.get("minecraft:infinity");
  38. enchantment.add(ench, bow, 1);
  39. gamesworld = world.get("games");
  40. item_whole_run = read.item("minecraft:slime_block", 1, "§rGanzer Run");
  41. item.addLore(item_whole_run, 0, "Schaffe das ganze Jump'n'Run so schnell wie möglich. Checkpoints werden gespeichert.");
  42. item_module_run = read.item("minecraft:clock", 1, "§rModul");
  43. item.addLore(item_module_run, 0, "Erreiche in jedem einzelnen Modul eine Spitzenzeit.");
  44. item_fly_run = read.item("minecraft:elytra", 1, "§rFly");
  45. item.addLore(item_fly_run, 0, "Gehe mit Fly so schnell wie möglich durch das ganze Jump'n'Run. Checkpoints helfen dir hier nichts und du musst immer von vorne anfangen.");
  46. mode_menu = inv.new("222");
  47. inv_id_mode = inv.getId(mode_menu);
  48. inv.setItem(mode_menu, 0, item_whole_run);
  49. inv.setItem(mode_menu, 1, item_module_run);
  50. inv.setItem(mode_menu, 2, item_fly_run);
  51. all_modules_menu = inv.new("222222222222222222222222222222222222222222222222222222");
  52. inv_id_modules = inv.getId(all_modules_menu);
  53. inv.setItem(all_modules_menu, 0, read.item("minecraft:stone", 1, "§rStart"));
  54. inv.setItem(all_modules_menu, 1, read.item("minecraft:stone", 1, "§rModul 1"));
  55. inv.setItem(all_modules_menu, 2, read.item("minecraft:stone", 1, "§rModul 2"));
  56. inv.setItem(all_modules_menu, 3, read.item("minecraft:black_wool", 1, "§rModul 3"));
  57. inv.setItem(all_modules_menu, 4, read.item("minecraft:glass", 1, "§rModul 4"));
  58. inv.setItem(all_modules_menu, 5, read.item("minecraft:barrier", 1, "§rModul 5"));
  59. inv.setItem(all_modules_menu, 6, read.item("minecraft:fishing_rod", 1, "§rModul 6"));
  60. inv.setItem(all_modules_menu, 7, read.item("minecraft:lapis_block", 1, "§rModul 7"));
  61. inv.setItem(all_modules_menu, 8, read.item("minecraft:campfire", 1, "§rModul 8"));
  62. inv.setItem(all_modules_menu, 9, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 9"));
  63. inv.setItem(all_modules_menu, 10, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 10"));
  64. inv.setItem(all_modules_menu, 11, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 11"));
  65. inv.setItem(all_modules_menu, 12, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 12"));
  66. inv.setItem(all_modules_menu, 13, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 13"));
  67. inv.setItem(all_modules_menu, 14, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 14"));
  68. inv.setItem(all_modules_menu, 15, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 15"));
  69. inv.setItem(all_modules_menu, 16, read.item("minecraft:glass", 1, "§rModul 16"));
  70. inv.setItem(all_modules_menu, 17, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 17"));
  71. inv.setItem(all_modules_menu, 18, read.item("minecraft:repeater", 1, "§rModul 18"));
  72. inv.setItem(all_modules_menu, 19, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 19"));
  73. inv.setItem(all_modules_menu, 20, read.item("minecraft:red_wool", 1, "§rModul 20"));
  74. inv.setItem(all_modules_menu, 21, read.item("minecraft:chiseled_quartz_block", 1, "§rModul 21"));
  75. inv.setItem(all_modules_menu, 22, read.item("minecraft:netherrack", 1, "§rModul 22"));
  76. inv.setItem(all_modules_menu, 23, read.item("minecraft:netherrack", 1, "§rModul 23"));
  77. inv.setItem(all_modules_menu, 24, read.item("minecraft:netherrack", 1, "§rModul 24"));
  78. inv.setItem(all_modules_menu, 25, read.item("minecraft:netherrack", 1, "§rModul 25"));
  79. inv.setItem(all_modules_menu, 26, read.item("minecraft:end_stone", 1, "§rModul 26"));
  80. inv.setItem(all_modules_menu, 27, read.item("minecraft:end_stone", 1, "§rModul 27"));
  81. inv.setItem(all_modules_menu, 28, read.item("minecraft:poppy", 1, "§rModul 28"));
  82. inv.setItem(all_modules_menu, 29, read.item("minecraft:bookshelf", 1, "§rModul 29"));
  83. inv.setItem(all_modules_menu, 30, read.item("minecraft:oak_planks", 1, "§rModul 30"));
  84. inv.setItem(all_modules_menu, 31, read.item("minecraft:iron_block", 1, "§rModul 31"));
  85. inv.setItem(all_modules_menu, 32, read.item("minecraft:iron_block", 1, "§rModul 32"));
  86. inv.setItem(all_modules_menu, 33, read.item("minecraft:iron_block", 1, "§rModul 33"));
  87. inv.setItem(all_modules_menu, 34, read.item("minecraft:iron_block", 1, "§rModul 34"));
  88. inv.setItem(all_modules_menu, 35, read.item("minecraft:iron_block", 1, "§rModul 35"));
  89. inv.setItem(all_modules_menu, 36, read.item("minecraft:iron_block", 1, "§rModul 36"));
  90. inv.setItem(all_modules_menu, 37, read.item("minecraft:iron_block", 1, "§rModul 37"));
  91. inv.setItem(all_modules_menu, 38, read.item("minecraft:iron_block", 1, "§rModul 38"));
  92. inv.setItem(all_modules_menu, 39, read.item("minecraft:iron_block", 1, "§rModul 39"));
  93. inv.setItem(all_modules_menu, 40, read.item("minecraft:gray_wool", 1, "§rModul 40"));
  94. inv.setItem(all_modules_menu, 41, read.item("minecraft:light_gray_wool", 1, "§rModul 41"));
  95. inv.setItem(all_modules_menu, 42, read.item("minecraft:green_wool", 1, "§rModul 42"));
  96. inv.setItem(all_modules_menu, 43, read.item("minecraft:hay_block", 1, "§rModul 43"));
  97. inv.setItem(all_modules_menu, 44, read.item("minecraft:oak_log", 1, "§rModul 44"));
  98. inv.setItem(all_modules_menu, 45, read.item("minecraft:oak_log", 1, "§rModul 45"));
  99. inv.setItem(all_modules_menu, 46, read.item("minecraft:snow_block", 1, "§rModul 46"));
  100. inv.setItem(all_modules_menu, 47, read.item("minecraft:snow_block", 1, "§rModul 47"));
  101. inv.setItem(all_modules_menu, 48, read.item("minecraft:bookshelf", 1, "§rModul 48"));
  102. inv.setItem(all_modules_menu, 49, read.item("minecraft:white_wool", 1, "§rModul 49"));
  103. inv.setItem(all_modules_menu, 50, read.item("minecraft:dark_prismarine", 1, "§rModul 50"));
  104. inv.setItem(all_modules_menu, 51, read.item("minecraft:slime_block", 1, "§rModul 51"));
  105. inv.setItem(all_modules_menu, 52, read.item("minecraft:quartz_block", 1, "§rModul 52"));
  106. inv.setItem(all_modules_menu, 53, read.item("minecraft:quartz_block", 1, "§rModul 53"));
  107. for(i = 0; i < 54; i++) {
  108. item = inv.getItem(all_modules_menu, i);
  109. time = tjr.getModulTime(player, i);
  110. if(time == -1) {
  111. item.addLore(item, 0, "-");
  112. } else {
  113. item.addLore(item, 0, time.getClockString(time / 1000));
  114. }
  115. }
  116. checkpoints = list.new();
  117. //Start
  118. list.add(checkpoints, loc.new(gamesworld, 3939, 52, -5882, 180, 0.0001));
  119. //1.Modul
  120. list.add(checkpoints, loc.new(gamesworld, 3924, 62, -5908, 90, 0.0001));
  121. list.add(checkpoints, loc.new(gamesworld, 3914, 60, -5915, 180, 0.0001));
  122. list.add(checkpoints, loc.new(gamesworld, 3927, 78, -5921, -90, 0.0001));
  123. list.add(checkpoints, loc.new(gamesworld, 3934, 92, -5909, 90, 0.0001));
  124. list.add(checkpoints, loc.new(gamesworld, 3924, 92, -5894, 0.0001, 0.0001));
  125. list.add(checkpoints, loc.new(gamesworld, 3940, 101, -5888, 180, 0.0001));
  126. list.add(checkpoints, loc.new(gamesworld, 3943, 108, -5909, -90, 0.0001));
  127. list.add(checkpoints, loc.new(gamesworld, 3948, 117, -5919, 180, 0.0001));
  128. list.add(checkpoints, loc.new(gamesworld, 3933, 118, -5920, 90, 0.0001));
  129. list.add(checkpoints, loc.new(gamesworld, 3946, 122, -5928, 0.0001, 0.0001));
  130. //11.Modul
  131. list.add(checkpoints, loc.new(gamesworld, 3934, 127, -5926, -90, 0.0001));
  132. list.add(checkpoints, loc.new(gamesworld, 3942, 150, -5924, 90, 0.0001));
  133. list.add(checkpoints, loc.new(gamesworld, 3931, 143, -5924, 90, 0.0001));
  134. list.add(checkpoints, loc.new(gamesworld, 3914, 92, -5928, 90, 0.0001));
  135. list.add(checkpoints, loc.new(gamesworld, 3913, 98, -5915, 0.0001, 0.0001));
  136. list.add(checkpoints, loc.new(gamesworld, 3911, 136, -5915, 0.0001, 0.0001));
  137. list.add(checkpoints, loc.new(gamesworld, 3930, 152, -5892, -90, 0.0001));
  138. list.add(checkpoints, loc.new(gamesworld, 3940, 159, -5905, 180, 0.0001));
  139. list.add(checkpoints, loc.new(gamesworld, 3919, 161, -5906, 0.0001, 0.0001));
  140. list.add(checkpoints, loc.new(gamesworld, 3919, 162, -5896, 0.0001, 0.0001));
  141. //21.Modul
  142. list.add(checkpoints, loc.new(gamesworld, 3923, 163, -5923, 90, 0.0001));
  143. list.add(checkpoints, loc.new(gamesworld, 3923, 175, -5915, 0.0001, 0.0001));
  144. list.add(checkpoints, loc.new(gamesworld, 3916, 165, -5911, -90, 0.0001));
  145. list.add(checkpoints, loc.new(gamesworld, 3928, 168, -5912, -90, 0.0001));
  146. list.add(checkpoints, loc.new(gamesworld, 3933, 171, -5903, -90, 0.0001));
  147. list.add(checkpoints, loc.new(gamesworld, 3942, 141, -5889, 180, 0.0001));
  148. list.add(checkpoints, loc.new(gamesworld, 3944, 137, -5903, 90, 0.0001));
  149. list.add(checkpoints, loc.new(gamesworld, 3929, 125, -5898, -90, 0.0001));
  150. list.add(checkpoints, loc.new(gamesworld, 3925, 110, -5892, 180, 0.0001));
  151. list.add(checkpoints, loc.new(gamesworld, 3934, 88, -5937, 180, 0.0001));
  152. //31.Modul
  153. list.add(checkpoints, loc.new(gamesworld, 3936, 84, -5935, 180, 0.0001));
  154. list.add(checkpoints, loc.new(gamesworld, 3933, 83, -5950, 180, 0.0001));
  155. list.add(checkpoints, loc.new(gamesworld, 3927, 83, -5954, 90, 0.0001));
  156. list.add(checkpoints, loc.new(gamesworld, 3919, 75, -5950, 180, 0.0001));
  157. list.add(checkpoints, loc.new(gamesworld, 3923, 52, -5950, 90, 0.0001));
  158. list.add(checkpoints, loc.new(gamesworld, 3921, 55, -5957, 180, 0.0001));
  159. list.add(checkpoints, loc.new(gamesworld, 3927, 55, -5949, 0.0001, 0.0001));
  160. list.add(checkpoints, loc.new(gamesworld, 3943, 61, -5949, 180, 0.0001));
  161. list.add(checkpoints, loc.new(gamesworld, 3914, 52, -5943, 0.0001, 0.0001));
  162. list.add(checkpoints, loc.new(gamesworld, 3912, 92, -5941, -90, 0.0001));
  163. //41.Modul
  164. list.add(checkpoints, loc.new(gamesworld, 3924, 104, -5943, 180, 0.0001));
  165. list.add(checkpoints, loc.new(gamesworld, 3917, 115, -5950, -90, 0.0001));
  166. list.add(checkpoints, loc.new(gamesworld, 3933, 100, -5949, -90, 0.0001));
  167. list.add(checkpoints, loc.new(gamesworld, 3959, 55, -5948, -90, 0.0001));
  168. list.add(checkpoints, loc.new(gamesworld, 3973, 63, -5956, -90, 0.0001));
  169. list.add(checkpoints, loc.new(gamesworld, 3976, 55, -5963, 180, 0.0001));
  170. list.add(checkpoints, loc.new(gamesworld, 3963, 70, -5967, -90, 0.0001));
  171. list.add(checkpoints, loc.new(gamesworld, 3996, 77, -5971, 90, 0.0001));
  172. list.add(checkpoints, loc.new(gamesworld, 3987, 88, -5951, 180, 0.0001));
  173. list.add(checkpoints, loc.new(gamesworld, 3970, 91, -5955, 90, 0.0001));
  174. //51.Modul
  175. list.add(checkpoints, loc.new(gamesworld, 3986, 103, -5965, -90, 0.0001));
  176. list.add(checkpoints, loc.new(gamesworld, 3980, 73, -5945, 90, 0.0001));
  177. list.add(checkpoints, loc.new(gamesworld, 3963, 87, -5952, 180, 0.0001));
  178. //Finish
  179. list.add(checkpoints, loc.new(gamesworld, 3965, 101, -5970, 0.0001, 0.0001));
  180. spawnlocs = list.new();
  181. for(i = 0; i < list.getSize(checkpoints); i++) {
  182. location1 = list.getIndex(checkpoints, i);
  183. location2 = loc.mod(location1, 1, 1, 1);
  184. list.add(spawnlocs, loc.mod(location1, 0.5, 0, 0.5));
  185. if(i == 0) {
  186. continue; //Für Start keinen Move-Bereich erstellen
  187. }
  188. event.addMoveData(location1, location2, 3, -1, player);
  189. }
  190. gamename = "§cJR-Death";
  191. player.blockCommands(player);
  192. resetplayer(player);
  193. player.setGamemode(player, "adventure");
  194. tjr.setMode(player, "whole");
  195. gosub("stage_specific");
  196. display.add(player, 0, gamename);
  197. stacks.set(player, 8, "km:gear");
  198. stacks.setActive(player, true);
  199. sgoto(20, "loop");
  200. goto("wait");
  201. @block_click
  202. cancel = false;
  203. if(block_loc == loc.new(gamesworld, 3939, 102, -5887) || block_loc == loc.new(gamesworld, 3947, 102, -5889)) {
  204. player.giveItem(player, angel);
  205. player.giveItem(player, angel);
  206. player.giveItem(player, angel);
  207. player.giveItem(player, angel);
  208. goto("wait");
  209. }
  210. if(block_loc == loc.new(gamesworld, 3949, 123, -5927)) {
  211. player.giveItem(player, bow);
  212. player.giveItem(player, arrow);
  213. goto("wait");
  214. }
  215. goto("wait");
  216. @player_toss
  217. if(jumpstage != 43) {
  218. cancel = true;
  219. living.setEquip(player, "hand", item);
  220. inv.update(player);
  221. }
  222. goto("wait");
  223. @function_key
  224. if(key == 9) {
  225. inv.open(mode_menu, player, "Wähle einen Modus");
  226. }
  227. mode = tjr.getMode();
  228. if(mode == "whole") {
  229. if(key == 1) {
  230. living.setHealth(player, 20);
  231. tjr.teleportModule(player, jumpstage);
  232. entity.setBurning(player, 0);
  233. goto("wait");
  234. }
  235. if(key == 2) {
  236. living.setHealth(player, 20);
  237. jumpstage = 0;
  238. tjr.setStarttime();
  239. tjr.setWholeTimeTemp(player, 0);
  240. tjr.setWholeModuleTemp(player, 0);
  241. tjr.teleportModule(player, jumpstage);
  242. entity.setBurning(player, 0);
  243. }
  244. goto("wait");
  245. }
  246. if(mode == "fly") {
  247. if(key == 1) {
  248. living.setHealth(player, 20);
  249. jumpstage = 0;
  250. tjr.setStarttime();
  251. tjr.teleportModule(player, jumpstage);
  252. entity.setBurning(player, 0);
  253. }
  254. goto("wait");
  255. }
  256. if(mode == "modul") {
  257. if(key == 1) {
  258. living.setHealth(player, 20);
  259. tjr.setStarttime();
  260. tjr.teleportModule(player, jumpstage);
  261. entity.setBurning(player, 0);
  262. goto("wait");
  263. }
  264. if(key == 8) {
  265. inv.open(all_modules_menu, player, "Wähle ein Modul");
  266. }
  267. }
  268. goto("wait");
  269. @inv_click
  270. if(inv_id == inv_id_mode) {
  271. mode = tjr.getMode();
  272. if(mode == "whole") {
  273. tjr.leaveWholeMode(player);
  274. }
  275. if(inv_slot == 0) {
  276. tjr.setMode(player, "whole");
  277. goto("wait");
  278. }
  279. if(inv_slot == 1) {
  280. tjr.setMode(player, "modul");
  281. goto("wait");
  282. }
  283. if(inv_slot == 2) {
  284. tjr.setMode(player, "fly");
  285. }
  286. goto("wait");
  287. }
  288. if(inv_id == inv_id_modules) {
  289. jumpstage = inv_slot;
  290. tjr.teleportModule(player, jumpstage);
  291. gosub("stage_specific");
  292. inv.update(player);
  293. tjr.setStarttime();
  294. display.add(player, 2, concat("Dein Rekord: §e", time.getClockString(tjr.getModulTime(player, jumpstage) / 1000)));
  295. }
  296. goto("wait");
  297. @entity_click
  298. @block_break
  299. @block_place
  300. cancel = true;
  301. goto("wait");
  302. @player_post_respawn
  303. entity.teleport(player, list.getIndex(spawnlocs, jumpstage));
  304. goto("wait");
  305. @living_pre_hurt
  306. damage_type = damage.getType(damage_source);
  307. if(damage_type == "lava") {
  308. ++lavacounter;
  309. if(lavacounter >= 8) {
  310. lavacounter = 0;
  311. mode = tjr.getMode();
  312. scheduler.setBurning(10, player, 0);
  313. if(mode == "fly") {
  314. goto("wait");
  315. }
  316. key = 1;
  317. goto("function_key");
  318. }
  319. goto("wait");
  320. }
  321. if(damage_type == "fall") {
  322. if(jumpstage == 11 || jumpstage == 13) {
  323. goto("wait");
  324. }
  325. cancel = true;
  326. goto("wait");
  327. }
  328. if(damage_type == "arrow") {
  329. if(jumpstage == 30) {
  330. goto("wait");
  331. }
  332. cancel = true;
  333. }
  334. goto("wait");
  335. @player_move
  336. player_loc = entity.getLocation(player);
  337. x = loc.getCoord(player_loc, "bx");
  338. y = loc.getCoord(player_loc, "by");
  339. z = loc.getCoord(player_loc, "bz");
  340. loc = loc.new(gamesworld, x, y, z);
  341. mode = tjr.getMode();
  342. tjr.setEndtime();
  343. time = endtime - starttime;
  344. if(mode == "fly") {
  345. new_jumpstage = list.getIndexOf(checkpoints, loc);
  346. if(new_jumpstage > jumpstage) {
  347. jumpstage = new_jumpstage;
  348. gosub("stage_specific");
  349. }
  350. if(jumpstage == 54) {
  351. old_time = tjr.getFlyTime(player);
  352. if(old_time == -1 || time < old_time) {
  353. tjr.setFlyTime(player, time);
  354. msg.prefix(player, gamename, concat("Neuer Rekord: ", time.getClockString(time / 1000)));
  355. } else {
  356. msg.prefix(player, gamename, concat("Zeit: ", time.getClockString(time / 1000)));
  357. }
  358. }
  359. goto("wait");
  360. }
  361. if(mode == "modul") {
  362. new_jumpstage = list.getIndexOf(checkpoints, loc);
  363. if(new_jumpstage != jumpstage + 1) {
  364. goto("wait");
  365. }
  366. old_time = tjr.getModulTime(player, jumpstage);
  367. if(old_time == -1 || time < old_time) {
  368. tjr.setModulTime(player, jumpstage, time);
  369. time_string = time.getClockString(time / 1000);
  370. msg.prefix(player, gamename, concat("Neuer Rekord: ", time_string));
  371. item = inv.getItem(all_modules_menu, jumpstage);
  372. item.addLore(item, 0, time_string);
  373. jumpstage++;
  374. } else {
  375. msg.prefix(player, gamename, concat("Zeit: ", time.getClockString(time / 1000)));
  376. }
  377. tjr.setStarttime();
  378. tjr.teleportModule(player, jumpstage);
  379. goto("wait");
  380. }
  381. if(mode == "whole") {
  382. new_jumpstage = list.getIndexOf(checkpoints, loc);
  383. if(new_jumpstage <= jumpstage) {
  384. goto("wait");
  385. }
  386. jumpstage = new_jumpstage;
  387. gosub("stage_specific");
  388. player.action(player, "§aCheckpoint gesetzt");
  389. //Alltime first try or already done?
  390. old_modules = tjr.getWholeModule(player);
  391. if(old_modules == 54) {
  392. alltime_first_try = false;
  393. } else {
  394. alltime_first_try = true;
  395. }
  396. player_id = player.getId(player);
  397. time = tjr.getWholeTimeTemp(player) + time;
  398. if(jumpstage < 54) {
  399. msg.prefix(player, "§4Dr. Septimus", concat("Frohes Scheitern im ", text.number(jumpstage), ". Modul"));
  400. if(alltime_first_try) {
  401. ranking.setSecPoints(rankingtable, player_id, jumpstage, time);
  402. }
  403. goto("wait");
  404. }
  405. if(jumpstage == 54) {
  406. msg.prefix(player, gamename, concat("Zeit: ", time.getClockString(time / 1000)));
  407. if(alltime_first_try) {
  408. ranking.setSecPoints(rankingtable, player_id, jumpstage, time);
  409. goto("wait");
  410. }
  411. //Neuer Rekord?
  412. old_time = tjr.getWholeTime(player);
  413. if(old_time == 0 || time < old_time) {
  414. ranking.setSecPoints(rankingtable, player_id, jumpstage, time);
  415. msg.prefix(player, gamename, "Neuer Rekord!!!");
  416. }
  417. }
  418. }
  419. goto("wait");
  420. @stage_specific
  421. player.clearInventory(player);
  422. if(jumpstage == 6) {
  423. player.giveItem(player, angel);
  424. player.giveItem(player, angel);
  425. player.giveItem(player, angel);
  426. player.giveItem(player, angel);
  427. }
  428. elseif(jumpstage == 10 || jumpstage == 41 || jumpstage == 48 || jumpstage == 44) {
  429. player.giveItem(player, bow);
  430. player.giveItem(player, arrow);
  431. }
  432. elseif(jumpstage == 6 || jumpstage == 11 || jumpstage == 42 || jumpstage == 49) {
  433. player.clearInventory(player);
  434. }
  435. elseif(jumpstage == 28 || jumpstage == 29) {
  436. block.set(loc.new(gamesworld, 3944, 122, -5905), "minecraft:lever[powered=false,facing=west,face=wall]");
  437. block.set(loc.new(gamesworld, 3946, 122, -5905), "minecraft:air");
  438. block.set(loc.new(gamesworld, 3946, 122, -5905), "minecraft:redstone_wire");
  439. }
  440. elseif(jumpstage == 30) {
  441. block.addItem(loc.new(gamesworld, 3929, 92, -5935), read.item("minecraft:arrow", 576));
  442. }
  443. elseif(jumpstage == 43) {
  444. block.addItem(loc.new(gamesworld, 3932, 106, -5947), read.item("minecraft:hay_block", 576));
  445. }
  446. elseif(jumpstage == 47) {
  447. block.set(loc.new(gamesworld, 3968, 77, -5962), "minecraft:lever[powered=true,facing=north,face=wall]");
  448. entity.removeAll("net.minecraft.entity.projectile.ArrowEntity", loc.new(gamesworld, 3980, 77, -5960), 5);
  449. entity.removeAll("net.minecraft.entity.projectile.ArrowEntity", loc.new(gamesworld, 3981, 77, -5955), 5);
  450. }
  451. return;
  452. @loop
  453. player = player.get(single_uuid);
  454. seconds++;
  455. if(seconds == 60) {
  456. minutes++;
  457. seconds = 0;
  458. }
  459. if(seconds < 10) {
  460. display.add(player, 5, concat("Zeit: §e", text.number(minutes), ":0", text.number(seconds)));
  461. } else {
  462. display.add(player, 5, concat("Zeit: §e", text.number(minutes), ":", text.number(seconds)));
  463. }
  464. player.setHunger(player, 20);
  465. player.setSaturation(player, 5);
  466. sgoto(20, "loop");
  467. goto("wait");
  468. @player_logout
  469. @player_giveup
  470. player.setGamemode(player, "survival");
  471. player.unblockCommands(player);
  472. minigame.statsHeader(player, gamename, "§e");
  473. minigame.statsLine(player, "§e", "Module geschafft", concat(text.number(tjr.getWholeModule(player) - 1), " / 53"));
  474. minigame.statsLine(player, "§e", "Ganzer Run", time.getClockString(tjr.getWholeTime(player) / 1000));
  475. minigame.statsLine(player, "§e", "Fly-Mode", time.getClockString(tjr.getFlyTime(player) / 1000));
  476. all_module_time = tjr.getAllModulTime(player);
  477. if(all_module_time == -1) {
  478. minigame.statsLine(player, "§e", "Modul-Mode", "-");
  479. } else {
  480. minigame.statsLine(player, "§e", "Modul-Mode", time.getClockString(all_module_time / 1000));
  481. }
  482. mode = tjr.getMode();
  483. if(mode == "whole") {
  484. tjr.leaveWholeMode(player);
  485. }
  486. script = script.getFromId(script_id);
  487. minigame.kickPlayer(script, player);
  488. minigame.term(script, gamesignloc);
  489. term();
  490. function tjr.leaveWholeMode(player) {
  491. tjr.setWholeModuleTemp(player, $jumpstage);
  492. tjr.setEndtime();
  493. tjr.setWholeTimeTemp(player, tjr.getWholeTimeTemp(player) + $endtime - $starttime);
  494. }
  495. //Setzt die Zeit, für den Whole-Modi (THIS RUN)
  496. function tjr.setWholeTimeTemp(player_or_id, time) {
  497. config = playerdata.getGames(player_or_id);
  498. config.set(config, "tjr.wholetimetemp", time);
  499. config.saveAsync(config);
  500. }
  501. function tjr.getWholeTimeTemp(player_or_id) {
  502. config = playerdata.getGames(player_or_id);
  503. return config.getDouble(config, "tjr.wholetimetemp", 0);
  504. }
  505. //Setzt das erreichte Modul für den Whole-Modi (ALLTIME)
  506. function tjr.setWholeModule(player_or_id, modul) {
  507. if(isPlayer(player_or_id)) {
  508. player_or_id = player.getId(player_or_id);
  509. }
  510. ranking.setPoints($rankingtable, player_or_id, modul);
  511. }
  512. //Setzt das erreichte Modul für den Whole-Modi (THIS RUN)
  513. function tjr.setWholeModuleTemp(player_or_id, jumpstage) {
  514. config = playerdata.getGames(player_or_id);
  515. config.set(config, "tjr.wholetimemodule", jumpstage);
  516. config.saveAsync(config);
  517. }
  518. function tjr.getWholeModuleTemp(player_or_id) {
  519. config = playerdata.getGames(player_or_id);
  520. return config.getDouble(config, "tjr.wholetimemodule", 0);
  521. }
  522. function tjr.getAllModulTime(player) {
  523. sum_time = 0;
  524. for(i = 0; i < 54; i++) {
  525. time = tjr.getModulTime(player, i);
  526. if(time == -1) {
  527. sum_time = -1;
  528. break;
  529. }
  530. sum_time += time;
  531. }
  532. return sum_time;
  533. }
  534. //Setzt die Zeit, für den Fly-Modi
  535. function tjr.setFlyTime(player_or_id, time) {
  536. config = playerdata.getGames(player_or_id);
  537. config.set(config, "tjr.flytime", time);
  538. config.saveAsync(config);
  539. }
  540. function tjr.getFlyTime(player_or_id) {
  541. config = playerdata.getGames(player_or_id);
  542. return config.getDouble(config, "tjr.flytime", -1);
  543. }
  544. //Setzt die Zeit, für den Modul-Modi
  545. function tjr.setModulTime(player_or_id, module, time) {
  546. config = playerdata.getGames(player_or_id);
  547. config.set(config, concat("tjr.modultime", text.number(module)), time);
  548. config.saveAsync(config);
  549. }
  550. function tjr.getModulTime(player_or_id, module) {
  551. config = playerdata.getGames(player_or_id);
  552. return config.getDouble(config, concat("tjr.modultime", text.number(module)), -1);
  553. }
  554. //Teleportiert zu einem Checkpoint
  555. function tjr.teleportModule(player, jumpstage) {
  556. entity.teleport(player, list.getIndex($spawnlocs, jumpstage));
  557. }
  558. function tjr.setMode(player, mode) {
  559. if(mode == "fly") {
  560. player.setFly(player, true);
  561. type = "Modus: §eFly";
  562. stacks.set(player, 0, "km:return_red");
  563. stacks.clearIndex(player, 1);
  564. stacks.clearIndex(player, 7);
  565. $jumpstage = 0;
  566. display.add(player, 2, concat("Dein Rekord: §e", time.getClockString(tjr.getFlyTime(player) / 1000)));
  567. tjr.setStarttime();
  568. } elseif(mode == "whole") {
  569. player.setFly(player, false);
  570. type = "Modus: §eGanzer Run";
  571. stacks.set(player, 0, "km:refresh_red");
  572. stacks.set(player, 1, "km:return_red");
  573. stacks.clearIndex(player, 7);
  574. display.add(player, 2, concat("Dein Rekord: §e", time.getClockString(tjr.getWholeTime(player) / 1000)));
  575. $jumpstage = tjr.getWholeModuleTemp(player);
  576. old_time = tjr.getWholeTimeTemp(player);
  577. time = old_time / 1000;
  578. $minutes = math.roundDown(time / 60);
  579. $seconds = math.round(time % 60);
  580. $starttime = time.getMillis() - time;
  581. } elseif(mode == "modul") {
  582. player.setFly(player, false);
  583. type = "Modus: §eModul";
  584. stacks.set(player, 0, "km:refresh_red");
  585. stacks.set(player, 7, "minecraft:paper");
  586. stacks.clearIndex(player, 1);
  587. $jumpstage = 0;
  588. display.add(player, 2, concat("Dein Rekord: §e", time.getClockString(tjr.getModulTime(player, $jumpstage) / 1000)));
  589. tjr.setStarttime();
  590. }
  591. tjr.teleportModule(player, $jumpstage);
  592. display.add(player, 1, type);
  593. $mode = mode;
  594. }
  595. function tjr.getMode() {
  596. return $mode;
  597. }
  598. function tjr.setStarttime() {
  599. $minutes = 0;
  600. $seconds = 0;
  601. $starttime = time.getMillis();
  602. }
  603. function tjr.setEndtime() {
  604. $endtime = time.getMillis();
  605. }