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

@@ -20,16 +20,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
Pila Present
-- By ---------------------------------------------------------------------------------------------
get31720 (RaGEZONE)
-- Version Info -----------------------------------------------------------------------------------
1.0 - First Version by Angel
2.0 - Second Version by happydud3 & XotiCraze
3.0 - Third Version by RonanLana (HeavenMS)
4.0 - Fourth Version by Drago (MapleStorySA)
---------------------------------------------------------------------------------------------------
**/
Pila Present
-- By ---------------------------------------------------------------------------------------------
get31720 (RaGEZONE)
-- Version Info -----------------------------------------------------------------------------------
1.0 - First Version by Angel
2.0 - Second Version by happydud3 & XotiCraze
3.0 - Third Version by RonanLana (HeavenMS)
4.0 - Fourth Version by Drago (MapleStorySA)
---------------------------------------------------------------------------------------------------
**/
var status = -1;
var marriageRoom;
@@ -42,7 +42,7 @@ function start() {
marriageGifts = cm.getUnclaimedMarriageGifts();
marriageAction = (!marriageGifts.isEmpty() ? 2 : ((cm.haveItem(4031423) || cm.haveItem(4031424)) ? 1 : 0));
}
status = -1;
action(1, 0, 0);
}
@@ -59,7 +59,7 @@ function action(mode, type, selection) {
var talk = "Hi there, welcome to the wedding's Gift Registry. From which spouse's wishlist would you like to take a look?";
var options = ["Groom", "Bride"];
cm.sendSimple(talk + "\r\n\r\n#b" + generateSelectionMenu(options) + "#k");
cm.sendSimple(talk + "\r\n\r\n#b" + generateSelectionMenu(options) + "#k");
} else {
cm.sendMarriageWishlist(selection == 0);
cm.dispose();
@@ -76,7 +76,7 @@ function action(mode, type, selection) {
} else if (marriageAction == 1) { // onyx prizes
if (status == 0) {
var msg = "Hello I exchange Onyx Chest for Bride and Groom and the Onyx Chest for prizes!#b";
var choice1 = new Array("I have an Onyx Chest for Bride and Groom", "I have an Onyx Chest");
var choice1 = ["I have an Onyx Chest for Bride and Groom", "I have an Onyx Chest"];
for (var i = 0; i < choice1.length; i++) {
msg += "\r\n#L" + i + "#" + choice1[i] + "#l";
}
@@ -85,11 +85,11 @@ function action(mode, type, selection) {
if (selection == 0) {
if (cm.haveItem(4031424)) {
if (cm.getPlayer().isMarried()) { // thanks MedicOP for solving an issue here
if(cm.getInventory(2).getNextFreeSlot() >= 0) {
if (cm.getInventory(2).getNextFreeSlot() >= 0) {
var rand = Math.floor(Math.random() * bgPrizes.length);
cm.gainItem(bgPrizes[rand][0], bgPrizes[rand][1]);
cm.gainItem(4031424,-1);
cm.gainItem(4031424, -1);
cm.dispose();
} else {
cm.sendOk("You don't have a free USE slot right now.");
@@ -105,11 +105,11 @@ function action(mode, type, selection) {
}
} else if (selection == 1) {
if (cm.haveItem(4031423)) {
if(cm.getInventory(2).getNextFreeSlot() >= 0) {
if (cm.getInventory(2).getNextFreeSlot() >= 0) {
var rand = Math.floor(Math.random() * cmPrizes.length);
cm.gainItem(cmPrizes[rand][0], cmPrizes[rand][1]);
cm.gainItem(4031423,-1);
cm.gainItem(4031423, -1);
cm.dispose();
} else {
cm.sendOk("You don't have a free USE slot right now.");
@@ -124,14 +124,14 @@ function action(mode, type, selection) {
} else {
cm.sendOk("Hi there, welcome to Amoria's Wedding Gift Registry reserve. We redistribute and tender gifts for both wedding spouses and lucky ceremonial attenders.");
cm.dispose();
}
}
}
}
function generateSelectionMenu(array) {
var menu = "";
for (var i = 0; i < array.length; i++) {
menu += "#L" + i + "#" + array[i] + "#l\r\n";
}
return menu;
var menu = "";
for (var i = 0; i < array.length; i++) {
menu += "#L" + i + "#" + array[i] + "#l\r\n";
}
return menu;
}