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

@@ -38,83 +38,92 @@ var matQty;
var cost;
var qty;
var items = [4080100,4080006,4080007,4080008,4080009,4080010,4080011];
var matSet = [[4030012],[4030009,4030013,4030014],[4030009,4030013,4030016],[4030009,4030014,4030016],[4030009,4030015,4030013],[4030009,4030015,4030014],[4030009,4030015,4030016]];
var matQtySet = [[99],[1,99,99],[1,99,99],[1,99,99],[1,99,99],[1,99,99],[1,99,99]];
var costSet = [10000,25000,25000,25000,25000,25000,25000];
var items = [4080100, 4080006, 4080007, 4080008, 4080009, 4080010, 4080011];
var matSet = [[4030012], [4030009, 4030013, 4030014], [4030009, 4030013, 4030016], [4030009, 4030014, 4030016], [4030009, 4030015, 4030013], [4030009, 4030015, 4030014], [4030009, 4030015, 4030016]];
var matQtySet = [[99], [1, 99, 99], [1, 99, 99], [1, 99, 99], [1, 99, 99], [1, 99, 99], [1, 99, 99]];
var costSet = [10000, 25000, 25000, 25000, 25000, 25000, 25000];
function start() {
cm.getPlayer().setCS(true);
var selStr = "Hey there! My name is #p2040014#, and I am a specialist in mini-games. What kind of mini-game you want me to make? #b"
var options = ["#i4080100# #t4080100#","#i4080006# #t4080006#","#i4080007# #t4080007#","#i4080008# #t4080008#","#i4080009# #t4080009#","#i4080010# #t4080010#","#i4080011# #t4080011#"];
for (var i = 0; i < options.length; i++)
var options = ["#i4080100# #t4080100#", "#i4080006# #t4080006#", "#i4080007# #t4080007#", "#i4080008# #t4080008#", "#i4080009# #t4080009#", "#i4080010# #t4080010#", "#i4080011# #t4080011#"];
for (var i = 0; i < options.length; i++) {
selStr += "\r\n#L" + i + "# " + options[i] + "#l";
}
cm.sendSimple(selStr);
}
function action(mode, type, selection) {
status++;
if (mode != 1){
if (mode != 1) {
cm.dispose();
return;
}
if (status == 0) {
if (status == 0) {
selectedItem = selection;
item = items[selectedItem];
mats = matSet[selectedItem];
matQty = matQtySet[selectedItem];
cost = costSet[selectedItem];
qty = 1;
var prompt = "So we are going for ";
if (qty == 1)
if (qty == 1) {
prompt += "a #t" + item + "#";
else
} else {
prompt += qty + " #t" + item + "#";
}
prompt += ", right? In that case, I'm going to need specific items from you in order to make it. Make sure you have room in your inventory, though!#b";
if (mats instanceof Array)
for(var i = 0; i < mats.length; i++)
if (mats instanceof Array) {
for (var i = 0; i < mats.length; i++) {
prompt += "\r\n#i" + mats[i] + "# " + (matQty[i] * qty) + " #t" + mats[i] + "#";
else
}
} else {
prompt += "\r\n#i" + mats + "# " + (matQty * qty) + " #t" + mats + "#";
if (cost > 0)
}
if (cost > 0) {
prompt += "\r\n#i4031138# " + (cost * qty) + " meso";
}
cm.sendYesNo(prompt);
}else if (status == 1) {
} else if (status == 1) {
var complete = true;
if (cm.getMeso() < (cost * qty)) {
cm.sendOk("See, I need to specify my wages to support my career, that cannot be bypassed. I will gladly help you once you've got the money.");
cm.dispose();
return;
}
else {
} else {
if (mats instanceof Array) {
for(var i = 0; complete && i < mats.length; i++)
if (!cm.haveItem(mats[i], matQty[i] * qty))
for (var i = 0; complete && i < mats.length; i++) {
if (!cm.haveItem(mats[i], matQty[i] * qty)) {
complete = false;
}else if (!cm.haveItem(mats, matQty * qty))
}
}
} else if (!cm.haveItem(mats, matQty * qty)) {
complete = false;
}
if (!complete)
}
}
if (!complete) {
cm.sendOk("You are lacking some items for the set you want to make. Please provide them so that we can assemble the game set.");
else {
if (cm.canHold(item,qty)) {
} else {
if (cm.canHold(item, qty)) {
if (mats instanceof Array) {
for (var i = 0; i < mats.length; i++)
for (var i = 0; i < mats.length; i++) {
cm.gainItem(mats[i], -(matQty[i] * qty));
}else
}
} else {
cm.gainItem(mats, -(matQty * qty));
}
cm.gainMeso(-(cost * qty));
cm.gainItem(item, qty);
cm.sendOk("There is your game set. Have fun!");
}else {
} else {
cm.sendOk("I can't make a set for you if there's no room in your ETC inventory for it. Please free a space first and then talk to me.");
}
}
cm.dispose();
}
}