Merge pull request #99 from cpurules/feature/rebirth-paths
Update rebirth NPC to allow path selection
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
@author wejrox
|
@author wejrox
|
||||||
*/
|
*/
|
||||||
var status;
|
var status;
|
||||||
|
var jobId = 0;
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
status = -1;
|
status = -1;
|
||||||
@@ -49,18 +50,29 @@ function action(mode, type, selection) {
|
|||||||
cm.sendSimple("What do you want me to do today: \r\n \r\n #L0##bI want to be reborn!#l \r\n #L1##bNothing for now...#k#l");
|
cm.sendSimple("What do you want me to do today: \r\n \r\n #L0##bI want to be reborn!#l \r\n #L1##bNothing for now...#k#l");
|
||||||
} else if (status === 2) {
|
} else if (status === 2) {
|
||||||
if (selection === 0) {
|
if (selection === 0) {
|
||||||
if (cm.getChar().getLevel() === 200) {
|
if (cm.getChar().getLevel() === cm.getChar().getMaxClassLevel()) {
|
||||||
cm.sendYesNo("Are you sure you want to be reborn?");
|
cm.sendSimple("I see... and which path would you like to take? \r\n\r\n #L0##bExplorer (Beginner)#l \r\n #L1##bCygnus Knight (Noblesse)#l \r\n #L2##bAran (Legend)#l");
|
||||||
} else {
|
} else {
|
||||||
cm.sendOk("You are not level 200, please come back when you hit level 200.");
|
cm.sendOk("It looks like your journey has not yet ended... come back when you're level " + cm.getChar().getMaxClassLevel());
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
} else if (selection === 1) {
|
} else if (selection === 1) {
|
||||||
cm.sendOk("See you soon!")
|
cm.sendOk("See you soon!")
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
} else if (status === 3 && type === 1) {
|
} else if (status === 3) {
|
||||||
cm.getChar().executeReborn();
|
// 0 => beginner, 1000 => noblesse, 2000 => legend
|
||||||
|
// makes this very easy :-)
|
||||||
|
jobId = selection * 1000;
|
||||||
|
|
||||||
|
var job = "";
|
||||||
|
if (selection === 0) job = "Beginner";
|
||||||
|
else if (selection === 1) job = "Noblesse";
|
||||||
|
else if (selection === 2) job = "Legend";
|
||||||
|
cm.sendYesNo("Are you sure you want to be reborn as a " + job + "?");
|
||||||
|
}
|
||||||
|
else if (status === 4 && type === 1) {
|
||||||
|
cm.getChar().executeRebornAsId(jobId);
|
||||||
cm.sendOk("You have now been reborn. That's a total of #r" + cm.getChar().getReborns() + "#k rebirths");
|
cm.sendOk("You have now been reborn. That's a total of #r" + cm.getChar().getReborns() + "#k rebirths");
|
||||||
cm.dispose();
|
cm.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11137,15 +11137,25 @@ public class Character extends AbstractCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void executeReborn() {
|
public void executeReborn() {
|
||||||
|
// default to beginner: job id = 0
|
||||||
|
// this prevents a breaking change
|
||||||
|
executeRebornAs(Job.BEGINNER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void executeRebornAsId(int jobId) {
|
||||||
|
executeRebornAs(Job.getById(jobId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void executeRebornAs(Job job) {
|
||||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||||
yellowMessage("Rebirth system is not enabled!");
|
yellowMessage("Rebirth system is not enabled!");
|
||||||
throw new NotEnabledException();
|
throw new NotEnabledException();
|
||||||
}
|
}
|
||||||
if (getLevel() != 200) {
|
if (getLevel() != getMaxClassLevel()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addReborns();
|
addReborns();
|
||||||
changeJob(Job.BEGINNER);
|
changeJob(job);
|
||||||
setLevel(0);
|
setLevel(0);
|
||||||
levelUp(true);
|
levelUp(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user