Reformat and clean up npc scripts

This commit is contained in:
P0nk
2021-09-09 23:35:02 +02:00
parent 0c1545f81d
commit d893309b4f
665 changed files with 19932 additions and 19046 deletions

View File

@@ -3,16 +3,18 @@
* @npc: Chamberlain Eak
* @map: Orbis - Tower of Goddess
* @func: Orbis PQ
*/
*/
var status = 0;
var em = null;
function isStatueComplete() {
for(var i = 1; i <= 6; i++) {
if(cm.getMap().getReactorByName("scar" + i).getState() < 1) return false;
for (var i = 1; i <= 6; i++) {
if (cm.getMap().getReactorByName("scar" + i).getState() < 1) {
return false;
}
}
return true;
}
@@ -34,18 +36,19 @@ function action(mode, type, selection) {
cm.dispose();
return;
}
if (mode == 1)
if (mode == 1) {
status++;
else
} else {
status--;
}
if (cm.getPlayer().getMapId() == 920011200) { //exit
cm.warp(200080101);
cm.dispose();
return;
}
if (!cm.isEventLeader()) {
if(cm.getPlayer().getMapId() == 920010000) {
if (cm.getPlayer().getMapId() == 920010000) {
cm.warp(920010000, 2);
cm.dispose();
return;
@@ -58,9 +61,9 @@ function action(mode, type, selection) {
var eim = cm.getEventInstance();
switch(cm.getPlayer().getMapId()) {
switch (cm.getPlayer().getMapId()) {
case 920010000:
if(eim.getIntProperty("statusStg0") != 1) {
if (eim.getIntProperty("statusStg0") != 1) {
eim.warpEventTeamToMapSpawnPoint(920010000, 2);
eim.giveEventPlayersExp(3500);
clearStage(0, eim);
@@ -75,30 +78,30 @@ function action(mode, type, selection) {
if (isStatueComplete()) {
if (eim.getIntProperty("statusStg7") == -1) {
eim.warpEventTeam(920010800);
} else if(eim.getIntProperty("statusStg8") == -1) {
} else if (eim.getIntProperty("statusStg8") == -1) {
cm.sendOk("Oh! You brought the #t4001055#! Please, drop it at the base of the statue to bring Minerva back!");
} else {
cm.sendOk("Thank you for saving Minerva! Please, talk to her...");
}
} else {
cm.sendOk("Please, save Minerva! Gather the six pieces of her statue and then talk to me to retrieve the final piece!");
}
}
break;
case 920010200: //walkway
if (!cm.haveItem(4001050,30)) {
if (!cm.haveItem(4001050, 30)) {
cm.sendOk("Gather the 30 Statue Pieces from the monsters in this stage, and please bring them to me so I can put them together!");
} else {
cm.sendOk("You got them all! Here, the 1st statue piece.");
cm.removeAll(4001050);
cm.gainItem(4001044,1); //first piece
cm.gainItem(4001044, 1); //first piece
eim.giveEventPlayersExp(3500);
clearStage(1, eim);
}
break;
case 920010300: //storage
if(eim.getIntProperty("statusStg2") != 1) {
if(cm.getMap().countMonsters() == 0 && cm.getMap().countItems() == 0) {
if(cm.canHold(4001045)) {
if (eim.getIntProperty("statusStg2") != 1) {
if (cm.getMap().countMonsters() == 0 && cm.getMap().countItems() == 0) {
if (cm.canHold(4001045)) {
cm.sendOk("Oh, I've found the 2nd Piece of Statue. Here, take it.");
cm.gainItem(4001045, 1);
eim.giveEventPlayersExp(3500);
@@ -113,7 +116,7 @@ function action(mode, type, selection) {
} else {
cm.sendOk("Well done. Go find the other statue pieces.");
}
break;
case 920010400: //lobby
if (eim.getIntProperty("statusStg3") == -1) {
@@ -124,7 +127,7 @@ function action(mode, type, selection) {
eim.giveEventPlayersExp(3500);
clearStage(3, eim);
eim.setProperty("statusStg3", "2");
} else {
cm.sendOk("Thank you so much!");
}
@@ -132,14 +135,14 @@ function action(mode, type, selection) {
case 920010500: //sealed
if (eim.getIntProperty("statusStg4") == -1) {
var total = 3;
for(var i = 0; i < 2; i++) {
for (var i = 0; i < 2; i++) {
var rnd = Math.round(Math.random() * total);
total -= rnd;
eim.setProperty("stage4_" + i, rnd);
}
eim.setProperty("stage4_2", "" + total);
eim.setProperty("statusStg4", "0");
}
if (eim.getIntProperty("statusStg4") == 0) {
@@ -179,13 +182,13 @@ function action(mode, type, selection) {
cm.dispose();
break;
case 920010600: //lounge
if(eim.getIntProperty("statusStg5") == -1) {
if (!cm.haveItem(4001052,40)) {
if (eim.getIntProperty("statusStg5") == -1) {
if (!cm.haveItem(4001052, 40)) {
cm.sendOk("Gather the 40 Statue Pieces from the monsters in this stage, and please bring them to me so I can put them together!");
} else {
cm.sendOk("You got them all! Here, the 5th statue piece.");
cm.removeAll(4001052);
cm.gainItem(4001048,1); //fifth piece
cm.gainItem(4001048, 1); //fifth piece
eim.giveEventPlayersExp(3500);
clearStage(5, eim);
eim.setIntProperty("statusStg5", 1);
@@ -197,36 +200,42 @@ function action(mode, type, selection) {
case 920010700: //on the way up
if (eim.getIntProperty("statusStg6") == -1) {
var rnd1 = Math.floor(Math.random() * 5);
var rnd2 = Math.floor(Math.random() * 5);
while(rnd2 == rnd1) {
while (rnd2 == rnd1) {
rnd2 = Math.floor(Math.random() * 5);
}
if(rnd1 > rnd2) {
if (rnd1 > rnd2) {
rnd1 = rnd1 ^ rnd2;
rnd2 = rnd1 ^ rnd2;
rnd1 = rnd1 ^ rnd2;
}
var comb = "";
for(var i = 0; i < rnd1; i++) comb += "0";
for (var i = 0; i < rnd1; i++) {
comb += "0";
}
comb += "1";
for(var i = rnd1 + 1; i < rnd2; i++) comb += "0";
for (var i = rnd1 + 1; i < rnd2; i++) {
comb += "0";
}
comb += "1";
for(var i = rnd2 + 1; i < 5; i++) comb += "0";
for (var i = rnd2 + 1; i < 5; i++) {
comb += "0";
}
eim.setProperty("stage6_c", "" + comb);
eim.setProperty("statusStg6", "0");
}
var comb = eim.getProperty("stage6_c");
if (eim.getIntProperty("statusStg6") == 0) {
var react = "";
var total = 0;
for(var i = 1; i <= 5; i++) {
for (var i = 1; i <= 5; i++) {
if (cm.getMap().getReactorByName("" + i).getState() > 0) {
react += "1";
total += 1;
@@ -234,7 +243,7 @@ function action(mode, type, selection) {
react += "0";
}
}
if (total != 2) {
cm.sendOk("There needs to be exactly 2 levers at the top of the map pushed on.");
} else {
@@ -243,7 +252,9 @@ function action(mode, type, selection) {
for (var i = 0; i < 5; i++) {
if (react.charCodeAt(i) == comb.charCodeAt(i)) {
num_correct++;
if(react.charAt(i) == '1') psh_correct++;
if (react.charAt(i) == '1') {
psh_correct++;
}
}
}
if (num_correct == 5) {
@@ -265,17 +276,17 @@ function action(mode, type, selection) {
}
break;
case 920010800:
cm.sendNext("Please, find a way to defeat Papa Pixie! Once you've found the Dark Nependeath by placing seeds, you've found Papa Pixie! Defeat it, and get the Root of Life to save Minerva!!!");
cm.sendNext("Please, find a way to defeat Papa Pixie! Once you've found the Dark Nependeath by placing seeds, you've found Papa Pixie! Defeat it, and get the Root of Life to save Minerva!!!");
break;
case 920010900:
if(eim.getProperty("statusStg8") == "1") {
if (eim.getProperty("statusStg8") == "1") {
cm.sendNext("This is the jail of the tower. You may find some goodies here, just be sure to clear the puzzles ahead as fast as possible.");
} else {
cm.sendNext("Down there you will not find any statue pieces. Go up the ladder to return to the center tower and search elsewhere. You can come back here to get the goodies that lies down there once you have saved Minerva.");
}
break;
case 920011000:
if(cm.getMap().countMonsters() > 0) {
if (cm.getMap().countMonsters() > 0) {
cm.sendNext("This is the hidden room of the tower. After eliminating all monsters on this room, talk to me to gain access to the treasure room, leaving the center tower access behind.");
} else {
cm.warp(920011100, "st00");