Reformat and clean up npc scripts
This commit is contained in:
@@ -26,18 +26,18 @@
|
||||
*
|
||||
* Start of Zakum Bossfight
|
||||
*/
|
||||
|
||||
|
||||
var status;
|
||||
var minLevel = 50;
|
||||
var state;
|
||||
var maxPlayers = 30;
|
||||
|
||||
|
||||
|
||||
|
||||
function start() {
|
||||
status = -1;
|
||||
action(1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
function action(mode, type, selection) {
|
||||
if (mode == -1) {
|
||||
cm.dispose();
|
||||
@@ -46,10 +46,11 @@ function action(mode, type, selection) {
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
if (mode == 1)
|
||||
if (mode == 1) {
|
||||
status++;
|
||||
else
|
||||
} else {
|
||||
status--;
|
||||
}
|
||||
if (status == 0) {
|
||||
if ((cm.getPlayer().getLevel() < minLevel)) {
|
||||
cm.warp(211042300);
|
||||
@@ -58,26 +59,24 @@ function action(mode, type, selection) {
|
||||
return;
|
||||
}
|
||||
cm.sendSimple("The battle to defeat Zakum begins here. What would you like to do? #b\r\n#L0#Start a new Zakum Battle#l\r\n#L1#Join your group's Zakum Battle#l");
|
||||
}
|
||||
else if (status == 1) {
|
||||
} else if (status == 1) {
|
||||
state = selection;
|
||||
if (selection == 0)
|
||||
if (selection == 0) {
|
||||
cm.sendGetText("In order to start the Zakum Battle, you need to choose a name for your instance. This is the password that lets your members join, so tell it to everybody who wants to participate in the battle.");
|
||||
|
||||
else if (selection == 1)
|
||||
} else if (selection == 1) {
|
||||
cm.sendGetText("In order to join a Zakum Battle, you need to enter the password. If you don't know what it is, please ask the person leading the battle.");
|
||||
|
||||
}
|
||||
else if (status == 2) {
|
||||
}
|
||||
|
||||
} else if (status == 2) {
|
||||
var em = cm.getEventManager("ZakumBattle");
|
||||
var passwd = cm.getText();
|
||||
if (em == null)
|
||||
if (em == null) {
|
||||
cm.sendOk("This trial is currently under construction.");
|
||||
else {
|
||||
} else {
|
||||
if (state == 0) { // Leader
|
||||
if (getEimForString(em,passwd) != null)
|
||||
if (getEimForString(em, passwd) != null) {
|
||||
cm.sendOk("You may not use that password.");
|
||||
else { // start Zakum Battle
|
||||
} else { // start Zakum Battle
|
||||
//var em = cm.getEventManager("Zakum" + passwd);
|
||||
if (!em.startInstance(cm.getPlayer())) {
|
||||
cm.sendOk("A party is already registered in this instance.");
|
||||
@@ -88,18 +87,19 @@ function action(mode, type, selection) {
|
||||
}
|
||||
}
|
||||
if (state == 1) { // Member
|
||||
var eim = getEimForString(em,passwd);
|
||||
if (eim == null)
|
||||
var eim = getEimForString(em, passwd);
|
||||
if (eim == null) {
|
||||
cm.sendOk("There is currently no battle registered under that name.");
|
||||
else {
|
||||
} else {
|
||||
if (eim.getProperty("canEnter").toLowerCase() == "true") {
|
||||
if (eim.getPlayers().size() < maxPlayers)
|
||||
if (eim.getPlayers().size() < maxPlayers) {
|
||||
eim.registerPlayer(cm.getPlayer());
|
||||
else
|
||||
} else {
|
||||
cm.sendOk("I'm sorry, but that battle is currently full. Please wait to join another one.");
|
||||
}
|
||||
else
|
||||
}
|
||||
} else {
|
||||
cm.sendOk("I'm sorry, but that battle is currently in progress. Please return later.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@ function action(mode, type, selection) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getEimForString(em, name) {
|
||||
var stringId = "Zakum" + name;
|
||||
return em.getInstance(stringId);
|
||||
|
||||
Reference in New Issue
Block a user