Reworked Singapore/Malaysia + warp fix
Reworked many aspects of the Malaysia/Singapore region (added DB data, enabled Latanica & Scarga expedition, fixed maps). Fixed some issues related with player warping.
This commit is contained in:
@@ -29,26 +29,34 @@ import java.awt.Point;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.script.Invocable;
|
||||
import javax.script.ScriptException;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import scripting.event.EventManager;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.TimerManager;
|
||||
import server.life.MapleLifeFactory;
|
||||
import server.life.MapleNPC;
|
||||
import server.maps.MapMonitor;
|
||||
import server.maps.MapleReactor;
|
||||
import server.maps.ReactorDropEntry;
|
||||
import tools.MaplePacketCreator;
|
||||
|
||||
/**
|
||||
* @author Lerk
|
||||
* @author Lerk, Ronan
|
||||
*/
|
||||
public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
private MapleReactor reactor;
|
||||
private MapleClient client;
|
||||
private Invocable iv;
|
||||
|
||||
public ReactorActionManager(MapleClient c, MapleReactor reactor) {
|
||||
public ReactorActionManager(MapleClient c, MapleReactor reactor, Invocable iv) {
|
||||
super(c);
|
||||
this.reactor = reactor;
|
||||
this.client = c;
|
||||
this.iv = iv;
|
||||
}
|
||||
|
||||
public void dropItems() {
|
||||
@@ -154,4 +162,32 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
|
||||
public void spawnFakeMonster(int id) {
|
||||
reactor.getMap().spawnFakeMonsterOnGroundBelow(MapleLifeFactory.getMonster(id), getPosition());
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> schedule(String methodName, long delay) {
|
||||
return schedule(methodName, null, delay);
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> schedule(final String methodName, final EventInstanceManager eim, long delay) {
|
||||
return TimerManager.getInstance().schedule(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
iv.invokeFunction(methodName, eim);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> scheduleAtTimestamp(final String methodName, long timestamp) {
|
||||
return TimerManager.getInstance().scheduleAtTimestamp(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
iv.invokeFunction(methodName, (Object) null);
|
||||
} catch (ScriptException | NoSuchMethodException ex) {
|
||||
Logger.getLogger(EventManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}, timestamp);
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,10 @@ public class ReactorScriptManager extends AbstractScriptManager {
|
||||
|
||||
public void onHit(MapleClient c, MapleReactor reactor) {
|
||||
try {
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor);
|
||||
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);
|
||||
if (iv == null) {
|
||||
return;
|
||||
}
|
||||
if (iv == null) return;
|
||||
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor, iv);
|
||||
engine.put("rm", rm);
|
||||
iv.invokeFunction("hit");
|
||||
} catch(final NoSuchMethodException e) {
|
||||
@@ -67,11 +66,10 @@ public class ReactorScriptManager extends AbstractScriptManager {
|
||||
|
||||
public void act(MapleClient c, MapleReactor reactor) {
|
||||
try {
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor);
|
||||
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);
|
||||
if (iv == null) {
|
||||
return;
|
||||
}
|
||||
if (iv == null) return;
|
||||
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor, iv);
|
||||
engine.put("rm", rm);
|
||||
iv.invokeFunction("act");
|
||||
} catch (final ScriptException | NoSuchMethodException | NullPointerException e) {
|
||||
@@ -114,11 +112,10 @@ public class ReactorScriptManager extends AbstractScriptManager {
|
||||
|
||||
public synchronized void touching(MapleClient c, MapleReactor reactor, boolean touching) {
|
||||
try {
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor);
|
||||
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);
|
||||
if (iv == null) {
|
||||
return;
|
||||
}
|
||||
if (iv == null) return;
|
||||
|
||||
ReactorActionManager rm = new ReactorActionManager(c, reactor, iv);
|
||||
engine.put("rm", rm);
|
||||
if (touching) {
|
||||
iv.invokeFunction("touch");
|
||||
|
||||
Reference in New Issue
Block a user