Merge pull request #80 from P0nk/bug-79-dojo-scripts

Fix broken dojo scripts due to map constants
This commit is contained in:
Ponk
2022-08-02 16:43:37 +02:00
committed by GitHub
4 changed files with 7 additions and 7 deletions

View File

@@ -70,8 +70,8 @@ function action(mode, type, selection) {
if (isRestingSpot(cm.getPlayer().getMap().getId())) { if (isRestingSpot(cm.getPlayer().getMap().getId())) {
var text = "I'm surprised you made it this far! But it won't be easy from here on out. You still want the challenge?\r\n\r\n#b#L0#I want to continue#l\r\n#L1#I want to leave#l\r\n"; var text = "I'm surprised you made it this far! But it won't be easy from here on out. You still want the challenge?\r\n\r\n#b#L0#I want to continue#l\r\n#L1#I want to leave#l\r\n";
const GameConstants = Java.type('constants.game.GameConstants'); const MapId = Java.type('constants.id.MapId');
if (!GameConstants.isDojoPartyArea(cm.getPlayer().getMapId())) { if (!MapId.isPartyDojo(cm.getPlayer().getMapId())) {
text += "#L2#I want to record my score up to this point#l"; text += "#L2#I want to record my score up to this point#l";
} }
cm.sendSimple(text); cm.sendSimple(text);

View File

@@ -32,8 +32,8 @@ function enter(pi) {
pi.goDojoUp(); pi.goDojoUp();
pi.getPlayer().getMap().setReactorState(); pi.getPlayer().getMap().setReactorState();
var stage = Math.floor(pi.getPlayer().getMapId() / 100) % 100; var stage = Math.floor(pi.getPlayer().getMapId() / 100) % 100;
const GameConstants = Java.type('constants.game.GameConstants'); const MapId = Java.type('constants.id.MapId');
if ((stage - (stage / 6) | 0) == pi.getPlayer().getVanquisherStage() && !GameConstants.isDojoPartyArea(pi.getPlayer().getMapId())) // we can also try 5 * stage / 6 | 0 + 1 if ((stage - (stage / 6) | 0) == pi.getPlayer().getVanquisherStage() && !MapId.isPartyDojo(pi.getPlayer().getMapId())) // we can also try 5 * stage / 6 | 0 + 1
{ {
pi.getPlayer().setVanquisherKills(pi.getPlayer().getVanquisherKills() + 1); pi.getPlayer().setVanquisherKills(pi.getPlayer().getVanquisherKills() + 1);
} }

View File

@@ -155,8 +155,8 @@ public class NPCScriptManager extends AbstractScriptManager {
c.sendPacket(PacketCreator.enableActions()); c.sendPacket(PacketCreator.enableActions());
} }
return true; return true;
} catch (final Exception ute) { } catch (Exception e) {
log.error("Error starting NPC script: {}", npc); log.error("Error starting NPC script: {}", npc, e);
dispose(c); dispose(c);
return false; return false;

View File

@@ -71,7 +71,7 @@ public class PortalScriptManager extends AbstractScriptManager {
return script.enter(new PortalPlayerInteraction(c, portal)); return script.enter(new PortalPlayerInteraction(c, portal));
} }
} catch (Exception e) { } catch (Exception e) {
log.warn("Portal script {}", portal.getScriptName(), e); log.warn("Portal script error in: {}", portal.getScriptName(), e);
} }
return false; return false;
} }