From 984adc7885bab8c3d9e98033263f378d8b335922 Mon Sep 17 00:00:00 2001 From: P0nk Date: Sat, 17 Apr 2021 19:59:27 +0200 Subject: [PATCH] Convert portal scripts to Graal --- scripts/portal/ariant_queens.js | 3 +-- scripts/portal/davy_next4.js | 6 +++--- scripts/portal/dojang_up.js | 3 +-- scripts/portal/enterMCave.js | 9 ++++----- scripts/portal/enterPort.js | 7 ++++--- scripts/portal/party3_jailin.js | 3 +-- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/scripts/portal/ariant_queens.js b/scripts/portal/ariant_queens.js index d12a8f5283..67a0deb58c 100644 --- a/scripts/portal/ariant_queens.js +++ b/scripts/portal/ariant_queens.js @@ -18,9 +18,8 @@ along with this program. If not, see . */ -importPackage(Packages.client); - function isTigunMorphed(ch) { + const MapleBuffStat = Java.type('client.MapleBuffStat'); return ch.getBuffSource(MapleBuffStat.MORPH) == 2210005; } diff --git a/scripts/portal/davy_next4.js b/scripts/portal/davy_next4.js index 6cc7ad2a4e..a7cfc46440 100644 --- a/scripts/portal/davy_next4.js +++ b/scripts/portal/davy_next4.js @@ -1,5 +1,3 @@ -importPackage(Packages.server.life); - function enter(pi) { if (pi.getMap().getReactorByName("sMob1").getState() >= 1 && pi.getMap().getReactorByName("sMob2").getState() >= 1 && pi.getMap().getReactorByName("sMob3").getState() >= 1 && pi.getMap().getReactorByName("sMob4").getState() >= 1 && pi.getMap().getMonsters().size() == 0) { var eim = pi.getEventInstance(); @@ -9,13 +7,15 @@ function enter(pi) { var chests = parseInt(eim.getProperty("openedChests")); var boss; + const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); if(chests == 0) boss = MapleLifeFactory.getMonster(9300119); //lord pirate else if(chests == 1) boss = MapleLifeFactory.getMonster(9300105); //angry lord pirate else boss = MapleLifeFactory.getMonster(9300106); //enraged lord pirate boss.changeDifficulty(level, true); - pi.getMap(925100500).spawnMonsterOnGroundBelow(boss, new java.awt.Point(777, 140)); + const Point = Java.type('java.awt.Point'); + pi.getMap(925100500).spawnMonsterOnGroundBelow(boss, new Point(777, 140)); eim.setProperty("spawnedBoss", "true"); } diff --git a/scripts/portal/dojang_up.js b/scripts/portal/dojang_up.js index e3f60ef36f..1a6b7eee53 100644 --- a/scripts/portal/dojang_up.js +++ b/scripts/portal/dojang_up.js @@ -25,14 +25,13 @@ * @maps: All Dojo fighting maps */ -importPackage(Packages.constants.game); - function enter(pi) { try { if (pi.getPlayer().getMap().getMonsterById(9300216) != null) { pi.goDojoUp(); pi.getPlayer().getMap().setReactorState(); var stage = Math.floor(pi.getPlayer().getMapId() / 100) % 100; + const GameConstants = Java.type('constants.game.GameConstants'); if ((stage - (stage / 6) | 0) == pi.getPlayer().getVanquisherStage() && !GameConstants.isDojoPartyArea(pi.getPlayer().getMapId())) // we can also try 5 * stage / 6 | 0 + 1 pi.getPlayer().setVanquisherKills(pi.getPlayer().getVanquisherKills() + 1); } else { diff --git a/scripts/portal/enterMCave.js b/scripts/portal/enterMCave.js index e121cc1b5f..34d720b36f 100644 --- a/scripts/portal/enterMCave.js +++ b/scripts/portal/enterMCave.js @@ -1,6 +1,3 @@ -importPackage(Packages.server.quest); -importPackage(Packages.server.life); - function enter(pi) { if(pi.isQuestStarted(21201)) { // Second Job for (var i = 108000700; i < 108000709; i++){ @@ -36,7 +33,9 @@ function enter(pi) { function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - + + const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const Point = Java.type('java.awt.Point'); var mob = MapleLifeFactory.getMonster(id); - map.spawnMonsterOnGroundBelow(mob, new java.awt.Point(x, y)); + map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/portal/enterPort.js b/scripts/portal/enterPort.js index e79056d85c..d162cc1529 100644 --- a/scripts/portal/enterPort.js +++ b/scripts/portal/enterPort.js @@ -19,7 +19,6 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -importPackage(Packages.server.life); function enter(pi) { if(pi.isQuestStarted(21301) && pi.getQuestProgressInt(21301, 9001013) == 0) { @@ -42,7 +41,9 @@ function enter(pi) { function spawnMob(x, y, id, map) { if(map.getMonsterById(id) != null) return; - + + const MapleLifeFactory = Java.type('server.life.MapleLifeFactory'); + const Point = Java.type('java.awt.Point'); var mob = MapleLifeFactory.getMonster(id); - map.spawnMonsterOnGroundBelow(mob, new java.awt.Point(x, y)); + map.spawnMonsterOnGroundBelow(mob, new Point(x, y)); } \ No newline at end of file diff --git a/scripts/portal/party3_jailin.js b/scripts/portal/party3_jailin.js index 64847fd211..2ccdeac4ed 100644 --- a/scripts/portal/party3_jailin.js +++ b/scripts/portal/party3_jailin.js @@ -1,5 +1,3 @@ -importPackage(Packages.tools); - var leverSequenceExit = false; function enterLeverSequence(pi) { @@ -30,6 +28,7 @@ function enterLeverSequence(pi) { } } + const MaplePacketCreator = Java.type('tools.MaplePacketCreator'); if(countMiss > 0) { map.broadcastMessage(MaplePacketCreator.showEffect("quest/party/wrong_kor")); map.broadcastMessage(MaplePacketCreator.playSound("Party1/Failed"));