Ludibrium Maze PQ

Implemented Ludibrium Maze PQ.
This commit is contained in:
ronancpl
2017-05-15 15:52:24 -03:00
parent b26469301d
commit a56312ddd3
35 changed files with 8081 additions and 8015 deletions

View File

@@ -20,22 +20,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
@ Author : Raz
@
@ NPC = 9103001 - Rolly
@ Map = Ludibrium - <Ludibrium>
@ NPC MapId = 220000000
@ Function = Start LMPQ
@
* Author : Raz, Ronan
*
* NPC = 9103001 - Rolly
* Map = Ludibrium - <Ludibrium>
* NPC MapId = 220000000
* Function = Start LMPQ
*
*/
var status = 0;
var minlvl = 51;
var maxlvl = 200;
var minplayers = 3;
var maxplayers = 6;
var time = 15;
var open = true;
function start() {
status = -1;
@@ -43,97 +37,55 @@ function start() {
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else if (mode == 0) {
cm.dispose();
} else {
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendSimple("This is the entrance to the Ludibrium Maze. Enjoy!\r\n#b#L0#Enter the Lubidrium Maze#l\r\n#L1#What is the Ludibrium Maze?");
} else if (status == 1) {
var em = cm.getEventManager("LudiMazePQ");
if(selection == 0) {//ENTER THE PQ
if (!hasParty()) {//NO PARTY
cm.sendOk("Try taking on the Maze Quest with your party. If you DO decide to tackle it, please have your Party Leader notify me!");
} else if (!isLeader()) {//NOT LEADER
cm.sendOk("Try taking on the Maze Quest with your party. If you DO decide to tackle it, please have your Party Leader notify me!");
} else if (!checkPartySize()) {//PARTY SIZE WRONG
cm.sendOk("Your party needs to consist of at least " + minplayers + " members in order to tackle this maze");
} else if (!checkPartyLevels()) {//WRONG LEVELS
cm.sendOk("One of your party members has not met the level requirements of " + minlvl + "~" + maxlvl + ".");
} else if (em == null) {//EVENT ERROR
cm.sendOk("ERROR IN EVENT");
} else if (!open){
cm.sendOk("The PQ is #rclosed#k for now.");
} else {
if(!em.startInstance(cm.getParty(), cm.getPlayer().getMap())) {
cm.sendOk("A party in your name is already registered in this event.");
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
var party = cm.getPlayer().getEventInstance().getPlayers();
cm.removeFromParty(4001106, party);
}
cm.dispose();
} else if(selection == 1) {
cm.sendOk("This maze is available to all parties of " + minplayers + " or more members, and all participants must be between Level " + minlvl + "~" + maxlvl + ". You will be given " + time + " minutes to escape the maze. At the center of the room, there will be a Warp Portal set up to transport you to a different room. These portals will transport you to other rooms where you'll (hopefully) find the exit. Pietri will be waiting at the exit, so all you need to do is talk to him, and he'll let you out. Break all the boxes located in the room, and a monster inside the box will drop a coupon. After escaping the maze, you will be awarded with EXP based on the coupons collected. Additionally, if the leader possesses at least 200 coupons, then a special gift will be presented to the party. If you cannot escape the maze within the allotted " + time +" minutes, you will receive 0 EXP for your time in the maze. If you decide to log off while you're in the maze, you will be automatically kicked out of the maze. Even if the members of the party leave in the middle of the quest, the remaining members will be able to continue on with the quest. If you are in critical condition and unable to hunt down the monsters, you may avoid them to save yourself. Your fighting spirit and wits will be tested! Good luck!");
cm.dispose();
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
em = cm.getEventManager("LudiMazePQ");
if(em == null) {
cm.sendOk("The Ludibrium Maze PQ has encountered an error.");
cm.dispose();
return;
}
cm.sendSimple("#e#b<Party Quest: Ludibrium Maze>\r\n#k#n" + em.getProperty("party") + "\r\n\r\nThis is the entrance to the Ludibrium Maze. Enjoy!\r\n#b#L0#Enter the Lubidrium Maze#l\r\n#L1#I want to find party members.\r\n#L2#What is the Ludibrium Maze?");
} else if (status == 1) {
if (selection == 0) {
if (cm.getParty() == null) {
cm.sendOk("Try taking on the Maze Quest with your party.");
cm.dispose();
} else if(!cm.isLeader()) {
cm.sendOk("If you DO decide to tackle it, please have your Party Leader notify me!");
cm.dispose();
} else {
var eli = em.getEligibleParty(cm.getParty());
if(eli.size() > 0) {
if(!em.startInstance(cm.getParty(), cm.getPlayer().getMap(), 1)) {
cm.sendOk("Another party has already entered the #rParty Quest#k in this channel. Please try another channel, or wait for the current party to finish.");
}
}
else {
cm.sendOk("Your party needs to consist of at least 3 members in order to tackle this maze.");
}
cm.dispose();
}
} else if (selection == 1) {
cm.sendOk("Try using a Super Megaphone or asking your buddies or guild to join!");
cm.dispose();
} else {
cm.sendOk("#e#b<Party Quest: Ludibrium Maze>#k#n\r\nThis maze is available to all parties of 3 or more members, and all participants must be between Level 51~70. You will be given 15 minutes to escape the maze. At the center of the room, there will be a Warp Portal set up to transport you to a different room. These portals will transport you to other rooms where you'll (hopefully) find the exit. Pietri will be waiting at the exit, so all you need to do is talk to him, and he'll let you out. Break all the boxes located in the room, and a monster inside the box will drop a coupon. After escaping the maze, you will be awarded with EXP based on the coupons collected. Additionally, if the leader possesses at least 30 coupons, then a special gift will be presented to the party. If you cannot escape the maze within the allotted 15 minutes, you will receive 0 EXP for your time in the maze. If you decide to log off while you're in the maze, you will be automatically kicked out of the maze. Even if the members of the party leave in the middle of the quest, the remaining members will be able to continue on with the quest, except if they run out of the minimum amount of party members in the maze. If you are in critical condition and unable to hunt down the monsters, you may avoid them to save yourself. Your fighting spirit and wits will be tested! Good luck!");
cm.dispose();
}
}
}
}
}
function getPartySize(){
if(cm.getPlayer().getParty() == null){
return 0;
}else{
return (cm.getPlayer().getParty().getMembers().size());
}
}
function isLeader(){
return cm.isLeader();
}
function checkPartySize(){
var size = 0;
if(cm.getPlayer().getParty() == null){
size = 0;
}else{
size = (cm.getPlayer().getParty().getMembers().size());
}
if(size < minplayers || size > maxplayers){
return false;
}else{
return true;
}
}
function checkPartyLevels(){
var pass = true;
var party = cm.getPlayer().getParty().getMembers();
if(cm.getPlayer().getParty() == null){
pass = false;
}else{
for (var i = 0; i < party.size() && pass; i++) {
if ((party.get(i).getLevel() < minlvl) || (party.get(i).getLevel() > maxlvl) || (party.get(i).getPlayer().getMapId() != cm.getPlayer().getMapId())) {
pass = false;
}
}
}
return pass;
}
function hasParty(){
if(cm.getPlayer().getParty() == null){
return false;
}else{
return true;
}
}