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

@@ -37,7 +37,7 @@ function start() {
function action(mode, type, selection) {
if (mode == -1 || mode == 0) {
cm.sendOk("Goodbye then");
cm.sendOk("Goodbye then.");
cm.dispose();
return;
} else if (mode == 1) {
@@ -45,28 +45,53 @@ function action(mode, type, selection) {
} else {
status--;
}
var eim = cm.getEventInstance();
if(eim == null) {
cm.warp(680000000,0);
cm.dispose();
return;
}
var isMarrying = (cm.getPlayer().getId() == eim.getIntProperty("groomId") || cm.getPlayer().getId() == eim.getIntProperty("brideId"));
switch (status) {
case 0:
cm.sendNext("I only warp out people who are here by accident.");
break;
case 1:
var engagementRings = new Array(4031360, 4031358, 4031362, 4031364);
var hasEngagement = false;
for (var x = 0; x < engagementRings.length && !hasEngagement; x++) {
if (cm.haveItem(engagementRings[x], 1))
for (var x = 4031357; x <= 4031364; x++) {
if (cm.haveItem(x, 1)) {
hasEngagement = true;
break;
}
}
if (cm.haveItem(4000313) && hasEngagement) {
cm.sendOk("Please continue with the wedding.");
cm.dispose();
if (cm.haveItem(4000313) && isMarrying) {
if(eim.getIntProperty("weddingStage") == 3) {
cm.sendOk("Congratulations on your wedding. Please talk to #b#p9201007##k to start the afterparty.");
cm.dispose();
} else if(hasEngagement) {
cm.sendOk("Please continue with the wedding.");
cm.dispose();
} else {
cm.sendOk("You do not have the required item to continue through this wedding. Unfortunately, it's over...");
}
} else {
cm.warp(680000000,0);
cm.dispose();
if(eim.getIntProperty("weddingStage") == 3) {
if(!isMarrying) {
cm.sendYesNo("The couple #rhas just married#k, and soon #bthey will start the afterparty#k. You should wait here for them. Are you really ready to #rquit this wedding#k and return to #bAmoria#k?");
} else {
cm.sendOk("Congratulations on your wedding. Please talk to #b#p9201007##k to start the afterparty.");
cm.dispose();
}
} else {
cm.sendYesNo("Are you sure you want to #rquit this wedding#k and return to #bAmoria#k?");
}
}
break;
case 2:
cm.sendOk("You do not have the required item to continue through this wedding.");
case 1:
cm.warp(680000000,0);
cm.dispose();
break;
}
}