Ludibrium PQ + MapleIdRetriever

Implemented LPQ. New application tool that realizes fetches by names and
returns respective ids, over all items depicted in the GM handbook.
This commit is contained in:
ronancpl
2017-05-13 15:24:02 -03:00
parent ed6121dd5f
commit b26469301d
94 changed files with 36729 additions and 1186 deletions

View File

@@ -20,7 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
@ Author : Twdtwd
@ Author : Twdtwd, Ronan
@
@ NPC = Blue Balloon
@ Map = Hidden-Street <Stage 8>
@@ -30,19 +30,6 @@
@ Description: Used to find the combo to unlock the next door. Players stand on 5 different crates to guess the combo.
*/
importPackage(Packages.tools);
var status = 0;
var party;
var preamble;
var gaveItems;
var nthtext = "8th";
function start() {
status = -1;
action(1, 0, 0);
}
function generateCombo() {
var countPicked = 0;
var positions = Array(0,0,0,0,0,0,0,0,0);
@@ -66,102 +53,100 @@ function generateCombo() {
}
var debug = false;
var status = 0;
var curMap, stage;
function clearStage(stage, eim, curMap) {
eim.setProperty(stage + "stageclear", "true");
eim.showClearEffect(true);
eim.linkToNextStage(stage, "lpq", curMap); //opens the portal to the next map
}
function start() {
curMap = cm.getMapId();
stage = Math.floor((curMap - 922010100) / 100) + 1;
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
}else if (mode == 0){
cm.dispose();
}else{
if (mode == 1)
status++;
else
status--;
var eim = cm.getPlayer().getEventInstance();
if (status == 0) {
party = eim.getPlayers();
preamble = eim.getProperty("leader" + nthtext + "preamble");
gaveItems = eim.getProperty("leader" + nthtext + "gaveItems");
if (preamble == null) {
cm.sendOk("Hi. Welcome to the " + nthtext + " stage.");
eim.setProperty("leader" + nthtext + "preamble","done");
eim.setProperty("stage" + nthtext + "combo", generateCombo());
if (mode == -1) {
cm.dispose();
} else if (mode == 0){
cm.dispose();
} else {
if (mode == 1)
status++;
else
status--;
var eim = cm.getPlayer().getEventInstance();
if(eim.getProperty(stage.toString() + "stageclear") != null) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble
cm.sendOk("Hi. Welcome to the #bstage " + stage + "#k. In this stage, line up 5 member of your party above those boxes in order to form the right combination to unlock the next stage. Only one player should stay above a box desired to pertain the combination.");
var st = (debug) ? 2 : 0;
eim.setProperty("statusStg" + stage, st);
}
else { // check stage completion
if(state == 2) {
eim.setProperty("statusStg" + stage, 1);
clearStage(stage, eim, curMap);
cm.dispose();
return;
}
objset = [0,0,0,0,0,0,0,0,0];
var playersOnCombo = 0;
var map = cm.getPlayer().getMap();
var party = cm.getEventInstance().getPlayers();
for (var i = 0; i < party.size(); i++) {
for (var y = 0; y < map.getAreas().size(); y++) {
if (map.getArea(y).contains(party.get(i).getPosition())) {
playersOnCombo++;
objset[y] = 1;
//cm.mapMessage(5, "Player found on " + (y + 1));
break;
}
}
}
if (playersOnCombo == 5 || cm.getPlayer().gmLevel() > 0) {
var combo = eim.getProperty("stage" + stage + "combo").split(',');
var correctCombo = true;
for (i = 0; i < objset.length && correctCombo; i++)
if (parseInt(combo[i]) != objset[i]) {
//cm.mapMessage(5, "Combo failed on " + (i + 1));
correctCombo = false;
}
if (correctCombo || cm.getPlayer().gmLevel() > 0) {
eim.setProperty("statusStg" + stage, 1);
clearStage(stage, eim, curMap);
cm.dispose();
} else {
eim.showWrongEffect();
cm.dispose();
}
} else {
cm.sendNext("It looks like you haven't found the 5 boxes just yet. Please think of a different combination of boxes. Only 5 are allowed to stand on boxes, and if you move it may not count as an answer, so please keep that in mind. Keep going!");
cm.dispose();
}
}
} else {
cm.sendNext("Please tell your #bParty-Leader#k to come talk to me.");
}
}
cm.dispose();
}else{
if(!isLeader()){
if(gaveItems == null){
cm.sendOk("Please tell your #bParty-Leader#k to come talk to me");
cm.dispose();
}else{
cm.sendOk("Hurry, go to the next stage, the portal is open!");
cm.dispose();
}
}
if(gaveItems == null){
if(cm.getPlayer().getMap().getCharacters().size() != eim.getPlayers().size()) {
cm.sendOk("Please wait for all of your party members to get here.");
cm.dispose();
return;
}
objset = [0,0,0,0,0,0,0,0,0];
var playersOnCombo = 0;
var map = cm.getPlayer().getMap();
for (var i = 0; i < party.size(); i++) {
for (var y = 0; y < map.getAreas().size(); y++) {
if (map.getArea(y).contains(party.get(i).getPosition())) {
playersOnCombo++;
objset[y] = 1;
//cm.mapMessage(5, "Player found on " + (y + 1));
break;
}
}
}
if (playersOnCombo == 5 || cm.getPlayer().gmLevel() > 0) {
var combo = eim.getProperty("stage" + nthtext + "combo").split(',');
var correctCombo = true;
for (i = 0; i < objset.length && correctCombo; i++)
if (parseInt(combo[i]) != objset[i]) {
//cm.mapMessage(5, "Combo failed on " + (i + 1));
correctCombo = false;
}
if (correctCombo || cm.getPlayer().gmLevel() > 0) {
clear(eim, cm);
cm.dispose();
} else { // Wrong
//cm.sendOk(eim.getProperty("stage" + nthtext + "combo"));
failstage(eim, cm);
cm.dispose();
}
} else {
cm.sendNext("It looks like you haven't found the 5 boxes just yet. Please think of a different combination of boxes Only 5 are allowed to stand on boxes, and if you move it may not count as an answer, so please keep that in mind. Keep going!");
cm.dispose();
}
}
}
}
}
}
function clear(eim, cm) {
var map = eim.getMapInstance(cm.getPlayer().getMapId());
map.broadcastMessage(MaplePacketCreator.showEffect("quest/party/clear"));
map.broadcastMessage(MaplePacketCreator.playSound("Party1/Clear"));
map.broadcastMessage(MaplePacketCreator.environmentChange("gate", 2));
eim.setProperty("8stageclear","true");
eim.setProperty("leader" + nthtext + "gaveItems","done");
cm.givePartyExp("LudiPQ8th");
}
function failstage(eim, cm) {
var map = eim.getMapInstance(cm.getPlayer().getMapId());
map.broadcastMessage(MaplePacketCreator.playSound("Party1/Failed"));
map.broadcastMessage(MaplePacketCreator.showEffect("quest/party/wrong_kor"));
}
function isLeader(){
if(cm.getParty() == null)
return false;
else
return cm.isLeader();
}
}