Skillbook announcer + isInJobTree fix

Abdula is now the Skillbook announcer NPC. Fixed some inconguencies with
the isInJobTree function, now properly returning if a skill id does make
presence on a player's current job path or not.
This commit is contained in:
ronancpl
2017-06-05 21:08:35 -03:00
parent 9d00f33783
commit 83d20e3c8b
31 changed files with 426 additions and 285 deletions

9
scripts/npc/9010001.js Normal file
View File

@@ -0,0 +1,9 @@
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
cm.sendNext("Hi, I'm #p9010001#.");
cm.dispose();
}

9
scripts/npc/9010002.js Normal file
View File

@@ -0,0 +1,9 @@
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
cm.sendNext("Hi, I'm #p9010002#.");
cm.dispose();
}

View File

@@ -1,70 +1,9 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var status = 0;
function start() {
cm.dispose();
/*var em = cm.getEventManager("lolcastle");
if (em == null || !em.getProperty("entryPossible").equals("true")) {
cm.sendOk("I am Ria.");
cm.dispose();
} else
cm.sendNext("I am Ria. For a small fee of #b1000000 meso#k I can send you to the #rField of Judgement#k.");
*/
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
cm.dispose();
/* if (mode == -1)
cm.dispose();
else {
if (mode == 0) {
cm.sendOk("All right, see you next time.");
cm.dispose();
return;
}
status++;
if (status == 1)
cm.sendYesNo("Do you wish to enter #rField of Judgement#k now?");
else if (status == 2) {
var em = cm.getEventManager("lolcastle");
if (cm.getMeso() < 1000000) {
cm.sendOk("You do not have enough mesos.");
cm.dispose();
} else if (cm.getPlayer().getLevel() < 21) {
cm.sendOk("You have to be at least level 21 to enter #rField of Judgement.#k");
cm.dispose();
} else if (cm.getPlayer().getLevel() >= 21 && cm.getPlayer().getLevel() < 31)
em.getInstance("lolcastle1").registerPlayer(cm.getPlayer());
else if (cm.getPlayer().getLevel() >= 31 && cm.getPlayer().getLevel() < 51)
em.getInstance("lolcastle2").registerPlayer(cm.getPlayer());
else if (cm.getPlayer().getLevel() >= 51 && cm.getPlayer().getLevel() < 71)
em.getInstance("lolcastle3").registerPlayer(cm.getPlayer());
else if (cm.getPlayer().getLevel() >= 71 && cm.getPlayer().getLevel() < 91)
em.getInstance("lolcastle4").registerPlayer(cm.getPlayer());
else
em.getInstance("lolcastle5").registerPlayer(cm.getPlayer());
cm.gainMeso(-1000000);
cm.dispose();
}
}*/
}
cm.sendNext("Hi, I'm #p9010003#.");
cm.dispose();
}

9
scripts/npc/9010004.js Normal file
View File

@@ -0,0 +1,9 @@
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
cm.sendNext("Hi, I'm #p9010004#.");
cm.dispose();
}

View File

