Reformat and clean up npc scripts
This commit is contained in:
@@ -43,7 +43,7 @@ function pushIfItemExists(array, itemid) {
|
||||
function pushIfItemsExists(array, itemidList) {
|
||||
for (var i = 0; i < itemidList.length; i++) {
|
||||
var itemid = itemidList[i];
|
||||
|
||||
|
||||
if ((itemid = cm.getCosmeticItem(itemid)) != -1 && !cm.isCosmeticEquipped(itemid)) {
|
||||
array.push(itemid);
|
||||
}
|
||||
@@ -63,31 +63,33 @@ function action(mode, type, selection) {
|
||||
if (selection == 1) {
|
||||
beauty = 0;
|
||||
facenew = Array();
|
||||
if (cm.getPlayer().getGender() == 0)
|
||||
for (var i = 0; i < mface_r.length; i++)
|
||||
if (cm.getPlayer().getGender() == 0) {
|
||||
for (var i = 0; i < mface_r.length; i++) {
|
||||
pushIfItemExists(facenew, mface_r[i] + cm.getPlayer().getFace() % 1000 - (cm.getPlayer().getFace() % 100));
|
||||
else
|
||||
for (var i = 0; i < fface_r.length; i++)
|
||||
}
|
||||
} else {
|
||||
for (var i = 0; i < fface_r.length; i++) {
|
||||
pushIfItemExists(facenew, fface_r[i] + cm.getPlayer().getFace() % 1000 - (cm.getPlayer().getFace() % 100));
|
||||
}
|
||||
}
|
||||
cm.sendYesNo("If you use the regular coupon, your face may transform into a random new look...do you still want to do it using #b#t5152008##k?");
|
||||
} else if (selection == 2) {
|
||||
beauty = 1;
|
||||
if (cm.getPlayer().getGender() == 0) {
|
||||
var current = cm.getPlayer().getFace()
|
||||
% 100 + 20000;
|
||||
% 100 + 20000;
|
||||
}
|
||||
if (cm.getPlayer().getGender() == 1) {
|
||||
var current = cm.getPlayer().getFace()
|
||||
% 100 + 21000;
|
||||
% 100 + 21000;
|
||||
}
|
||||
colors = Array();
|
||||
pushIfItemsExists(colors, [current , current + 100, current + 200, current + 300, current +400, current + 500, current + 700]);
|
||||
pushIfItemsExists(colors, [current, current + 100, current + 200, current + 300, current + 400, current + 500, current + 700]);
|
||||
cm.sendYesNo("If you use the regular coupon, you'll be awarded a random pair of cosmetic lenses. Are you going to use a #b#t5152046##k and really make the change to your eyes?");
|
||||
}
|
||||
}
|
||||
else if (status == 2){
|
||||
} else if (status == 2) {
|
||||
if (beauty == 0) {
|
||||
if (cm.haveItem(5152008)){
|
||||
if (cm.haveItem(5152008)) {
|
||||
cm.gainItem(5152008, -1);
|
||||
cm.setFace(facenew[Math.floor(Math.random() * facenew.length)]);
|
||||
cm.sendOk("Enjoy your new and improved face!");
|
||||
@@ -95,7 +97,7 @@ function action(mode, type, selection) {
|
||||
cm.sendOk("Hmm ... it looks like you don't have the coupon specifically for this place. Sorry to say this, but without the coupon, there's no plastic surgery for you...");
|
||||
}
|
||||
} else if (beauty == 1) {
|
||||
if (cm.haveItem(5152046)){
|
||||
if (cm.haveItem(5152046)) {
|
||||
cm.gainItem(5152046, -1);
|
||||
cm.setFace(colors[Math.floor(Math.random() * colors.length)]);
|
||||
cm.sendOk("Enjoy your new and improved cosmetic lenses!");
|
||||
@@ -103,7 +105,7 @@ function action(mode, type, selection) {
|
||||
cm.sendOk("Hmm ... it looks like you don't have the coupon specifically for this place. Sorry to say this, but without the coupon, there's no plastic surgery for you...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user