Rewrote world map interface handling (search still not implemented)
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
package content.global.handlers.iface;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.component.ComponentDefinition;
|
||||
import core.game.component.ComponentPlugin;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the world map interface.
|
||||
* @author Emperor
|
||||
*
|
||||
*/
|
||||
@Initializable
|
||||
public final class WorldMapInterface extends ComponentPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ComponentDefinition.forId(755).setPlugin(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
//Thanks snicker!
|
||||
@Override
|
||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||
switch (button) {
|
||||
case 3:
|
||||
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
|
||||
player.getPacketDispatch().sendRunScript(1187, "ii", 0, 0);
|
||||
player.updateSceneGraph(true);
|
||||
return true;
|
||||
default:
|
||||
//log(this.getClass(), Log.ERR, "World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package content.global.handlers.iface
|
||||
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.InterfaceListener
|
||||
import org.rs09.consts.Components
|
||||
|
||||
class WorldMapInterface : InterfaceListener {
|
||||
override fun defineInterfaceListeners() {
|
||||
on(Components.WORLDMAP_755) { player, _, _, button, _, _ ->
|
||||
if (button == 3) {
|
||||
val paneId = if (player.interfaceManager.isResizable) {
|
||||
Components.TOPLEVEL_FULLSCREEN_746
|
||||
} else {
|
||||
Components.TOPLEVEL_548
|
||||
}
|
||||
player.interfaceManager.openWindowsPane(Component(paneId), 2)
|
||||
player.packetDispatch.sendRunScript(1187, "ii", 0, 0)
|
||||
player.updateSceneGraph(true)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user