Files
sweetgum-server/scripts/event/MK_PrimeMinister2.js
ronancpl 83266508af CPQ tidyup patch + Guild Creation matcher + Solution to Login Accid=0
Adjusted AP gains, to get it to work following the AP Reset check method.
Fixed usage of inexistent itemids on CPQ and fishing.
Fixed one-of-a-kind items being lost in player trades due to missing inventory checks.
Implemented matching system for the guild creation phase. All players intending to join the new guild must be on the Guild Headquartes and accept the creation of the guild.
Fixed changing jobs not properly updating info on the party tab.
Fixed double tooltip information on CPQ actions UI.
Fixed CPQ not disbanding after a player leaves the party/instance.
Fixed checks for "in-progress" CPQ instances.
Fixed changing maps on CPQ not leading players back to the starting battlefield.
Reviewed login system, now preventing non-local IP connecting on local server and local IP on non-local server.
Reviewed login system, now cherrypicking sessions in transition state when trying to disconnect them due to a failed login (avoiding possible mishaps due to duplicate sessions of a same account).
Adjusted PiratePQ stage 2, now mobs respawn rather than making party leader request for new waves.
Adjusted Prime Minister, its spawn is no longer related to starting the quest. It should also allow party fights.
Fixed "forcevac" command not properly applying, rather sending to inventory, "consume-on-pickup" items.
Fixed (probably) accId = 0 issue on login, that was occurring due to client accountid's being set to 0 a while before being checked once again on finishLogin().
Fixed an issue with extended time on CPQ not properly showing the end-match's visual effect.
2019-03-26 16:28:41 -03:00

148 lines
3.5 KiB
JavaScript

importPackage(Packages.tools);
importPackage(Packages.server.life);
var eventTime = 10 * 60 * 1000; // 10 minutes
var entryMap = 106021601;
var exitMap = 106021402;
var recruitMap = 106021402;
var minPlayers = 1, maxPlayers = 3;
var minLevel = 30, maxLevel = 255;
var minMapId = 106021601;
var maxMapId = 106021601;
var mobId = 3300008; //Prime Minister
function init(){}
function getEligibleParty(party) { //selects, from the given party, the team that is allowed to attempt this event
var eligible = [];
var hasLeader = false;
if(party.size() > 0) {
var partyList = party.toArray();
for(var i = 0; i < party.size(); i++) {
var ch = partyList[i];
if(ch.getMapId() == recruitMap && ch.getLevel() >= minLevel && ch.getLevel() <= maxLevel) {
if(ch.isLeader()) hasLeader = true;
eligible.push(ch);
}
}
}
if(!(hasLeader && eligible.length >= minPlayers && eligible.length <= maxPlayers)) eligible = [];
return eligible;
}
function setup(difficulty, lobbyId){
var eim = em.newInstance("MK_PrimeMinister2_" +lobbyId);
respawn(eim);
return eim;
}
function afterSetup(eim){}
function primeMinisterCheck(eim) {
var map = eim.getMapInstance(entryMap);
return !map.getAllPlayers().isEmpty();
}
function respawn(eim){
if (primeMinisterCheck(eim)) {
eim.startEventTimer(eventTime);
var weddinghall = eim.getMapInstance(entryMap);
weddinghall.getPortal(1).setPortalState(false);
weddinghall.spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(mobId), new java.awt.Point(292, 143));
} else {
eim.schedule("respawn", 10000);
}
}
function playerEntry(eim, player){
var weddinghall = eim.getMapInstance(entryMap);
player.changeMap(weddinghall, weddinghall.getPortal(1));
}
function scheduledTimeout(eim){
var party = eim.getPlayers();
for(var i = 0; i < party.size(); i++)
playerExit(eim, party.get(i));
eim.dispose();
}
function playerRevive(eim, player){
player.respawn(eim, entryMap);
return false;
}
function playerDead(eim, player){}
function playerDisconnected(eim, player){
var party = eim.getPlayers();
for(var i = 0; i < party.size(); i++){
if(party.get(i).equals(player))
removePlayer(eim, player);
else
playerExit(eim, party.get(i));
}
eim.dispose();
}
function monsterValue(eim, mobId){
return -1;
}
function leftParty(eim, player){}
function disbandParty(eim){}
function playerUnregistered(eim, player){}
function playerExit(eim, player){
eim.unregisterPlayer(player);
player.changeMap(exitMap, 2);
}
function changedMap(eim, chr, mapid) {
if(mapid < minMapId || mapid > maxMapId) playerExit(eim, chr);
}
function removePlayer(eim, player){
eim.unregisterPlayer(player);
player.getMap().removePlayer(player);
player.setMap(entryMap);
}
function cancelSchedule(){}
function dispose(){}
function clearPQ(eim){
eim.stopEventTimer();
eim.setEventCleared();
}
function monsterKilled(mob, eim){
if (mob.getId() == mobId) {
eim.getMapInstance(entryMap).getPortal(1).setPortalState(true);
eim.showClearEffect();
eim.clearPQ();
}
}
function allMonstersDead(eim){}
// ---------- FILLER FUNCTIONS ----------
function changedLeader(eim, leader) {}