Reformat and clean up npc scripts
This commit is contained in:
@@ -36,12 +36,12 @@ function start() {
|
||||
const GameConstants = Java.type('constants.game.GameConstants');
|
||||
if (jobType >= minJobType && jobType <= maxJobType && cm.canSpawnPlayerNpc(GameConstants.getHallOfFameMapid(cm.getJob()))) {
|
||||
spawnPnpc = true;
|
||||
|
||||
|
||||
var sendStr = "You have walked a long way to reach the power, wisdom and courage you hold today, haven't you? What do you say about having right now #ra NPC on the Hall of Fame holding the current image of your character#k? Do you like it?";
|
||||
if(spawnPnpcFee > 0) {
|
||||
if (spawnPnpcFee > 0) {
|
||||
sendStr += " I can do it for you, for the fee of #b " + cm.numberWithCommas(spawnPnpcFee) + " mesos.#k";
|
||||
}
|
||||
|
||||
|
||||
cm.sendYesNo(sendStr);
|
||||
} else {
|
||||
cm.sendOk("Welcome to the Knights Chamber.");
|
||||
@@ -51,15 +51,16 @@ function start() {
|
||||
|
||||
function action(mode, type, selection) {
|
||||
status++;
|
||||
if (mode == 0 && type != 1)
|
||||
if (mode == 0 && type != 1) {
|
||||
status -= 2;
|
||||
if (status == -1){
|
||||
}
|
||||
if (status == -1) {
|
||||
start();
|
||||
return;
|
||||
|
||||
} else {
|
||||
if(spawnPnpc) {
|
||||
if(mode > 0) {
|
||||
if(cm.getMeso() < spawnPnpcFee) {
|
||||
if (spawnPnpc) {
|
||||
if (mode > 0) {
|
||||
if (cm.getMeso() < spawnPnpcFee) {
|
||||
cm.sendOk("Sorry, you don't have enough mesos to purchase your place on the Hall of Fame.");
|
||||
cm.dispose();
|
||||
return;
|
||||
@@ -67,16 +68,16 @@ function action(mode, type, selection) {
|
||||
|
||||
const PlayerNPC = Java.type('server.life.PlayerNPC');
|
||||
const GameConstants = Java.type('constants.game.GameConstants');
|
||||
if(PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) {
|
||||
if (PlayerNPC.spawnPlayerNPC(GameConstants.getHallOfFameMapid(cm.getJob()), cm.getPlayer())) {
|
||||
cm.sendOk("There you go! Hope you will like it.");
|
||||
cm.gainMeso(-spawnPnpcFee);
|
||||
} else {
|
||||
cm.sendOk("Sorry, the Hall of Fame is currently full...");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cm.dispose();
|
||||
return;
|
||||
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user