The great MCPQ Merge offensive

Fulfilled the lovely pull request #427 from @dragoso, which added in backing code content to HeavenMS.
Implemented structural changes for the Marriage wishlist, in order to receive, maintain and distribute gifts to spouses.
Added untradeable check on wishlist gift handler.
Adjusted CPQ drops to actually load from DB rathe than hard-coded.
Fixed CPQ "random disease to player/party" functionality not applying properly.
Adjusted how CPQ maps are generated. It directly loads a new area from WZ (this process should at least removes the player's spawned mobs) rather than reset the cache at every MCPQ creation.
This commit is contained in:
ronancpl
2019-03-15 12:08:21 -03:00
parent 1383efd6c3
commit 3bdf8cb2be
52 changed files with 2258 additions and 678 deletions

View File

@@ -27,12 +27,22 @@
1.0 - First Version by Angel
2.0 - Second Version by happydud3 & XotiCraze
3.0 - Third Version by RonanLana (HeavenMS)
4.0 - Four Version bby Drago(MapleStorySA)
4.0 - Four Version bby Drago (MapleStorySA)
---------------------------------------------------------------------------------------------------
**/
var status = -1;
var marriageRoom;
var marriageAction = 0;
var marriageGifts;
function start() {
marriageRoom = cm.getPlayer().getMarriageInstance() != null;
if (!marriageRoom) {
marriageGifts = cm.getUnclaimedMarriageGifts();
marriageAction = (!marriageGifts.isEmpty() ? 2 : ((cm.haveItem(4031423) || cm.haveItem(4031424)) ? 1 : 0));
}
status = -1;
action(1, 0, 0);
}
@@ -44,8 +54,84 @@ function action(mode, type, selection) {
cm.dispose();
return;
}
if (status == 0) {
cm.enviarLista();
cm.dispose();
if (marriageRoom) {
if (status == 0) {
var talk = "Hi there, welcome to the wedding's Gift Registry. From which spouse's wishlist would you like to take a look?";
var options = ["Groom", "Bride"];
cm.sendSimple(talk + "\r\n\r\n#b" + generateSelectionMenu(options) + "#k");
} else {
cm.sendMarriageWishlist(selection == 0);
cm.dispose();
}
} else {
if (marriageAction == 2) { // unclaimed gifts
if (status == 0) {
var talk = "Hi there, it seems you have unclaimed gifts from your wedding. Claim them here on the wedding's Gift Registry reserve.";
cm.sendNext(talk);
} else {
cm.sendMarriageGifts(marriageGifts);
cm.dispose();
}
} else if (marriageAction == 1) { // onyx prizes
if (status == 0) {
var msg = "Hello I exchange Onyx Chest for Bride and Groom and the Onyx Chest for prizes!#b";
var choice1 = new Array("I have an Onyx Chest for Bride and Groom", "I have an Onyx Chest");
for (var i = 0; i < choice1.length; i++) {
msg += "\r\n#L" + i + "#" + choice1[i] + "#l";
}
cm.sendSimple(msg);
} else if (status == 1) {
if (selection == 0) {
if (cm.haveItem(4031424)) {
if (cm.getPlayer().isMarried()) { // thanks MedicOP for solving an issue here
if(cm.getInventory(2).getNextFreeSlot() >= 0) {
var rand = Math.floor(Math.random() * bgPrizes.length);
cm.gainItem(bgPrizes[rand][0], bgPrizes[rand][1]);
cm.gainItem(4031424,-1);
cm.dispose();
} else {
cm.sendOk("You don't have a free USE slot right now.");
cm.dispose();
}
} else {
cm.sendOk("You must be married to claim the prize for this box.");
cm.dispose();
}
} else {
cm.sendOk("You don't have an Onyx Chest for Bride and Groom.");
cm.dispose();
}
} else if (selection == 1) {
if (cm.haveItem(4031423)) {
if(cm.getInventory(2).getNextFreeSlot() >= 0) {
var rand = Math.floor(Math.random() * cmPrizes.length);
cm.gainItem(cmPrizes[rand][0], cmPrizes[rand][1]);
cm.gainItem(4031423,-1);
cm.dispose();
} else {
cm.sendOk("You don't have a free USE slot right now.");
cm.dispose();
}
} else {
cm.sendOk("You don't have an Onyx Chest.");
cm.dispose();
}
}
}
} else {
cm.sendOk("Hi there, welcome to Amoria's Wedding Gift Registry reserve. We redistribute and tender gifts for both wedding spouses and lucky ceremonial attenders.");
cm.dispose();
}
}
}
function generateSelectionMenu(array) {
var menu = "";
for (var i = 0; i < array.length; i++) {
menu += "#L" + i + "#" + array[i] + "#l\r\n";
}
return menu;
}