Improved item & drop-point checking + Dojo fixes + Duey revamp

Fixed some issues with items being dropped sometimes out-of-reach and in a weird way.
Improved item checking function, now looking up one-of-a-kind items properly.
Fixed some issues with dojo skills and possible exploits in dojo progression.
Improved Duey, now displaying better info to players.
This commit is contained in:
ronancpl
2018-01-03 18:45:56 -02:00
parent 012f965f6a
commit 1190513d0c
69 changed files with 781 additions and 423 deletions

View File

@@ -22,7 +22,7 @@ function action(mode, type, selection) {
} else if (status == 2) {
if (!cm.canHold(itemids[selection], 1)) {
cm.sendOk("Please make room");
} else if (cm.getItemQuantity(4001261) < 1) {
} else if (!cm.haveItemWithId(4001261)) {
cm.sendOk("You don't have enough leathers.");
} else {
cm.gainItem(4001261, -1);

View File

@@ -6,7 +6,7 @@ function start() {
}
function action(mode, type, selection) {
if(cm.getPlayer().getItemQuantity(1902016, true) > 0) {
if(cm.haveItemWithId(1902016, true)) {
cm.warp(140010210, 0);
} else {
cm.sendOk("What is it? If you you're here to waste my time, get lost!");

View File

@@ -1,8 +1,8 @@
var status = -1;
var sel;
var destinations = new Array("Ellinia", "Ludibrium", "Leafre", "Mu Lung", "Ariant");
var boatType = new Array("the ship", "the ship", "Hak", "Hak", "Genie");
var destinations = new Array("Ellinia", "Ludibrium", "Leafre", "Mu Lung", "Ariant", "Ereve");
var boatType = new Array("the ship", "the train", "the bird", "Hak", "Genie", "the ship");
function start() {
var message = "Orbis Station has lots of platforms available to choose from. You need to choose the one that'll take you to the destination of your choice. Which platform will you take?\r\n";
@@ -20,8 +20,8 @@ function action(mode, type, selection) {
status++;
if (status == 0){
sel = selection;
cm.sendNext("Ok #h #, I will send you to the platform for #m" + (200000110 + (sel * 10)) + "#");
}else if (status == 1) {
cm.sendNext("Ok #h #, I will send you to the platform for #b#m" + (200000110 + (sel * 10)) + "##k.");
}else if (status == 1) {
cm.warp(200000110 + (sel * 10), "west00");
cm.dispose();
}

View File

@@ -1,8 +1,6 @@
/*
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 file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
Copyleft (L) 2017 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@@ -30,6 +28,7 @@ importPackage(Packages.server.maps);
var disabled = false;
var belts = Array(1132000, 1132001, 1132002, 1132003, 1132004);
var belt_level = Array(25, 35, 45, 60, 75);
var belt_on_inventory;
/* var belt_points = Array(200, 1800, 4000, 9200, 17000); */
var belt_points = Array(10, 90, 200, 460, 850); /* Watered down version */
@@ -45,6 +44,11 @@ function start() {
return;
}
belt_on_inventory = new Array();
for (var i = 0; i < belts.length; i++) {
belt_on_inventory.push(cm.haveItemWithId(belts[i], true));
}
action(1, 0, 0);
}
@@ -112,42 +116,24 @@ function action(mode, type, selection) {
}
}
} else if (cm.getPlayer().getDojoStage() > 0) {
if (status == 1) {
dojoWarp = cm.getPlayer().getDojoStage();
cm.getPlayer().setDojoStage(0);
cm.sendYesNo("The last time you took the challenge by yourself, you went up to level " + dojoWarp + ". I can take you there right now. Do you want to go there?");
} else {
var avDojo = cm.getClient().getChannelServer().getAvailableDojo(false);
if(avDojo < 0) {
if(avDojo == -1) cm.sendOk("All Dojo's are being used already. Wait for awhile before trying again.");
else cm.sendOk("Either your party is already using the Dojo or your party's allotted time on the Dojo has not expired yet. Wait for them to finish to enter.");
cm.getPlayer().setDojoStage(dojoWarp);
}
else {
var warpDojoMap = ((mode == 1) ? 925020000 + (dojoWarp + 1) * 100 + avDojo : 925020100 + avDojo);
cm.getClient().getChannelServer().resetDojoMap(warpDojoMap);
cm.getClient().getChannelServer().resetDojo(warpDojoMap);
cm.resetDojoEnergy();
cm.warp(warpDojoMap, 0);
}
cm.dispose();
}
dojoWarp = cm.getPlayer().getDojoStage();
cm.getPlayer().setDojoStage(0);
cm.sendYesNo("The last time you took the challenge by yourself, you went up to level #b" + dojoWarp + "#k. I can take you there right now. Do you want to go there? (Select #rNo#k to erase this record.)");
} else {
var avDojo = cm.getClient().getChannelServer().getAvailableDojo(false);
if(avDojo < 0) {
if(avDojo == -1) cm.sendOk("All Dojo's are being used already. Wait for awhile before trying again.");
else cm.sendOk("Either your party is already using the Dojo or your party's allotted time on the Dojo has not expired yet. Wait for them to finish to enter.");
}
else {
cm.getClient().getChannelServer().resetDojoMap(925020100 + avDojo);
cm.getClient().getChannelServer().resetDojo(925020100 + avDojo);
cm.getPlayer().setDojoStage(dojoWarp);
} else {
var warpDojoMap = 925020000 + (dojoWarp + 1) * 100 + avDojo;
cm.getClient().getChannelServer().resetDojoMap(warpDojoMap);
cm.getClient().getChannelServer().resetDojo(warpDojoMap);
cm.resetDojoEnergy();
cm.warp(925020100 + avDojo, 0);
cm.warp(warpDojoMap, 0);
}
cm.dispose();
@@ -181,8 +167,7 @@ function action(mode, type, selection) {
if(avDojo < 0) {
if(avDojo == -1) cm.sendOk("All Dojo's are being used already. Wait for awhile before trying again.");
else cm.sendOk("Either your party is already using the Dojo or your party's allotted time on the Dojo has not expired yet. Wait for them to finish to enter.");
}
else {
} else {
cm.getClient().getChannelServer().resetDojoMap(925030100 + avDojo);
cm.getClient().getChannelServer().resetDojo(925030100 + avDojo);
@@ -207,7 +192,7 @@ function action(mode, type, selection) {
if (status == 1) {
var selStr = "You have #b" + cm.getPlayer().getDojoPoints() + "#k training points. Master prefers those with great talent. If you obtain more points than the average, you can receive a belt depending on your score.\r\n";
for (var i = 0; i < belts.length; i++) {
if (cm.getPlayer().getItemQuantity(belts[i], true) > 0) {
if (belt_on_inventory[i]) {
selStr += "\r\n#L" + i + "##i" + belts[i] + "# #t" + belts[i] + "# (Already on inventory)";
} else
selStr += "\r\n#L" + i + "##i" + belts[i] + "# #t" + belts[i] + "#";
@@ -217,16 +202,24 @@ function action(mode, type, selection) {
var belt = belts[selection];
var level = belt_level[selection];
var points = belt_points[selection];
if (cm.getPlayer().getDojoPoints() >= points) {
if (cm.getPlayer().getLevel() > level) {
var oldbelt = (selection > 0) ? belts[selection - 1] : -1;
var haveOldbelt = (oldbelt == -1 || cm.haveItemWithId(oldbelt, false));
if (selection > 0 && !belt_on_inventory[selection - 1]) {
sendBeltRequirements(belt, oldbelt, haveOldbelt, level, points);
} else if (cm.getPlayer().getDojoPoints() >= points) {
if (selection > 0 && !haveOldbelt) {
sendBeltRequirements(belt, oldbelt, haveOldbelt, level, points);
} else if (cm.getPlayer().getLevel() > level) {
if(selection > 0) cm.gainItem(oldbelt, -1);
cm.gainItem(belt, 1);
cm.getPlayer().setDojoPoints(cm.getPlayer().getDojoPoints() - points);
cm.sendNext("There is the #i" + belt + "# #b#t" + belt + "##k. You have proven your valor to ascend on the Dojo ranks. Well done!");
}
else
cm.sendNext("In order to receive #i" + belt + "# #b#t" + belt + "##k, you have to be at least over level #b" + level + "#k and you need to have earned at least #b" + points + " training points#k.\r\n\r\nIf you want to obtain this belt, you need #r" + (points - cm.getPlayer().getDojoPoints()) + "#k more training points.");
} else
sendBeltRequirements(belt, oldbelt, haveOldbelt, level, points);
} else
cm.sendNext("In order to receive #i" + belt + "# #b#t" + belt + "##k, you have to be at least over level #b" + level + "#k and you need to have earned at least #b" + points + " training points#k.\r\n\r\nIf you want to obtain this belt, you need #r" + (points - cm.getPlayer().getDojoPoints()) + "#k more training points.");
sendBeltRequirements(belt, oldbelt, haveOldbelt, level, points);
cm.dispose();
return;
@@ -267,8 +260,7 @@ function action(mode, type, selection) {
cm.dispose();
return;
}
else {
} else {
cm.dispose();
return;
}
@@ -312,8 +304,7 @@ function action(mode, type, selection) {
if(avDojo < 0) {
if(avDojo == -1) cm.sendOk("All Dojo's are being used already. Wait for awhile before trying again.");
else cm.sendOk("Your party already registered for the dojo. Wait for the end of the registration time to enter again.");
}
else {
} else {
var baseStg = hasParty ? 925030000 : 925020000;
var nextStg = Math.floor((cm.getPlayer().getMap().getId() + 100) / 100) % 100;
@@ -323,6 +314,9 @@ function action(mode, type, selection) {
cm.getClient().getChannelServer().resetDojo(dojoWarpMap, nextStg - 1);
}
//non-leader party members can progress whilst having the record saved if they don't command to enter the next stage
cm.getPlayer().setDojoStage(0);
if(!hasParty || !cm.isLeader()) cm.warp(dojoWarpMap, 0);
else cm.warpParty(dojoWarpMap, 0);
}
@@ -348,7 +342,7 @@ function action(mode, type, selection) {
} else if (cm.getPlayer().getDojoStage() == Math.floor(cm.getMapId() / 100) % 100) {
cm.sendOk("Looks like you came all the way up here without recording your score. Sorry, but you can't record now.");
} else {
cm.sendNext("I recorded your score. If you tell me the next time you go up, you'll be able to start where you left off.");
cm.sendNext("I recorded your score. If you tell me the next time you go up, you'll be able to start where you left off. Note that you will have your #rrecord erased#k if you choose to #bcontinue challenging the Dojo#k, so choose carefully.");
cm.getPlayer().setDojoStage(Math.floor(cm.getMapId() / 100) % 100);
}
cm.dispose();
@@ -372,6 +366,16 @@ function action(mode, type, selection) {
}
}
function sendBeltRequirements(belt, oldbelt, haveOldbelt, level, points) {
var beltReqStr = (oldbelt != -1) ? " you must have the #i" + oldbelt + "# belt in your inventory," : "";
var pointsLeftStr = (points - cm.getPlayer().getDojoPoints() > 0) ? " you need #r" + (points - cm.getPlayer().getDojoPoints()) + "#k more training points" : "";
var beltLeftStr = (!haveOldbelt) ? " you must have the needed belt unequipped and available in your EQP inventory" : "";
var conjStr = (pointsLeftStr.length > 0 && beltLeftStr.length > 0) ? " and" : "";
cm.sendNext("In order to receive #i" + belt + "# #b#t" + belt + "##k," + beltReqStr + " you have to be at least over level #b" + level + "#k and you need to have earned at least #b" + points + " training points#k.\r\n\r\nIf you want to obtain this belt," + beltLeftStr + conjStr + pointsLeftStr + ".");
}
function isRestingSpot(id) {
return (Math.floor(id / 100) % 100) % 6 == 0 && id != 925020001;
}

View File

@@ -154,7 +154,7 @@ function action(mode, type, selection) {
if (status == 0) {
var selStr = "You have #b" + cm.getPlayer().getDojoPoints() + "#k training points. Master prefers those with great talent. If you obtain more points than the average, you can receive a belt depending on your score.\r\n";
for (var i = 0; i < belts.length; i++) {
if (cm.getPlayer().getItemQuantity(belts[i], true) > 0) {
if (cm.haveItemWithId(belts[i], true)) {
selStr += "\r\n #i" + belts[i] + "# #t" + belts[i] + "#(Obtain)";
} else
selStr += "\r\n#L" + i + "##i" + belts[i] + "# #t" + belts[i] + "#l";

View File

@@ -4,7 +4,7 @@
*/
function start() {
cm.askAcceptDecline("If only I had the Mirror of Goodness then I can re-summon the Black Wizard! \r\nWait! something's not right! Why is the Black Wizard not summoned? Wait, what's this force? I feel something... totally different from the Black Wizard Ahhhhh!!!!! \r\n\r\n #b(Places a hand on the shoulder of Kryston.)");
cm.sendAcceptDecline("If only I had the Mirror of Goodness then I can re-summon the Black Wizard! \r\nWait! something's not right! Why is the Black Wizard not summoned? Wait, what's this force? I feel something... totally different from the Black Wizard Ahhhhh!!!!! \r\n\r\n #b(Places a hand on the shoulder of Kryston.)");
}
function action(mode, type, selection) {

46
scripts/npc/9201106.js Normal file
View File

@@ -0,0 +1,46 @@
/*
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
Copyleft (L) 2017 RonanLana
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;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if(status == 0) {
cm.sendOk("I came from far-away places looking for people powerful enough to join my expedition against the evil that lays waste on this land. Are you, by any chance, one of those people?");
cm.dispose();
}
}
}