Handle reborns(rebirths) - set/get from db, flag to enable/disable and 1 basic NPC to handle it (#413)

* Added ability to handle reborn, option to enable/disable in ServerConstant

* Basic rebirth NPC for wolf spirit Ryko chan - id 9010021

* Added player message when rebirth system is off

* Removed some forgotten comments

* Ryko now displays original message if rebirth is not enabled
This commit is contained in:
Jerry Wang
2019-02-24 07:54:22 +10:00
committed by Ronan Lana
parent 1772910a52
commit 02ede93298
4 changed files with 117 additions and 3 deletions

View File

@@ -22,8 +22,46 @@
/* 9010021 - Wolf Spirit Ryko
@author Ronan
*/
var status;
function start() {
cm.sendOk("... I came from distant planes to assist the fight against the #rBlack Magician#k. Right now I search my master, have you seen him?");
cm.dispose();
status = -1;
if (!Packages.constants.ServerConstants.USE_REBIRTH_SYSTEM) {
cm.sendOk("... I came from distant planes to assist the fight against the #rBlack Magician#k. Right now I search my master, have you seen him?");
cm.dispose();
return;
}
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
cm.dispose();
return;
}
if (status == 0) {
cm.sendNext("Come to me when you want to be reborn again. You currently have a total of #r" + cm.getChar().getReborns() + " #krebirths.");
} else if (status == 1) {
cm.sendSimple("What do you want me to do today: \r\n \r\n #L0##bI want to be rebirthed#l \r\n #L1##bMaybe next time#k#l");
} else if (status == 2) {
if (selection == 0) {
if (cm.getChar().getLevel() == 200) {
cm.sendYesNo("Are you sure you want to be rebirthed?");
} else {
cm.sendOk("You are not level 200, please come back when you hit level 200.");
cm.dispose();
}
} else if (selection == 1) {
cm.sendOk("Ok Bye")
cm.dispose();
}
} else if (status == 3 && type == 1) {
cm.getChar().executeReborn();
cm.sendOk("You have now been reborn. That's a total of #r" + cm.getChar().getReborns() + "#k rebirths");
cm.dispose();
}
}