Guild PQ + fixed negative EXP error
Implemented Guild PQ. Fixed a problem introduced earlier where negative EXP would be deemed as "integer overflow", provoking many game breaking issues as result.
This commit is contained in:
@@ -22,6 +22,13 @@
|
||||
var status;
|
||||
var stage;
|
||||
|
||||
function clearStage(stage, eim) {
|
||||
eim.setProperty("stage" + stage + "clear", "true");
|
||||
eim.showClearEffect(true);
|
||||
|
||||
eim.giveEventPlayersStageReward(stage);
|
||||
}
|
||||
|
||||
function start() {
|
||||
status = -1;
|
||||
action (1, 0, 0);
|
||||
@@ -39,79 +46,77 @@ function action(mode, type, selection) {
|
||||
status++;
|
||||
else
|
||||
status--;
|
||||
|
||||
var eim = cm.getPlayer().getEventInstance();
|
||||
if (eim == null) {
|
||||
cm.warp(990001100);
|
||||
} else {
|
||||
if (eim.getProperty("leader").equals(cm.getPlayer().getName())) {
|
||||
if (cm.getPlayer().getMap().getReactorByName("statuegate").getState() > 0){
|
||||
cm.sendOk("Proceed.");
|
||||
cm.dispose();
|
||||
} else {
|
||||
if (status == 0) {
|
||||
if (eim.getProperty("stage1status") == null || eim.getProperty("stage1status").equals("waiting")) {
|
||||
if (eim.getProperty("stage1phase") == null) {
|
||||
stage = 1;
|
||||
eim.setProperty("stage1phase",stage);
|
||||
} else {
|
||||
stage = parseInt(eim.getProperty("stage1phase"));
|
||||
}
|
||||
if (stage == 1) {
|
||||
cm.sendOk("In this challenge, I shall show a pattern on the statues around me. When I give the word, repeat the pattern to me to proceed.");
|
||||
}
|
||||
else {
|
||||
cm.sendOk("I shall now present a more difficult puzzle for you. Good luck.")
|
||||
}
|
||||
}
|
||||
else if (eim.getProperty("stage1status").equals("active")) {
|
||||
if(eim.getProperty("stage1clear") == "true") {
|
||||
cm.sendOk("Excellent work. You may proceed to the next stage.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cm.isEventLeader()) {
|
||||
if (status == 0) {
|
||||
if (eim.getProperty("stage1status") == null || eim.getProperty("stage1status").equals("waiting")) {
|
||||
if (eim.getProperty("stage1phase") == null) {
|
||||
stage = 1;
|
||||
eim.setProperty("stage1phase",stage);
|
||||
} else {
|
||||
stage = parseInt(eim.getProperty("stage1phase"));
|
||||
if (eim.getProperty("stage1combo").equals(eim.getProperty("stage1guess"))) {
|
||||
if (stage == 3) {
|
||||
cm.getPlayer().getMap().getReactorByName("statuegate").hitReactor(cm.getClient());
|
||||
cm.sendOk("Excellent work. Please proceed to the next stage.");
|
||||
cm.showEffect("quest/party/clear");
|
||||
cm.playSound("Party1/Clear");
|
||||
var prev = eim.getProperty("stage1clear");
|
||||
eim.setProperty("stage1clear","true");
|
||||
if (prev == null) {
|
||||
cm.getGuild().gainGP(15);
|
||||
}
|
||||
} else {
|
||||
|
||||
cm.sendOk("Very good. You still have more to complete, however. Talk to me again when you're ready.");
|
||||
eim.setProperty("stage1phase", stage + 1);
|
||||
cm.mapMessage(5, "You have completed part " + stage + " of the Gatekeeper Test.");
|
||||
}
|
||||
|
||||
} else {
|
||||
cm.sendOk("You have failed this test.");
|
||||
cm.mapMessage(5, "You have failed the Gatekeeper Test.");
|
||||
eim.setProperty("stage1phase","1")
|
||||
}
|
||||
eim.setProperty("stage1status", "waiting");
|
||||
cm.dispose();
|
||||
}
|
||||
if (stage == 1) {
|
||||
cm.sendOk("In this challenge, I shall show a pattern on the statues around me. When I give the word, repeat the pattern to me to proceed.");
|
||||
}
|
||||
else {
|
||||
cm.sendOk("Please wait.");
|
||||
cm.dispose();
|
||||
cm.sendOk("I shall now present a more difficult puzzle for you. Good luck.");
|
||||
}
|
||||
}
|
||||
else if (status == 1) {
|
||||
var reactors = getReactors();
|
||||
var combo = makeCombo(reactors);
|
||||
cm.mapMessage(5, "Please wait while the combination is revealed.");
|
||||
var delay = 5000;
|
||||
for (var i = 0; i < combo.length; i++) {
|
||||
cm.getPlayer().getMap().getReactorByOid(combo[i]).delayedHitReactor(cm.getClient(), delay + 3500*i);
|
||||
else if (eim.getProperty("stage1status").equals("active")) {
|
||||
stage = parseInt(eim.getProperty("stage1phase"));
|
||||
|
||||
if (eim.getProperty("stage1combo").equals(eim.getProperty("stage1guess"))) {
|
||||
if (stage == 3) {
|
||||
cm.getPlayer().getMap().getReactorByName("statuegate").forceHitReactor(1);
|
||||
clearStage(1, eim);
|
||||
cm.getGuild().gainGP(15);
|
||||
|
||||
cm.sendOk("Excellent work. You may proceed to the next stage.");
|
||||
} else {
|
||||
cm.sendOk("Very good. You still have more to complete, however. Talk to me again when you're ready.");
|
||||
eim.setProperty("stage1phase", stage + 1);
|
||||
cm.mapMessage(5, "You have completed part " + stage + " of the Gatekeeper Test.");
|
||||
}
|
||||
|
||||
} else {
|
||||
eim.showWrongEffect();
|
||||
cm.sendOk("You have failed this test.");
|
||||
cm.mapMessage(5, "You have failed the Gatekeeper Test.");
|
||||
eim.setProperty("stage1phase","1");
|
||||
}
|
||||
eim.setProperty("stage1status", "display");
|
||||
eim.setProperty("stage1combo","");
|
||||
eim.setProperty("stage1status", "waiting");
|
||||
cm.dispose();
|
||||
}
|
||||
else {
|
||||
cm.sendOk("The statues are working on the pattern. Please wait.");
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
else if (status == 1) {
|
||||
var reactors = getReactors();
|
||||
var combo = makeCombo(reactors);
|
||||
cm.mapMessage(5, "Please wait while the combination is revealed.");
|
||||
var delay = 5000;
|
||||
for (var i = 0; i < combo.length; i++) {
|
||||
cm.getPlayer().getMap().getReactorByOid(combo[i]).delayedHitReactor(cm.getClient(), delay + 3500*i);
|
||||
}
|
||||
eim.setProperty("stage1status", "display");
|
||||
eim.setProperty("stage1combo","");
|
||||
cm.dispose();
|
||||
}
|
||||
} else {
|
||||
cm.sendOk("I need the leader of your party to speak with me, nobody else.");
|
||||
cm.sendOk("I need the leader of this event to speak with me, nobody else.");
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
@@ -122,10 +127,10 @@ function action(mode, type, selection) {
|
||||
function getReactors() {
|
||||
var reactors = new Array();
|
||||
|
||||
var iter = cm.getPlayer().getMap().getMapObjects().iterator();
|
||||
var iter = cm.getPlayer().getMap().getReactors().iterator();
|
||||
while (iter.hasNext()) {
|
||||
var mo = iter.next();
|
||||
if (mo.getType() == Packages.server.maps.MapleMapObjectType.REACTOR && !mo.getName().equals("statuegate")) {
|
||||
if (!mo.getName().equals("statuegate")) {
|
||||
reactors.push(mo.getObjectId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user