|
@@ -1,41 +1,24 @@
|
|
|
-block.setSign(gamesignloc, 2, "1/1");
|
|
|
-block.setSign(gamesignloc, 3, "§6Läuft");
|
|
|
+sign.started(gamesignloc);
|
|
|
+rankingtable = "letterranks";
|
|
|
|
|
|
-list.new(letters);
|
|
|
-list.new(letters2);
|
|
|
+letters = list.new();
|
|
|
+letters2 = list.new();
|
|
|
list.addAll(letters, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
|
|
|
list.addAll(letters2, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
|
|
|
|
|
|
-player = script.getLeader();
|
|
|
-player_id = player.getId(player);
|
|
|
-
|
|
|
-rankingtable = "letterranks";
|
|
|
-registerRanking(rankingtable);
|
|
|
-
|
|
|
event.load("block_click");
|
|
|
event.load("player_logout");
|
|
|
event.load("player_giveup");
|
|
|
+event.load("player_join");
|
|
|
counter = 0;
|
|
|
minutes = 0;
|
|
|
seconds = 0;
|
|
|
if(!fixsigns) {
|
|
|
- list.new(logcoords);
|
|
|
- list.new(signcoords);
|
|
|
- list.new(sign_facing);
|
|
|
+ logcoords = list.new();
|
|
|
+ signcoords = list.new();
|
|
|
+ sign_facing = list.new();
|
|
|
}
|
|
|
-air_item_type = "minecraft:air";
|
|
|
-gamesworldloc = read.location(ggv("SERVER", "gamesspawn"));
|
|
|
gamename = "§dLetters";
|
|
|
-title.setTime(player, 20, 0, 20);
|
|
|
-title.setSub(player, mapname);
|
|
|
-title.send(player, gamename);
|
|
|
-nextletter = list.getIndex(letters, counter);
|
|
|
-display.add(player, 1, gamename);
|
|
|
-display.add(player, 2, "§rFortschritt:");
|
|
|
-display.add(player, 3, concat(text.number(counter), "/26"));
|
|
|
-display.add(player, 4, concat("§rGesucht: ", nextletter));
|
|
|
-display.add(player, 5, concat("§rZeit: 0:00"));
|
|
|
-player.clearInventory(player);
|
|
|
log_tag = block.getTag("minecraft:logs");
|
|
|
sign_tag = block.getTag("minecraft:signs");
|
|
|
|
|
@@ -63,19 +46,19 @@ if(!fixsigns) {
|
|
|
xedgedistance = x2 - x1;
|
|
|
zedgedistance = z2 - z1;
|
|
|
|
|
|
- for(x = 0; x <= xedgedistance - 1; x++) {
|
|
|
- for(z = 0; z <= zedgedistance - 1; z++) {
|
|
|
+ for(x = 0; x < xedgedistance; x++) {
|
|
|
+ for(z = 0; z < zedgedistance; z++) {
|
|
|
relloc = loc.mod(edge1, x, 0, z);
|
|
|
if(block.hasTag(log_tag, block.get(relloc))) {
|
|
|
list.add(logcoords, relloc);
|
|
|
}
|
|
|
if(block.hasTag(sign_tag, block.get(relloc))) {
|
|
|
- block.set(relloc, air_item_type);
|
|
|
+ block.set(relloc, "minecraft:air");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for(i = 0; i <= list.getSize(logcoords) - 1; i++) {
|
|
|
+ for(i = 0; i < list.getSize(logcoords); i++) {
|
|
|
x = 0;
|
|
|
z = 0;
|
|
|
y = math.random(0, 3);
|
|
@@ -102,7 +85,7 @@ if(!fixsigns) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for(i = 0; i <= list.getSize(signcoords) - 1; i++) {
|
|
|
+ for(i = 0; i < list.getSize(signcoords); i++) {
|
|
|
temploc = list.getIndex(signcoords, i);
|
|
|
facing = list.getIndex(sign_facing, i);
|
|
|
block.set(temploc, concat("minecraft:oak_wall_sign[facing=", facing, "]"));
|
|
@@ -111,20 +94,35 @@ if(!fixsigns) {
|
|
|
list.removeIndex(letters2, tempindex);
|
|
|
}
|
|
|
} elseif(fixsigns) {
|
|
|
- for(i = 0; i <= list.getSize(signcoords) - 1; i++) {
|
|
|
+ for(i = 0; i < list.getSize(signcoords); i++) {
|
|
|
temploc = list.getIndex(signcoords, i);
|
|
|
tempindex = math.random(0 , list.getSize(letters2) - 1);
|
|
|
block.setSign(temploc, 0, list.getIndex(letters2, tempindex));
|
|
|
list.removeIndex(letters2, tempindex);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-entity.teleport(player, spawnloc);
|
|
|
sgoto(20, "loop");
|
|
|
|
|
|
@wait
|
|
|
wait();
|
|
|
-ignoreGoto(event);
|
|
|
+if(player.hasMinigameId(player, script_id)) {
|
|
|
+ ignoreGoto(event);
|
|
|
+}
|
|
|
+goto("wait");
|
|
|
+
|
|
|
+@player_join
|
|
|
+entity.teleport(player, spawnloc);
|
|
|
+resetplayer(player);
|
|
|
+title.setTime(player, 20, 0, 20);
|
|
|
+title.setSub(player, mapname);
|
|
|
+title.send(player, gamename);
|
|
|
+nextletter = list.getIndex(letters, counter);
|
|
|
+display.add(player, 1, gamename);
|
|
|
+display.add(player, 2, "Progress:");
|
|
|
+display.add(player, 3, concat(text.number(counter), "/26"));
|
|
|
+display.add(player, 4, concat("Find: ", nextletter));
|
|
|
+display.add(player, 5, concat("Time: 0:00"));
|
|
|
+player.clearInventory(player);
|
|
|
goto("wait");
|
|
|
|
|
|
@loop
|
|
@@ -134,9 +132,9 @@ if(seconds == 60) {
|
|
|
seconds = 0;
|
|
|
}
|
|
|
if(seconds < 10) {
|
|
|
- display.add(player, 5, concat("§rZeit: ", text.number(minutes), ":0", text.number(seconds)));
|
|
|
+ display.add(player, 5, concat("Time: ", text.number(minutes), ":0", text.number(seconds)));
|
|
|
} else {
|
|
|
- display.add(player, 5, concat("§rZeit: ", text.number(minutes), ":", text.number(seconds)));
|
|
|
+ display.add(player, 5, concat("Time: ", text.number(minutes), ":", text.number(seconds)));
|
|
|
}
|
|
|
sgoto(20, "loop");
|
|
|
goto("wait");
|
|
@@ -147,7 +145,7 @@ if(block.hasTag(sign_tag, block.get(block_loc))) {
|
|
|
letter = block.getSign(block_loc, 0);
|
|
|
if(letter == nextletter) {
|
|
|
counter++;
|
|
|
- player.speak(player, gamename, "§rFortschritt: ", text.number(counter), "/26");
|
|
|
+ speakPrefix(player, gamename, concat("Progress: ", text.number(counter), "/26"));
|
|
|
display.add(player, 3, concat(text.number(counter), "/26"));
|
|
|
entity.setHealth(player, 20);
|
|
|
player.setHunger(player, 20);
|
|
@@ -155,48 +153,43 @@ if(block.hasTag(sign_tag, block.get(block_loc))) {
|
|
|
if(counter == 26) {
|
|
|
time = minutes * 60 + seconds;
|
|
|
tpl = math.roundComma(time / 26, 2);
|
|
|
+ player_id = player.getId(player);
|
|
|
playedgames = getPlayedGames(rankingtable, player_id) + 1;
|
|
|
last_record = getPoints(rankingtable, player_id);
|
|
|
-
|
|
|
- player.speak(player, gamename, "§r---= §eStatistik §r=---");
|
|
|
- player.speak(player, gamename, concat("§eZeit: §r", text.number(minutes), " min ", text.number(seconds), " s"));
|
|
|
- player.speak(player, gamename, concat("§eTime per Letter: §r", text.number(tpl), " s"));
|
|
|
-
|
|
|
if(last_record == 0 || time < last_record) {
|
|
|
record = time;
|
|
|
diff = last_record - time;
|
|
|
- player.speak(player, gamename, concat("§eEigenen Rekord um §r", text.number(diff), "§e s übertroffen"));
|
|
|
} else {
|
|
|
record = last_record;
|
|
|
}
|
|
|
-
|
|
|
setRanking(rankingtable, player_id, record, playedgames);
|
|
|
-
|
|
|
rec_mins = math.roundDown(record / 60);
|
|
|
rec_secs = math.roundComma(record % 60, 2);
|
|
|
- player.speak(player, gamename, concat("§eDein Rekord: §r", text.number(rec_mins), " min ", text.number(rec_secs), " s"));
|
|
|
- player.speak(player, gamename, concat("§eGespielte Spiele: §r", text.number(playedgames)));
|
|
|
|
|
|
+ minigame.statsHeader(player, gamename, "§e");
|
|
|
+ minigame.statsLine(player, "§e", "Time", concat(text.number(minutes), " min ", text.number(seconds), " s"));
|
|
|
+ minigame.statsLine(player, "§e", "Time per Letter", concat(text.number(tpl), " s"));
|
|
|
+ minigame.statsLine(player, "§e", "Your record", concat(text.number(rec_mins), " min ", text.number(rec_secs), " s"));
|
|
|
+ if(diff != null) {
|
|
|
+ msg(player, " §e- §rBeat own record by §e", concat(text.number(diff), " s"));
|
|
|
+ }
|
|
|
+ minigame.statsLine(player, "§e", "Played games", text.number(playedgames));
|
|
|
goto("player_giveup");
|
|
|
}
|
|
|
nextletter = list.getIndex(letters, counter);
|
|
|
- display.add(player, 4, concat("§rGesucht: ", nextletter));
|
|
|
+ display.add(player, 4, concat("Find: ", nextletter));
|
|
|
}
|
|
|
}
|
|
|
goto("wait");
|
|
|
|
|
|
@player_logout
|
|
|
@player_giveup
|
|
|
-display.reset(player);
|
|
|
-tptogameslobby(player);
|
|
|
-resetplayer(player);
|
|
|
-block.setSign(gamesignloc, 2, "0/1");
|
|
|
-block.setSign(gamesignloc, 3, "§2Wartet");
|
|
|
if(!fixsigns) {
|
|
|
- for(i = 0; i <= list.getSize(signcoords) - 1; i++) {
|
|
|
- block.set(list.getIndex(signcoords, i), air_item_type);
|
|
|
+ for(i = 0; i < list.getSize(signcoords); i++) {
|
|
|
+ block.set(list.getIndex(signcoords, i), "minecraft:air");
|
|
|
}
|
|
|
}
|
|
|
-block.setSign(gamesignloc, 2, "0/1");
|
|
|
-block.setSign(gamesignloc, 3, "§2Wartet");
|
|
|
-term();
|
|
|
+script = script.getFromId(script_id);
|
|
|
+minigame.kickPlayer(script, player);
|
|
|
+minigame.term(script, gamesignloc);
|
|
|
+term();
|