Overall wedding implementation

Implementation of the wedding feature.
This commit is contained in:
ronancpl
2018-04-10 21:50:29 -03:00
parent 6da5edd837
commit ede8ad8551
59 changed files with 5281 additions and 1246 deletions

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
@@ -19,47 +17,129 @@
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/>.
*/
/**
*9201023 - Nana(K)
*@author Jvlaple
/* Nana, the Love fairy
Amoria (680000000)
Engagement ring NPC.
*/
function start() {
cm.sendOk("Hi, I'm Nana the love fairy... Hows it going?");
cm.dispose();
var status;
var state;
var item;
var mats;
var matQty;
var cost;
var options;
function hasProofOfLoves(player) {
var count = 0;
for(var i = 4031367; i <= 4031372; i++) {
if(player.haveItem(i)) {
count++;
}
}
return count >= 4;
}
//
//function action(mode, type, selection) {
// if (mode == -1) {
// cm.dispose();
// } else {
// if (mode == 0 && status == 0) {
// cm.dispose();
// return;
// }
// if (mode == 1)
// status++;
// else
// status--;
// if (cm.getPlayer().getMarriageQuestLevel() == 1 || cm.getPlayer().getMarriageQuestLevel() == 52) {
// if (!cm.haveItem(4000083, 20)) {
// if (status == 0) {
// cm.sendNext("Hey, you look like you need proofs of love? I can get them for you.");
// } else if (status == 1) {
// cm.sendNext("All you have to do is bring me 20 #bJr. Sentinel Pieces.#k.");
// cm.dispose();
// }
// } else {
// if (status == 0) {
// cm.sendNext("Wow, you were quick! Heres the proof of love...");
// cm.gainItem(4000083, -20)
// cm.gainItem(4031369, 1);
// cm.dispose();
// }
// }
// } else {
// cm.sendOk("Hi, I'm Nana the love fairy... Hows it going?");
// cm.dispose();
// }
// }
//}
function getNanaLocation(player) {
var mapid = player.getMap().getId();
for(var i = 0; i < mapids.length; i++) {
if(mapid == mapids[i]) {
return i;
}
}
return -1;
}
var nanaLoc;
var mapids = [100000000, 103000000, 102000000, 101000000, 200000000, 220000000];
var questItems = [4000001, 4000037, 4000215, 4000026, 4000070, 4000128];
var questExp = [2000, 5000, 10000, 17000, 22000, 30000];
function processNanaQuest() {
if(cm.haveItem(questItems[nanaLoc], 50)) {
if(cm.canHold(4031367 + nanaLoc, 1)) {
cm.gainItem(questItems[nanaLoc], -50);
cm.gainItem(4031367 + nanaLoc, 1);
cm.sendOk("Kyaaaa~ Thank you a lot, here get the #b#t4031367##k.");
return true;
} else {
cm.sendOk("Please have a free ETC slot available to hold the token of love.");
}
} else {
cm.sendOk("Please gather to me #b50 #t" + questItems[nanaLoc] + "##k.");
}
return false;
}
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) {
if(!cm.isQuestStarted(100400)) {
cm.sendOk("Hello #b#h0##k, I'm #p9201001# the fairy of Love.");
cm.dispose();
return;
}
nanaLoc = getNanaLocation(cm.getPlayer());
if(nanaLoc == -1) {
cm.sendOk("Hello #b#h0##k, I'm #p9201001# the fairy of Love.");
cm.dispose();
return;
}
if(!cm.haveItem(4031367 + nanaLoc, 1)) {
if(cm.isQuestCompleted(100401 + nanaLoc)) {
state = 1;
cm.sendAcceptDecline("Did you lost the #k#t4031367##k I gave to you? Well, I can share another one with you, but you will need to redo the favor I asked last time, is that ok? I need you to bring me #r50 #t" + questItems[nanaLoc] + "#'s.#k");
} else if(cm.isQuestStarted(100401 + nanaLoc)) {
if(processNanaQuest()) {
cm.gainExp(questExp[nanaLoc] * cm.getPlayer().getExpRate());
cm.completeQuest(100401 + nanaLoc);
}
cm.dispose();
} else {
state = 0;
cm.sendAcceptDecline("Are you searching for #k#t4031367#'s#k? I can share one with you, but you must do a favor for me, is that ok?");
}
} else {
cm.sendOk("Hey there. Did you get the #t4031367# from the other Nana's already?");
cm.dispose();
}
} else if(status == 1) {
if(state == 0) {
cm.startQuest(100401 + nanaLoc);
cm.sendOk("I need you to collect #r50 #t" + questItems[nanaLoc] + "##k.");
cm.dispose();
} else {
processNanaQuest();
cm.dispose();
}
}
}
}