Reformat and clean up portal scripts

This commit is contained in:
P0nk
2021-09-09 23:35:59 +02:00
parent d893309b4f
commit a78ca88a02
435 changed files with 2712 additions and 2287 deletions

View File

@@ -1,33 +1,32 @@
/* @author RonanLana */
function enter(pi) {
var stage = ((Math.floor(pi.getMapId() / 100)) % 10) - 1;
var em = pi.getEventManager("TD_Battle" + stage);
if(em == null) {
pi.playerMessage(5, "TD Battle " + stage + " encountered an unexpected error and is currently unavailable.");
return false;
}
var stage = ((Math.floor(pi.getMapId() / 100)) % 10) - 1;
var em = pi.getEventManager("TD_Battle" + stage);
if (em == null) {
pi.playerMessage(5, "TD Battle " + stage + " encountered an unexpected error and is currently unavailable.");
return false;
}
if (pi.getParty() == null) {
pi.playerMessage(5, "You are currently not in a party, create one to attempt the boss.");
return false;
} else if(!pi.isLeader()) {
pi.playerMessage(5, "Your party leader must enter the portal to start the battle.");
if (pi.getParty() == null) {
pi.playerMessage(5, "You are currently not in a party, create one to attempt the boss.");
return false;
} else if (!pi.isLeader()) {
pi.playerMessage(5, "Your party leader must enter the portal to start the battle.");
return false;
} else {
var eli = em.getEligibleParty(pi.getParty());
if (eli.size() > 0) {
if (!em.startInstance(pi.getParty(), pi.getPlayer().getMap(), 1)) {
pi.playerMessage(5, "The battle against the boss has already begun, so you may not enter this place yet.");
return false;
}
} else {
var eli = em.getEligibleParty(pi.getParty());
if(eli.size() > 0) {
if(!em.startInstance(pi.getParty(), pi.getPlayer().getMap(), 1)) {
pi.playerMessage(5, "The battle against the boss has already begun, so you may not enter this place yet.");
return false;
}
}
else {
pi.playerMessage(5, "Your party must consist of at least 2 players to attempt the boss.");
return false;
}
pi.playPortalSound();
return true;
pi.playerMessage(5, "Your party must consist of at least 2 players to attempt the boss.");
return false;
}
pi.playPortalSound();
return true;
}
}