Savior Commit
Fixed some bugs regarding dojo, updated drop data, minor tweaks on Mystic Doors, added expeditions for Showa Manor, Zakum and Pink Bean, smart search for item slots on quest/npc rewarding system, attempt on boss HPbar to focus on player's current target, quests with selectable rewards now hands the item correctly, after the first PQ instance next ones are loaded more smoothly.
This commit is contained in:
@@ -1,216 +1,180 @@
|
||||
/*
|
||||
NPC Name: The Forgotten Temple Manager
|
||||
Map(s): Deep in the Shrine - Forgotten Twilight
|
||||
Description: Pink Bean battle starter
|
||||
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 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/>.
|
||||
*/
|
||||
var status = -1;
|
||||
/* The Forgotten Temple Manager
|
||||
*
|
||||
* Deep Place of Temple - Forgotten Twilight (270050000)
|
||||
* Vs Pink Bean Recruiter NPC
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
importPackage(Packages.server.expeditions);
|
||||
importPackage(Packages.tools);
|
||||
importPackage(Packages.scripting.event);
|
||||
|
||||
var status = 0;
|
||||
var expedition;
|
||||
var player;
|
||||
var em;
|
||||
var exped = MapleExpeditionType.PINKBEAN;
|
||||
var expedName = "Twilight of the Gods";
|
||||
var expedBoss = "Pink Bean";
|
||||
var expedMap = "Twilight of Gods";
|
||||
|
||||
var list = "What would you like to do?#b\r\n\r\n#L1#View current Expedition members#l\r\n#L2#Start the fight!#l\r\n#L3#Stop the expedition.#l";
|
||||
|
||||
function start() {
|
||||
if (cm.getPlayer().getLevel() < 120) {
|
||||
cm.sendOk("There is a level requirement of 120 to attempt Pink Bean.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
if (cm.getPlayer().getClient().getChannel() != 5) {
|
||||
cm.sendOk("Pink Bean may only be attempted on channel 5.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
var em = cm.getEventManager("PinkBeanBattle");
|
||||
|
||||
if (em == null) {
|
||||
cm.sendOk("The event isn't started, please contact a GM.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
var eim_status = em.getProperty("state");
|
||||
var marr = cm.getQuestRecord(160104);
|
||||
var data = marr.getCustomData();
|
||||
if (data == null) {
|
||||
marr.setCustomData("0");
|
||||
data = "0";
|
||||
}
|
||||
var time = parseInt(data);
|
||||
if (eim_status == null || eim_status.equals("0")) {
|
||||
|
||||
var squadAvailability = cm.getSquadAvailability("PinkBean");
|
||||
if (squadAvailability == -1) {
|
||||
status = 0;
|
||||
if (time + (12 * 3600000) >= cm.getCurrentTime() && !cm.getPlayer().isGM()) {
|
||||
cm.sendOk("You have already went to PinkBean in the past 12 hours. Time left: " + cm.getReadableMillis(cm.getCurrentTime(), time + (12 * 3600000)));
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
cm.sendYesNo("Are you interested in becoming the leader of the expedition Squad?");
|
||||
|
||||
} else if (squadAvailability == 1) {
|
||||
if (time + (12 * 3600000) >= cm.getCurrentTime() && !cm.getPlayer().isGM()) {
|
||||
cm.sendOk("You have already went to PinkBean in the past 12 hours. Time left: " + cm.getReadableMillis(cm.getCurrentTime(), time + (12 * 3600000)));
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
// -1 = Cancelled, 0 = not, 1 = true
|
||||
var type = cm.isSquadLeader("PinkBean");
|
||||
if (type == -1) {
|
||||
cm.sendOk("The squad has ended, please re-register.");
|
||||
cm.dispose();
|
||||
} else if (type == 0) {
|
||||
var memberType = cm.isSquadMember("PinkBean");
|
||||
if (memberType == 2) {
|
||||
cm.sendOk("You been banned from the squad.");
|
||||
cm.dispose();
|
||||
} else if (memberType == 1) {
|
||||
status = 5;
|
||||
cm.sendSimple("What would you like to do? \r\n#b#L0#Join the squad to Twilight of the Gods#l \r\n#b#L1#Leave the squad to Twilight of the Gods#l \r\n#b#L2#See the list of members on the squad#l");
|
||||
} else if (memberType == -1) {
|
||||
cm.sendOk("The squad has ended, please re-register.");
|
||||
cm.dispose();
|
||||
} else {
|
||||
status = 5;
|
||||
cm.sendSimple("What would you like to do? \r\n#b#L0#Join the squad to Twilight of the Gods#l \r\n#b#L1#Leave the squad to Twilight of the Gods#l \r\n#b#L2#See the list of members on the squad#l");
|
||||
}
|
||||
} else { // Is leader
|
||||
status = 10;
|
||||
cm.sendSimple("What do you want to do, expedition leader? \r\n#b#L0#View expedition list#l \r\n#b#L1#Kick from expedition#l \r\n#b#L2#Remove user from ban list#l \r\n#r#L3#Select expedition team and enter#l");
|
||||
// TODO viewing!
|
||||
}
|
||||
} else {
|
||||
var eim = cm.getDisconnected("PinkBeanBattle");
|
||||
if (eim == null) {
|
||||
var squd = cm.getSquad("PinkBean");
|
||||
if (squd != null) {
|
||||
if (time + (12 * 3600000) >= cm.getCurrentTime() && !cm.getPlayer().isGM()) {
|
||||
cm.sendOk("You have already went to PinkBean in the past 12 hours. Time left: " + cm.getReadableMillis(cm.getCurrentTime(), time + (12 * 3600000)));
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
cm.sendYesNo("The squad's battle against the boss has already begun.\r\n" + squd.getNextPlayer());
|
||||
status = 3;
|
||||
} else {
|
||||
cm.sendOk("The squad's battle against the boss has already begun.");
|
||||
cm.safeDispose();
|
||||
}
|
||||
} else {
|
||||
cm.sendYesNo("Ah, you have returned. Would you like to join your squad in the fight again?");
|
||||
status = 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var eim = cm.getDisconnected("PinkBeanBattle");
|
||||
if (eim == null) {
|
||||
var squd = cm.getSquad("PinkBean");
|
||||
if (squd != null) {
|
||||
if (time + (12 * 3600000) >= cm.getCurrentTime() && !cm.getPlayer().isGM()) {
|
||||
cm.sendOk("You have already went to PinkBean in the past 12 hours. Time left: " + cm.getReadableMillis(cm.getCurrentTime(), time + (12 * 3600000)));
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
cm.sendYesNo("The squad's battle against the boss has already begun.\r\n" + squd.getNextPlayer());
|
||||
status = 3;
|
||||
} else {
|
||||
cm.sendOk("The squad's battle against the boss has already begun.");
|
||||
cm.safeDispose();
|
||||
}
|
||||
} else {
|
||||
cm.sendYesNo("Ah, you have returned. Would you like to join your squad in the fight again?");
|
||||
status = 2;
|
||||
}
|
||||
}
|
||||
action(1, 0, 0);
|
||||
}
|
||||
|
||||
function action(mode, type, selection) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
if (mode == 1) {
|
||||
if (cm.registerSquad("PinkBean", 5, " has been named the Leader of the squad. If you would you like to join please register for the Expedition Squad within the time period.")) {
|
||||
cm.sendOk("You have been named the Leader of the Squad. For the next 5 minutes, you can add the members of the Expedition Squad.");
|
||||
} else {
|
||||
cm.sendOk("An error has occurred adding your squad.");
|
||||
}
|
||||
}
|
||||
cm.dispose();
|
||||
break;
|
||||
case 2:
|
||||
if (!cm.reAdd("PinkBeanBattle", "PinkBean")) {
|
||||
cm.sendOk("Error... please try again.");
|
||||
}
|
||||
cm.safeDispose();
|
||||
break;
|
||||
case 3:
|
||||
if (mode == 1) {
|
||||
var squd = cm.getSquad("PinkBean");
|
||||
if (squd != null && !squd.getAllNextPlayer().contains(cm.getPlayer().getName())) {
|
||||
squd.setNextPlayer(cm.getPlayer().getName());
|
||||
cm.sendOk("You have reserved the spot.");
|
||||
}
|
||||
}
|
||||
cm.dispose();
|
||||
break;
|
||||
case 5:
|
||||
if (selection == 0) { // join
|
||||
var ba = cm.addMember("PinkBean", true);
|
||||
if (ba == 2) {
|
||||
cm.sendOk("The squad is currently full, please try again later.");
|
||||
} else if (ba == 1) {
|
||||
cm.sendOk("You have joined the squad successfully");
|
||||
} else {
|
||||
cm.sendOk("You are already part of the squad.");
|
||||
}
|
||||
} else if (selection == 1) {// withdraw
|
||||
var baa = cm.addMember("PinkBean", false);
|
||||
if (baa == 1) {
|
||||
cm.sendOk("You have withdrawed from the squad successfully");
|
||||
} else {
|
||||
cm.sendOk("You are not part of the squad.");
|
||||
}
|
||||
} else if (selection == 2) {
|
||||
if (!cm.getSquadList("PinkBean", 0)) {
|
||||
cm.sendOk("Due to an unknown error, the request for squad has been denied.");
|
||||
}
|
||||
}
|
||||
cm.dispose();
|
||||
break;
|
||||
case 10:
|
||||
if (mode == 1) {
|
||||
if (selection == 0) {
|
||||
if (!cm.getSquadList("PinkBean", 0)) {
|
||||
cm.sendOk("Due to an unknown error, the request for squad has been denied.");
|
||||
}
|
||||
cm.dispose();
|
||||
} else if (selection == 1) {
|
||||
status = 11;
|
||||
if (!cm.getSquadList("PinkBean", 1)) {
|
||||
cm.sendOk("Due to an unknown error, the request for squad has been denied.");
|
||||
cm.dispose();
|
||||
}
|
||||
} else if (selection == 2) {
|
||||
status = 12;
|
||||
if (!cm.getSquadList("PinkBean", 2)) {
|
||||
cm.sendOk("Due to an unknown error, the request for squad has been denied.");
|
||||
cm.dispose();
|
||||
}
|
||||
} else if (selection == 3) { // get inside
|
||||
if (cm.getSquad("PinkBean") != null) {
|
||||
var dd = cm.getEventManager("PinkBeanBattle");
|
||||
dd.startInstance(cm.getSquad("PinkBean"), cm.getMap(), 160104);
|
||||
} else {
|
||||
cm.sendOk("Due to an unknown error, the request for squad has been denied.");
|
||||
}
|
||||
cm.dispose();
|
||||
}
|
||||
} else {
|
||||
cm.dispose();
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
cm.banMember("PinkBean", selection);
|
||||
cm.dispose();
|
||||
break;
|
||||
case 12:
|
||||
if (selection != -1) {
|
||||
cm.acceptMember("PinkBean", selection);
|
||||
}
|
||||
cm.dispose();
|
||||
break;
|
||||
|
||||
player = cm.getPlayer();
|
||||
expedition = cm.getExpedition(exped);
|
||||
em = cm.getEventManager("PinkBeanBattle");
|
||||
|
||||
if (mode == -1) {
|
||||
cm.dispose();
|
||||
} else {
|
||||
if (mode == 0) {
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == 0) {
|
||||
if (player.getLevel() < exped.getMinLevel() && player.getLevel() > exped.getMaxLevel()) { //Don't fit requirement
|
||||
cm.sendOk("You do not meet the criteria to battle " + expedBoss + "!");
|
||||
cm.dispose();
|
||||
} else if (expedition == null) { //Start an expedition
|
||||
cm.sendSimple("#e#b<Expedition: " + expedName + ">\r\n#k#n" + em.getProperty("party") + "\r\n\r\nWould you like to assemble a team to take on #r" + expedBoss + "#k?\r\n#b#L1#Lets get this going!#l\r\n\#L2#No, I think I'll wait a bit...#l");
|
||||
status = 1;
|
||||
} else if (expedition.isLeader(player)) { //If you're the leader, manage the exped
|
||||
cm.sendSimple(list);
|
||||
status = 2;
|
||||
} else if (expedition.isRegistering()) { //If the expedition is registering
|
||||
if (expedition.contains(player)) { //If you're in it but it hasn't started, be patient
|
||||
cm.sendOk("You have already registered for the expedition. Please wait for #r" + expedition.getLeader().getName() + "#k to begin the expedition.");
|
||||
cm.dispose();
|
||||
} else { //If you aren't in it, you're going to get added
|
||||
cm.sendOk(expedition.addMember(cm.getPlayer()));
|
||||
cm.dispose();
|
||||
}
|
||||
} else if (expedition.isInProgress()) { //Only if the expedition is in progress
|
||||
if (expedition.contains(player)) { //If you're registered, warp you in
|
||||
var eim = em.getInstance(expedName + player.getClient().getChannel());
|
||||
if(eim.getIntProperty("canJoin") == 1) {
|
||||
eim.registerPlayer(player);
|
||||
} else {
|
||||
cm.sendOk("Your expedition already started the battle against " + expedBoss + ". Lets pray for those brave souls.");
|
||||
}
|
||||
|
||||
cm.dispose();
|
||||
} else { //If you're not in by now, tough luck
|
||||
cm.sendOk("Another expedition has taken the initiative to challenge " + expedBoss + ", lets pray for those brave souls.");
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
} else if (status == 1) {
|
||||
if (selection == 1) {
|
||||
expedition = cm.getExpedition(exped);
|
||||
if(expedition != null) {
|
||||
cm.sendOk("Someone already taken the initiative to be the leader of the expedition. Try joining them!");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
cm.createExpedition(exped);
|
||||
cm.sendOk("The #r" + expedBoss + " Expedition#k has been created.\r\n\r\nTalk to me again to view the current team, or start the fight!");
|
||||
cm.dispose();
|
||||
return;
|
||||
} else if (selection == 2) {
|
||||
cm.sendOk("Sure, not everyone's up to challenging " + expedBoss + ".");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
} else if (status == 2) {
|
||||
if (selection == 1) {
|
||||
if (expedition == null) {
|
||||
cm.sendOk("The expedition could not be loaded.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
var size = expedition.getMembers().size();
|
||||
if (size == 1) {
|
||||
cm.sendOk("You are the only member of the expedition.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
var text = "The following members make up your expedition (Click on them to expel them):\r\n";
|
||||
text += "\r\n\t\t1." + expedition.getLeader().getName();
|
||||
for (var i = 1; i < size; i++) {
|
||||
text += "\r\n#b#L" + (i + 1) + "#" + (i + 1) + ". " + expedition.getMembers().get(i).getName() + "#l\n";
|
||||
}
|
||||
cm.sendSimple(text);
|
||||
status = 6;
|
||||
} else if (selection == 2) {
|
||||
var min = exped.getMinSize();
|
||||
|
||||
var size = expedition.getMembers().size();
|
||||
if (size < min) {
|
||||
cm.sendOk("You need at least " + min + " players registered in your expedition.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
cm.sendOk("The expedition will begin and you will now be escorted to the #b" + expedMap + "#k.");
|
||||
status = 4;
|
||||
} else if (selection == 3) {
|
||||
player.getMap().broadcastMessage(MaplePacketCreator.serverNotice(6, expedition.getLeader().getName() + " has ended the expedition."));
|
||||
cm.endExpedition(expedition);
|
||||
cm.sendOk("The expedition has now ended. Sometimes the best strategy is to run away.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
} else if (status == 4) {
|
||||
if (em == null) {
|
||||
cm.sendOk("The event could not be initialized, please report this on the forum.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
em.setProperty("leader", player.getName());
|
||||
em.setProperty("channel", player.getClient().getChannel());
|
||||
if(!em.startInstance(expedition)) {
|
||||
cm.sendOk("Another expedition has taken the initiative to challenge " + expedBoss + ", lets pray for those brave souls.");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
cm.dispose();
|
||||
return;
|
||||
} else if (status == 6) {
|
||||
if (selection > 0) {
|
||||
var banned = expedition.getMembers().get(selection - 1);
|
||||
expedition.ban(banned);
|
||||
cm.sendOk("You have banned " + banned.getName() + " from the expedition.");
|
||||
cm.dispose();
|
||||
} else {
|
||||
cm.sendSimple(list);
|
||||
status = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user