@@ -1,88 +1,86 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* @author: Ronan
* @npc: Abdula
* @map: Multiple cities on Maplestory
* @func: Job Skill / Mastery Book Drop Announcer
*/
status = -1;
var sel;
var pickup = -1;
var status;
var selected = 0;
var skillbook = [], masterybook = [], table = [];
function start() {
cm.sendSimple("I'm Abdula, and I am a merchant intermediary who deals with rare goods. What do you have for me?#b\r\n#L0#I want to sell goods.\r\n#L1#I want to know about current market prices.\r\n#L2#A merchant intermediary? What is that?");
status = -1;
selected = 0;
action(1, 0, 0);
}
function action(mode, type, selection) {
status++;
if(mode != 1){
if(mode == 0 && status == 0){
cm.dispose();
return;
}else if(mode == 0 && sel == 0 && status == 2){
cm.sendNext("You don't want to sell it right now? You can sell it later, but remember the Special Items are only valuable for a week.");
cm.dispose();
return;
}else if(mode == 0 && sel == 2)
status -= 2;
}
if(status == 0){
if(sel == undefined)
sel = selection;
if (selection == 0){
var text = "Let's see what you brought...#b";
for(var i = 0; i < 5; i++)
text += "\r\n#L" + i + "##t" + (3994090 + i) + "#";
cm.sendSimple(text);
}else if (selection == 1){
var text = "";
for(var i = 0; i < 5; i++)
text += "The current market price for #t" + (i + 3994090) + "# is #rNOT DONE#k mesos\r\n";
cm.sendNext(text);
cm.dispose();
}else
cm.sendNext("I buy the products at the Maple 7th Day Market and sell them in other towns. I trade memorabilia, spices, taxidermy shark, and more... but no Lazy Daisy's eggs.");
}else if(status == 1){
if(sel == 0){
if(cm.haveItem(3994090 + selection)){
pickup = 3994090 + selection;
cm.sendYesNo("The current price is 180 mesos. Would you like to sell it now?"); //Make a price changer by hour.
}else{
cm.sendNext("You don't have anything. Stop wasting my time... I'm a busy person.");
cm.dispose();
}
}else
cm.sendNextPrev("Maple 7th Day Market Sundays are my days off. If you need to see me, you're going to have to come Monday to Friday...");
}else if(status == 2){
if(sel == 0)
cm.sendGetNumber("How many would you like to sell?", 0, 0, 200);
else{
cm.sendPrev("Oh, and the prices are subject to change. I can't get the short end of the stick, I have to stay in business! Check back with me frequently, my prices change by the hour!");
}
}else if(status == 3){
if(sel == 0)
if(selection != 1)
cm.sendNext("Something's not right. Check again.");
else{
cm.sendNext("The transaction has been completed. See you next time.");
cm.gainMeso(180);
cm.gainItem(pickup, -1);
}
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
var greeting = "Hello, I'm #p9209000#, the Skill & Mastery Book announcer! ";
skillbook = cm.getAvailableSkillBooks();
masterybook = cm.getAvailableMasteryBooks();
if(skillbook.length == 0 && masterybook.length == 0) {
cm.sendOk(greeting + "There are no more books available to further improve your job skills for now. Either you maxed out everything or you didn't reach the minimum requisites for some skill books yet.");
cm.dispose();
} else if(skillbook.length > 0 && masterybook.length > 0) {
var sendStr = greeting + "New opportunities for skill improvement have been located for you to improve your skills! Pick a type to take a look onto.\r\n\r\n#b";
sendStr += "#L1# Skill Book#l\r\n";
sendStr += "#L2# Mastery Book#l\r\n";
cm.sendSimple(sendStr);
} else if(skillbook.length > 0) {
selected = 1;
cm.sendNext(greeting + "New opportunities for skill improvement have been located for you to improve your skills! Only skill learns available for now.");
} else {
selected = 2;
cm.sendNext(greeting + "New opportunities for skill improvement have been located for you to improve your skills! Only skill upgrades available.");
}
} else if(status == 1) {
var sendStr = "The following books are currently available:\r\n\r\n";
if(selected == 0) selected = selection;
table = (selected == 1) ? skillbook : masterybook;
for(var i = 0; i < table.length; i++) {
sendStr += " #L" + i + "# #i" + table[i] + "# #t" + table[i] + "##l\r\n";
}
cm.sendSimple(sendStr);
} else if(status == 2) {
selected = selection;
var mobList = cm.getNamesWhoDropsItem(table[selected]);
var sendStr;
if(mobList.length == 0) {
sendStr = "No mobs drop '#b#t" + table[selected] + "##k'.";
} else {
sendStr = "The following mobs drop '#b#t" + table[selected] + "##k':\r\n\r\n";
for(var i = 0; i < mobList.length; i++) {
sendStr += " #L" + i + "# " + mobList[i] + "#l\r\n";
}
}
cm.sendOk(sendStr);
cm.dispose();
}
}
}
}

View File

@@ -0,0 +1,88 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
status = -1;
var sel;
var pickup = -1;
function start() {
cm.sendSimple("I'm Abdula, and I am a merchant intermediary who deals with rare goods. What do you have for me?#b\r\n#L0#I want to sell goods.\r\n#L1#I want to know about current market prices.\r\n#L2#A merchant intermediary? What is that?");
}
function action(mode, type, selection) {
status++;
if(mode != 1){
if(mode == 0 && status == 0){
cm.dispose();
return;
}else if(mode == 0 && sel == 0 && status == 2){
cm.sendNext("You don't want to sell it right now? You can sell it later, but remember the Special Items are only valuable for a week.");
cm.dispose();
return;
}else if(mode == 0 && sel == 2)
status -= 2;
}
if(status == 0){
if(sel == undefined)
sel = selection;
if (selection == 0){
var text = "Let's see what you brought...#b";
for(var i = 0; i < 5; i++)
text += "\r\n#L" + i + "##t" + (3994090 + i) + "#";
cm.sendSimple(text);
}else if (selection == 1){
var text = "";
for(var i = 0; i < 5; i++)
text += "The current market price for #t" + (i + 3994090) + "# is #rNOT DONE#k mesos\r\n";
cm.sendNext(text);
cm.dispose();
}else
cm.sendNext("I buy the products at the Maple 7th Day Market and sell them in other towns. I trade memorabilia, spices, taxidermy shark, and more... but no Lazy Daisy's eggs.");
}else if(status == 1){
if(sel == 0){
if(cm.haveItem(3994090 + selection)){
pickup = 3994090 + selection;
cm.sendYesNo("The current price is 180 mesos. Would you like to sell it now?"); //Make a price changer by hour.
}else{
cm.sendNext("You don't have anything. Stop wasting my time... I'm a busy person.");
cm.dispose();
}
}else
cm.sendNextPrev("Maple 7th Day Market Sundays are my days off. If you need to see me, you're going to have to come Monday to Friday...");
}else if(status == 2){
if(sel == 0)
cm.sendGetNumber("How many would you like to sell?", 0, 0, 200);
else{
cm.sendPrev("Oh, and the prices are subject to change. I can't get the short end of the stick, I have to stay in business! Check back with me frequently, my prices change by the hour!");
}
}else if(status == 3){
if(sel == 0)
if(selection != 1)
cm.sendNext("Something's not right. Check again.");
else{
cm.sendNext("The transaction has been completed. See you next time.");
cm.gainMeso(180);
cm.gainItem(pickup, -1);
}
cm.dispose();
}
}