GuildPQ Queue system + revamped Warp mechanic

Added a queue system for waiting guilds outside the GPQ area. Changed
the way players are transported through maps on non-portal passing
cases: if not defined, a spawn point is chosen randomly for each player.
This commit is contained in:
ronancpl
2017-06-13 20:47:58 -03:00
parent 7a8bba98ca
commit 81f9226286
82 changed files with 669 additions and 375 deletions

View File

@@ -38,7 +38,7 @@ function action(mode, type, selection) {
if (status == 0) {
cm.sendNext("Hello, there! I'm Tommy. There's a Pig Town nearby where we're standing. The pigs there are rowdy and uncontrollable to the point where they have stolen numerous weapons from travelers. They were kicked out from their towns, and are currently hiding out at the Pig Town.");
} else if (status == 1) {
if(cm.isLeader()) {
if(cm.isEventLeader()) {
cm.sendYesNo("What do you think about making your way there with your party members and teach those rowdy pigs a lesson?");
}
else {

View File

@@ -35,7 +35,7 @@ function action(mode, type, selection) {
status++;
if (status == 0) {
if (cm.isLeader()) {
if (cm.isEventLeader()) {
cm.sendSimple("Growl! I am Growlie, always ready to protect this place. What brought you here?\r\n#b#L0# Please tell me what this place is all about.#l\r\n#L1# I have brought #t4001101#.#l\r\n#L2# I would like to leave this place.#l");
} else {
cm.sendSimple("Growl! I am Growlie, always ready to protect this place. What brought you here?\r\n#b#L0# Please tell me what this place is all about.#l\r\n#L2# I would like to leave this place.#l");

View File

@@ -44,7 +44,7 @@ function action(mode, type, selection) {
cm.dispose();
return;
}
if (!cm.isLeader()) {
if (!cm.isEventLeader()) {
if(cm.getPlayer().getMapId() == 920010000) {
cm.warp(920010000, 2);
cm.dispose();

View File

@@ -64,7 +64,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -64,7 +64,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -64,7 +64,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -64,7 +64,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -64,7 +64,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -67,7 +67,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -89,7 +89,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -58,7 +58,7 @@ function action(mode, type, selection) {
cm.sendNext("Hurry, goto the next stage, the portal is open!");
}
else {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
var state = eim.getIntProperty("statusStg" + stage);
if(state == -1) { // preamble

View File

@@ -43,7 +43,7 @@ function action(mode, type, selection) {
if(cm.getMapId() == 925100500) {
if (status == 0) {
if(cm.isLeader()) {
if(cm.isEventLeader()) {
cm.sendOk("I have been saved thanks to your efforts! Thank you, guys!");
}
else {

View File

@@ -22,7 +22,7 @@ function action(mode, type, selection) {
return;
}
if (!cm.isLeader()) {
if (!cm.isEventLeader()) {
cm.sendYesNo("I wish for your leader to talk to me. Alternatively, you may be wanting to quit. Are you going to abandon this campaign?");
}
else {

View File

@@ -65,7 +65,7 @@ function action(mode, type, selection) {
cm.getEventInstance().setProperty("clear", "true");
}
if(cm.isLeader()) {
if(cm.isEventLeader()) {
cm.sendOk("Your party completed such an astounding feat coming this far, #byou have defeated all the bosses#k, congratulations! Now I will be handing your reward as you are being transported out...");
}
else {
@@ -73,7 +73,7 @@ function action(mode, type, selection) {
}
}
else if(state == 2) {
if(cm.isLeader()) {
if(cm.isEventLeader()) {
if(cm.getPlayer().getEventInstance().isEventTeamTogether()) {
cm.sendYesNo("Is your party ready to proceed to the next stages? Walk through the portal if you think you're done, the time is now.. Now, do you guys REALLY want to proceed?");
}
@@ -126,7 +126,7 @@ function action(mode, type, selection) {
if (cm.getParty() == null) {
cm.sendOk("You can participate in the party quest only if you are in a party.");
cm.dispose();
} else if(!cm.isLeader()) {
} else if(!cm.isEventLeader()) {
cm.sendOk("Your party leader must talk to me to start this party quest.");
cm.dispose();
} else {

View File

@@ -51,7 +51,7 @@ function action(mode, type, selection) {
if (cm.getParty() == null) {
cm.sendOk("You can participate in the party quest only if you are in a party.");
cm.dispose();
} else if(!cm.isLeader()) {
} else if(!cm.isEventLeader()) {
cm.sendOk("Your party leader must talk to me to start this party quest.");
cm.dispose();
} else {

View File

@@ -136,7 +136,7 @@ function action(mode, type, selection) {
}
}
else if(curMap == 103000800) { // stage 1
if(cm.isLeader()) {
if(cm.isEventLeader()) {
var numpasses = eim.getPlayerCount() - 1; // minus leader
if(cm.hasItem(4001008, numpasses)) {
@@ -184,7 +184,7 @@ function action(mode, type, selection) {
var nthtext = "2nd", nthobj = "ropes", nthverb = "hang", nthpos = "hang on the ropes too low";
var nextStgId = 103000802;
if(!eim.isLeader(cm.getPlayer())) {
if(!eim.isEventLeader(cm.getPlayer())) {
cm.sendOk("Follow the instructions given by your party leader to proceed through this stage.");
}
else if(eim.getProperty(stgProperty) == null) {
@@ -214,7 +214,7 @@ function action(mode, type, selection) {
var nthtext = "3rd", nthobj = "platforms", nthverb = "stand", nthpos = "stand too close to the edges";
var nextStgId = 103000803;
if(!eim.isLeader(cm.getPlayer())) {
if(!eim.isEventLeader(cm.getPlayer())) {
cm.sendOk("Follow the instructions given by your party leader to proceed through this stage.");
}
else if(eim.getProperty(stgProperty) == null) {
@@ -244,7 +244,7 @@ function action(mode, type, selection) {
var nthtext = "4th", nthobj = "barrels", nthverb = "stand", nthpos = "stand too close to the edges";
var nextStgId = 103000804;
if(!eim.isLeader(cm.getPlayer())) {
if(!eim.isEventLeader(cm.getPlayer())) {
cm.sendOk("Follow the instructions given by your party leader to proceed through this stage.");
}
else if(eim.getProperty(stgProperty) == null) {
@@ -267,7 +267,7 @@ function action(mode, type, selection) {
cm.dispose();
} else if(curMap == 103000804) {
if (eim.isLeader(cm.getPlayer())) {
if (eim.isEventLeader(cm.getPlayer())) {
if (cm.haveItem(4001008, 10)) {
cm.sendNext("Here's the portal that leads you to the last, bonus stage. It's a stage that allows you to defeat regular monsters a little easier. You'll be given a set amount of time to hunt as much as possible, but you can always leave the stage in the middle of it through the NPC. Again, congratulations on clearing all the stages. Let your party talk to me to receive their prizes as they are allowed to pass to the bonus stage. Take care...");
cm.gainItem(4001008, -10);

View File

@@ -1,122 +1,106 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* @Author Lerk
*
* Shuang, Victoria Road: Excavation Site<Camp> (101030104)
*
* Start of Guild Quest
/**
* @author: Ronan
* @npc: Shuang
* @map: Victoria Road: Excavation Site<Camp> (101030104)
* @func: Start Guild PQ
*/
var status = 0;
var GQItems = new Array(1032033, 4001024, 4001025, 4001026, 4001027, 4001028, 4001029, 4001030, 4001031, 4001032, 4001033, 4001034, 4001035, 4001037);
var sel;
var em = null;
function findLobby(guild) {
for (var iterator = em.getInstances().iterator(); iterator.hasNext();) {
var lobby = iterator.next();
if(lobby.getIntProperty("guild") == guild) {
if(lobby.getIntProperty("canJoin") == 1) return lobby;
else return null;
}
}
return null;
}
function start() {
cm.sendSimple("The path to Sharenian starts here. What would you like to do? #b\r\n#L0#Start a Guild Quest#l\r\n#L1#Join your guild's Guild Quest#l");
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1)
cm.dispose();
else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 1) {
if (selection == 0) { //Start
if (cm.getPlayer().getGuildId() == 0 || cm.getPlayer().getGuildRank() >= 3) { //no guild or not guild master/jr. master
cm.sendNext("Only a Master or Jr. Master of the guild can start an instance.");
cm.dispose();
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && status == 0) {
cm.dispose();
return;
}
else {
var em = cm.getEventManager("GuildQuest");
if (em == null)
cm.sendOk("This trial is currently under construction.");
else {
if(em.getProperty("gpqOpen").equals("false")) {
cm.sendOk("Another guild has already registered for the quest. Please try again later.");
} else if (getEimForGuild(em, cm.getPlayer().getGuildId()) != null)
cm.sendOk("Your guild already is already registered.");
else {
var guildId = cm.getPlayer().getGuildId();
var eim = em.newInstance(guildId);
em.startInstance(eim, cm.getPlayer().getName());
em.setProperty("gpqOpen", "false");
var map = eim.getMapInstance(990000000);
map.getPortal(5).setScriptName("guildwaitingenter");
map.getPortal(4).setScriptName("guildwaitingexit");
eim.registerPlayer(cm.getPlayer());
cm.guildMessage(5, "The guild has been entered into the Guild Quest. Please report to Shuang at the Excavation Camp on channel " + cm.getClient().getChannel() + ".");
for (var i = 0; i < GQItems.length; i++)
cm.removeAll(GQItems[i]);
if (mode == 1)
status++;
else
status--;
if (status == 0) {
em = cm.getEventManager("GuildQuest");
if(em == null) {
cm.sendOk("The Guild Quest has encountered an error.");
cm.dispose();
return;
}
}
cm.dispose();
}
}
else if (selection == 1) { //entering existing GQ
if (cm.getPlayer().getGuildId() == 0) { //no guild or not guild master/jr. master
cm.sendNext("You must be in a guild to join an instance.");
cm.dispose();
}
else {
var em = cm.getEventManager("GuildQuest");
if (em == null)
cm.sendOk("This trial is currently under construction.");
else {
var eim = getEimForGuild(em, cm.getPlayer().getGuildId());
if (eim == null)
cm.sendOk("Your guild is currently not registered for the Guild Quest.");
else {
if ("true".equals(eim.getProperty("canEnter"))) {
eim.registerPlayer(cm.getPlayer());
for (var i = 0; i < GQItems.length; i++)
cm.removeAll(GQItems[i]);
}
else
cm.sendOk("I'm sorry, but the guild has gone on without you. Try again later.");
cm.sendSimple("#e#b<Guild Quest: Sharenian Ruins>\r\n#k#n" + em.getProperty("party") + "\r\n\r\nThe path to Sharenian starts here. What would you like to do? #b\r\n#L0#Register your guild for Guild Quest#l\r\n#L1#Join your guild's Guild Quest#l\r\n#L2#I would like to hear more details.#l");
} else if (status == 1) {
sel = selection;
if (selection == 0) {
if(!cm.isGuildLeader()) {
cm.sendOk("Your guild master/jr.master must talk to me to register this guild quest.");
cm.dispose();
} else {
if(em.isQueueFull()) {
cm.sendOk("The queue on this channel is already full. Please be patient and try again after a while, or try on another channel.");
cm.dispose();
} else {
var qsize = em.getQueueSize();
cm.sendYesNo(((qsize > 0) ? "There is currently #r" + qsize + "#k guilds queued on. " : "") + "Do you wish for your guild to join this queue?");
}
}
} else if (selection == 1) {
if(cm.getPlayer().getGuildId() > 0) {
var eim = findLobby(cm.getPlayer().getGuildId());
if(eim == null) {
cm.sendOk("You don't have a guild registered and currently on strategy time to assist on this channel.");
} else {
if(cm.isLeader()) {
em.getEligibleParty(cm.getParty());
eim.registerParty(cm.getPlayer());
} else {
eim.registerPlayer(cm.getPlayer());
}
}
} else {
cm.sendOk("You can't participate in the guild quest if you don't pertain on a guild yourself!");
}
cm.dispose();
} else {
cm.sendOk("#e#b<Guild Quest: Sharenian Ruins>#k#n\r\n Team up with your guild members in an auspicious attempt to recover the Rubian from the skeleton's grasp, with teamwork overcoming many puzzles and challenges awaiting inside the Sharenian tombs. Great rewards can be obtained upon the instance completion, and Guild Points can be racked up for your Guild.");
cm.dispose();
}
}
cm.dispose();
} else if (status == 2) {
if (sel == 0) {
var entry = em.addGuildToQueue(cm.getPlayer().getGuildId(), cm.getPlayer().getId());
if(entry > 0) {
if(entry == 1) {
cm.sendOk("Your guild has been registered successfully. A message will pop on your chat keeping your guild aware about the registration status. Now, #rimportant#k: as the leader of this instance, #ryou must already be present on this channel#k the right moment your guild is called for the strategy time. #bThe missubmission of this action will void#k your guild registration as a whole, and the next guild will be called immediately. Must be noted also, that if you become absent from the end of the strategy time to any point on the duration of the instance, it will render the instance interrupted, and your guild will be moved out instantly, moving again the queue.");
}
} else if(entry == 0) {
cm.sendOk("The queue on this channel is already full. Please be patient and try again after a while, or try on another channel.");
} else {
cm.sendOk("Your guild is already queued on a channel. Please wait for your guild's turn.");
}
}
cm.dispose();
}
}
}
}
}
function getEimForGuild(em, id) {
var stringId = "" + id;
return em.getInstance(stringId);
}
function isGuildQuestOwner(em, id) {
var stringId = "" + id;
if(em.getProperty("curGuild").equals(stringId))
return true;
return false;
}

View File

@@ -51,7 +51,7 @@ function action(mode, type, selection) {
status--;
if (status == 0) {
if(cm.isLeader()) {
if(cm.isEventLeader()) {
if(!cm.getEventInstance().isEventTeamTogether()) {
cm.sendOk("One or more event team members is missing, please wait for them to reach here first.");
cm.dispose();