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

@@ -36,37 +36,36 @@ function start() {
}
function action(mode, type, selection) {
if (mode == -1)
if (mode == -1) {
cm.dispose();
else {
} else {
if (mode == 0) {
cm.dispose();
return;
}
if (mode == 1)
if (mode == 1) {
status++;
else
} else {
status--;
}
var eim = cm.getPlayer().getEventInstance();
if (status == 0) {
if(!eim.isEventCleared()) {
if (!eim.isEventCleared()) {
cm.sendSimple("...#b\r\n#L0#What am I supposed to do here?#l\r\n#L1#I brought items!#l\r\n#L2#I want to get out!#l");
} else {
cm.sendNext("You completed this ordeal, now receive your prize.");
}
}
else if (status == 1) {
if(!eim.isEventCleared()) {
} else if (status == 1) {
if (!eim.isEventCleared()) {
selectedType = selection;
if (selection == 0) {
cm.sendNext("To reveal the power of Zakum, you'll have to recreate its core. Hidden somewhere in this dungeon is a #b\"Fire Ore\"#k which is one of the necessary materials for that core. Find it, and bring it to me.\r\n\r\nOh, and could you do me a favour? There's also a number of #bPaper Documents#k lying under rocks around here. If you can get 30 of them, I can reward you for your efforts.");
cm.dispose();
return;
}
else if (selection == 1) {
if(!cm.isEventLeader()) {
} else if (selection == 1) {
if (!cm.isEventLeader()) {
cm.sendNext("Please let your leader bring the materials to me to complete this ordeal.");
cm.dispose();
return;
@@ -75,8 +74,7 @@ function action(mode, type, selection) {
if (!cm.haveItem(4001018)) { //fire ore
cm.sendNext("Please bring the #bFire Ore#k with you.");
cm.dispose();
}
else {
} else {
gotAllDocs = cm.haveItem(4001015, 30);
if (!gotAllDocs) { //documents
cm.sendYesNo("So, you brought the fire ore with you? In that case, I can give to you and to each member of your party a piece of it, that should be more than enough to make the core of Zakum. Make sure your whole party has room in their inventory before proceeding.");
@@ -84,12 +82,13 @@ function action(mode, type, selection) {
cm.sendYesNo("So, you brought the fire ore and the documents with you? In that case, I can give to you and to each member of your party a piece of it, that should be more than enough to make the core of Zakum. As well, since you #rbrought the documents#k with you, I can also provide you a special item which will #bbring you to the mine's entrance at any time#k. Make sure your whole party has room in their inventory before proceeding.");
}
}
} else if (selection == 2)
} else if (selection == 2) {
cm.sendYesNo("Are you sure you want to exit? If you're the party leader, your party will also be removed from the mines.");
}
} else {
if(eim.getProperty("gotDocuments") == 1) {
if(eim.gridCheck(cm.getPlayer()) == -1) {
if(cm.canHoldAll([2030007, 4031061], [5, 1])) {
if (eim.getProperty("gotDocuments") == 1) {
if (eim.gridCheck(cm.getPlayer()) == -1) {
if (cm.canHoldAll([2030007, 4031061], [5, 1])) {
cm.gainItem(2030007, 5);
cm.gainItem(4031061, 1);
@@ -101,8 +100,8 @@ function action(mode, type, selection) {
cm.sendOk("You have already received your share. You can now exit the mines through the portal over there.");
}
} else {
if(eim.gridCheck(cm.getPlayer()) == -1) {
if(cm.canHold(4031061, 1)) {
if (eim.gridCheck(cm.getPlayer()) == -1) {
if (cm.canHold(4031061, 1)) {
cm.gainItem(4031061, 1);
eim.gridInsert(cm.getPlayer(), 1);
@@ -113,28 +112,26 @@ function action(mode, type, selection) {
cm.sendOk("You have already received your share. You can now exit the mines through the portal over there.");
}
}
cm.dispose();
}
}
else if (status == 2) {
} else if (status == 2) {
if (selectedType == 1) {
cm.gainItem(4001018, -1);
if(gotAllDocs) {
if (gotAllDocs) {
cm.gainItem(4001015, -30);
eim.setProperty("gotDocuments", 1);
eim.giveEventPlayersExp(20000);
} else {
eim.giveEventPlayersExp(12000);
}
eim.clearPQ();
cm.dispose();
}
else if (selectedType == 2) {
} else if (selectedType == 2) {
cm.warp(211042300);
cm.dispose();
}