123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- rankingtable = "icejrranks";
- game_short = "ijr";
- maxplayers = 1;
- gamesignsmap = getScriptVar("gamesigns");
- gamesignloc = map.get(gamesignsmap, "icejrsign");
- sign.started(gamesignloc);
- event.load("command");
- event.load("player_join");
- event.load("player_move");
- event.load("living_pre_hurt");
- event.load("player_post_respawn");
- event.load("player_toss");
- event.load("player_logout");
- event.load("player_giveup");
- event.load("entity_click");
- event.load("block_break");
- event.load("block_place");
- event.load("block_click");
- notallowed = list.new();
- list.add(notallowed, "fly");
- list.add(notallowed, "gm");
- list.add(notallowed, "gamemode");
- list.add(notallowed, "tp");
- list.add(notallowed, "teleport");
- list.add(notallowed, "tppos");
- list.add(notallowed, "top");
- list.add(notallowed, "j");
- list.add(notallowed, "jumpto");
- gamesworld = world.get("games");
- sign_tag = block.getTag("minecraft:signs");
- checkpoints = list.new();
- //1.Etage
- list.add(checkpoints, loc.new(gamesworld, 1000, 20, -2000)); //Spawn
- list.add(checkpoints, loc.new(gamesworld, 987, 24, -1997));
- list.add(checkpoints, loc.new(gamesworld, 990, 28, -1998));
- list.add(checkpoints, loc.new(gamesworld, 988, 27, -1985));
- list.add(checkpoints, loc.new(gamesworld, 1006, 24, -1985));
- list.add(checkpoints, loc.new(gamesworld, 1015, 25, -2010));
- list.add(checkpoints, loc.new(gamesworld, 999, 35, -2013));
- //2.Etage
- list.add(checkpoints, loc.new(gamesworld, 1001, 41, -2002));
- list.add(checkpoints, loc.new(gamesworld, 1000, 46, -2004));
- list.add(checkpoints, loc.new(gamesworld, 985, 51, -2003));
- list.add(checkpoints, loc.new(gamesworld, 986, 50, -2000));
- list.add(checkpoints, loc.new(gamesworld, 989, 50, -1985));
- list.add(checkpoints, loc.new(gamesworld, 988, 49, -1991));
- list.add(checkpoints, loc.new(gamesworld, 1012, 52, -1998));
- //3.Etage
- list.add(checkpoints, loc.new(gamesworld, 998, 57, -2004));
- list.add(checkpoints, loc.new(gamesworld, 997, 61, -1989));
- list.add(checkpoints, loc.new(gamesworld, 1000, 60, -2014));
- list.add(checkpoints, loc.new(gamesworld, 994, 66, -1985));
- //4.Etage
- list.add(checkpoints, loc.new(gamesworld, 1000, 75, -2002));
- list.add(checkpoints, loc.new(gamesworld, 985, 88, -1987));
- list.add(checkpoints, loc.new(gamesworld, 990, 81, -2001));
- //5.Etage
- list.add(checkpoints, loc.new(gamesworld, 1000, 94, -2003));
- list.add(checkpoints, loc.new(gamesworld, 1000, 103, -2010));
- list.add(checkpoints, loc.new(gamesworld, 1007, 100, -2013));
- list.add(checkpoints, loc.new(gamesworld, 1009, 102, -2002));
- list.add(checkpoints, loc.new(gamesworld, 1012, 101, -1993));
- list.add(checkpoints, loc.new(gamesworld, 986, 100, -1995));
- //Finish
- list.add(checkpoints, loc.new(gamesworld, 1000, 108, -1988));
- @wait
- wait();
- if(event == "living_pre_hurt") {
- if(!isPlayer(living_entity)) {
- goto("wait");
- }
- player = living_entity;
- }
- if(player.hasMinigameId(player, script_id)) {
- ignoreGoto(event);
- }
- goto("wait");
- @player_join
- spawnlocs = list.new();
- for(i = 0; i < list.getSize(checkpoints); i++) {
- location1 = list.getIndex(checkpoints, i);
- location2 = loc.mod(location1, 1, 1, 1);
- event.addMoveData(location1, location2, -1, -1, player);
-
- list.add(spawnlocs, loc.mod(location1, 0.5, 0, 0.5));
- }
- single_uuid = player.getUuid(player);
- starttime = time.getMillis();
- player.blockCommands(player);
- jumpstage = ranking.getPoints(rankingtable, player.getId(player));
- entity.teleport(player, list.getIndex(spawnlocs, jumpstage));
- player.clearInventory(player);
- entity.addEffect(player, "minecraft:night_vision", 32760, 0, false);
- gosub("stage_specific");
- player.setGamemode(player, "adventure");
- player.setFly(player, false);
- sgoto(1, "loop");
- goto("wait");
- @block_click
- if(block.hasTag(sign_tag, block)) {
- if(block.getSign(block_loc, 2) == "Checkpoint") {
- entity.teleport(player, list.getIndex(spawnlocs, jumpstage));
- }
- }
- goto("wait");
- @command
- if(list.contains(notallowed, toLowerCase(command))) {
- cancel = true;
- msg.prefix(player, "§6Commands", "§rDie wichtigste Regel im Wettkampf: Sabotage!");
- }
- goto("wait");
- @player_toss
- living.setEquip(player, "hand", item);
- cancel = true;
- goto("wait");
- @entity_click
- @block_break
- @block_place
- cancel = true;
- goto("wait");
- @player_post_respawn
- entity.teleport(player, list.getIndex(spawnlocs, jumpstage));
- goto("wait");
- @living_pre_hurt
- damage_type = damage.getType(damage_source);
- if(damage_type == "fall") {
- cancel = true;
- goto("wait");
- }
- if(damage_type == "arrow") {
- cancel = true;
- goto("wait");
- }
- goto("wait");
- @player_move
- player_loc = entity.getLocation(player);
- x = loc.getCoord(player_loc, "bx");
- y = loc.getCoord(player_loc, "by");
- z = loc.getCoord(player_loc, "bz");
- loc = loc.new(gamesworld, x, y, z);
- index = list.getIndexOf(checkpoints, loc);
- if(index > jumpstage) {
- player.action(player, "§aCheckpoint gesetzt");
- msg.prefix(player, "§6Commands", concat("§r", text.number(index), ".Checkpoint erreicht"));
- jumpstage = index;
- gosub("stage_specific");
- }
- goto("wait");
- @stage_specific
- return;
- @loop
- player = player.get(single_uuid);
- player.setHunger(player, 20);
- player.setSaturation(player, 5);
- sgoto(200, "loop");
- goto("wait");
- @player_logout
- @player_giveup
- player.setGamemode(player, "survival");
- player.unblockCommands(player);
- endtime = time.getMillis();
- time = endtime - starttime;
- newtime = ijr.getIjrTime(player) + time;
- ijr.setIjrTime(player, newtime);
- ranking.setPoints(rankingtable, player.getId(player), jumpstage);
- owntime = newtime / 1000; //in Sekunden
- hours = text.number(math.rounddown(owntime / 3600));
- minutes = text.number(math.round(math.mod(owntime, 3600) / 60));
- minigame.statsHeader(player, "§7IceJumpnRun", "§e");
- minigame.statsLine(player, "§e", "Checkpoints", text.number(jumpstage));
- minigame.statsLine(player, "§e", "Time", concat(hours, "h ", minutes, "min"));
- script = script.getFromId(script_id);
- minigame.kickPlayer(script, player);
- minigame.term(script, gamesignloc);
- term();
- function ijr.setIjrTime(player_or_id, time) {
- config = playerdata.getGames(player_or_id);
- config.set(config, "icejumptime", time);
- config.saveAsync(config);
- }
- function ijr.getIjrTime(player_or_id) {
- config = playerdata.getGames(player_or_id);
- return config.getDouble(config, "icejumptime", 0);
- }
|