mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Added world map!
This commit is contained in:
parent
f342510204
commit
e6e190ff23
4 changed files with 58 additions and 31 deletions
|
|
@ -7,11 +7,20 @@ import org.crandor.net.packet.context.CSConfigContext;
|
|||
/**
|
||||
* The outgoing packet for client script configs.
|
||||
*
|
||||
* @author Torchic
|
||||
* @author Snickerize
|
||||
*/
|
||||
public class CSConfigPacket implements OutgoingPacket<CSConfigContext> {
|
||||
|
||||
@Override
|
||||
public void send(CSConfigContext context) {
|
||||
IoBuffer buffer = new IoBuffer(65);
|
||||
buffer.putLEShort(context.getPlayer().getInterfaceManager().getPacketCount(1));
|
||||
buffer.putC((byte) context.getValue());
|
||||
buffer.putLEShortA(context.getId());
|
||||
context.getPlayer().getDetails().getSession().write(buffer);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void send(CSConfigContext context) {
|
||||
IoBuffer buffer = new IoBuffer(115);
|
||||
buffer.putShort(context.getId());
|
||||
|
|
@ -27,5 +36,5 @@ public class CSConfigPacket implements OutgoingPacket<CSConfigContext> {
|
|||
|
||||
buffer.putInt(context.getValue());
|
||||
context.getPlayer().getDetails().getSession().write(buffer);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
@ -7,11 +7,11 @@ import org.crandor.net.packet.context.RunScriptContext;
|
|||
|
||||
/**
|
||||
* The run script outgoing packet.
|
||||
* @author Emperor
|
||||
* @author Snickerize
|
||||
*/
|
||||
public class RunScriptPacket implements OutgoingPacket<RunScriptContext> {
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void send(RunScriptContext context) {
|
||||
String string = context.getString();
|
||||
Object[] objects = context.getObjects();
|
||||
|
|
@ -27,6 +27,27 @@ public class RunScriptPacket implements OutgoingPacket<RunScriptContext> {
|
|||
}
|
||||
j++;
|
||||
}
|
||||
buffer.putInt(context.getId());
|
||||
context.getPlayer().getDetails().getSession().write(buffer);
|
||||
}*/
|
||||
@Override
|
||||
public void send(RunScriptContext context) {
|
||||
String types = context.getString();
|
||||
Object[] objects = context.getObjects();
|
||||
IoBuffer buffer = new IoBuffer(115, PacketHeader.SHORT);
|
||||
buffer.putShort(context.getPlayer().getInterfaceManager().getPacketCount(1));
|
||||
|
||||
buffer.putString(types);
|
||||
int j = 0;
|
||||
for (int i = (types.length() - 1); i >= 0; i--) {
|
||||
if (types.charAt(i) == 's') {
|
||||
buffer.putString((String) objects[j]);
|
||||
} else {
|
||||
buffer.putInt((Integer) objects[j]);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
buffer.putInt(context.getId());
|
||||
context.getPlayer().getDetails().getSession().write(buffer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,21 @@ public final class GameInterface extends ComponentPlugin {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* World map
|
||||
* Thanks, Snickerize!
|
||||
*/
|
||||
private void configureWorldMap(Player player) {
|
||||
if (player.inCombat()) {
|
||||
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
|
||||
return;
|
||||
}
|
||||
player.getInterfaceManager().openWindowsPane(new Component(755), 2);
|
||||
int posHash = (player.getLocation().getZ() << 28) | (player.getLocation().getX() << 14) | player.getLocation().getY();
|
||||
player.getPacketDispatch().sendScriptConfigs(622, posHash, "", 0);
|
||||
player.getPacketDispatch().sendScriptConfigs(674, posHash, "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to open the report interface.
|
||||
* @param player the player.
|
||||
|
|
@ -216,27 +231,4 @@ public final class GameInterface extends ComponentPlugin {
|
|||
* Configures the world map for a player.
|
||||
* @param player The player.
|
||||
*/
|
||||
private void configureWorldMap(Player player) {
|
||||
if (player.inCombat()) {
|
||||
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
|
||||
return;
|
||||
}
|
||||
// player.getInterfaceManager().openWindowsPane(new Component(755), 1);
|
||||
// player.getPacketDispatch().sendScriptConfig(1187, 0, "ii", 0);
|
||||
int position = player.getLocation().getX() << 14 | player.getLocation().getY() | player.getLocation().getZ() << 28;
|
||||
|
||||
// player.getPacketDispatch().sendScriptConfig(622, position, "ii");
|
||||
// player.getPacketDispatch().sendScriptConfig(674, position, "ii");
|
||||
// player.getPacketDispatch().sendScriptConfig(622, position);
|
||||
// player.getPacketDispatch().sendScriptConfig(674, position);
|
||||
System.out.println(position);
|
||||
|
||||
|
||||
/*player.getPacketDispatch().sendWindowsPane(755, 1);
|
||||
int hash = player.getLocation().getX() << 14 | player.getLocation().getY();
|
||||
player.getPacketDispatch().sendRunScript(622, "", hash);
|
||||
player.getPacketDispatch().sendRunScript(674, "", hash);
|
||||
PacketRepository.send(InterfaceConfig.class, new InterfaceConfigContext(player, 371, 25, true));
|
||||
player.setAttribute("worldMap:viewing", true);*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,19 @@ public final class WorldMapInterface extends ComponentPlugin {
|
|||
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);
|
||||
return true;
|
||||
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:
|
||||
System.err.println("World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue